diff options
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | Makefile.am | 12 | ||||
-rw-r--r-- | popt/po/cs.po | 2 | ||||
-rw-r--r-- | popt/po/da.po | 2 | ||||
-rw-r--r-- | popt/po/de.po | 2 | ||||
-rw-r--r-- | popt/po/es.po | 2 | ||||
-rw-r--r-- | popt/po/fi.po | 2 | ||||
-rw-r--r-- | popt/po/fr.po | 2 | ||||
-rw-r--r-- | popt/po/gl.po | 2 | ||||
-rw-r--r-- | popt/po/hu.po | 2 | ||||
-rw-r--r-- | popt/po/id.po | 2 | ||||
-rw-r--r-- | popt/po/is.po | 2 | ||||
-rw-r--r-- | popt/po/it.po | 2 | ||||
-rw-r--r-- | popt/po/ja.po | 2 | ||||
-rw-r--r-- | popt/po/ko.po | 2 | ||||
-rw-r--r-- | popt/po/no.po | 2 | ||||
-rw-r--r-- | popt/po/pl.po | 2 | ||||
-rw-r--r-- | popt/po/popt.pot | 2 | ||||
-rw-r--r-- | popt/po/pt.po | 2 | ||||
-rw-r--r-- | popt/po/pt_BR.po | 2 | ||||
-rw-r--r-- | popt/po/ro.po | 2 | ||||
-rw-r--r-- | popt/po/ru.po | 2 | ||||
-rw-r--r-- | popt/po/sk.po | 2 | ||||
-rw-r--r-- | popt/po/sl.po | 2 | ||||
-rw-r--r-- | popt/po/sr.po | 2 | ||||
-rw-r--r-- | popt/po/sv.po | 2 | ||||
-rw-r--r-- | popt/po/tr.po | 2 | ||||
-rw-r--r-- | popt/po/uk.po | 2 | ||||
-rw-r--r-- | popt/po/wa.po | 2 | ||||
-rw-r--r-- | popt/po/zh.po | 2 | ||||
-rw-r--r-- | popt/po/zh_CN.GB2312.po | 2 | ||||
-rw-r--r-- | popt/popt.3 | 6 | ||||
-rw-r--r-- | popt/popt.c | 54 | ||||
-rw-r--r-- | popt/popt.h | 3 | ||||
-rw-r--r-- | popt/popthelp.c | 66 | ||||
-rw-r--r-- | popt/test1.c | 6 | ||||
-rwxr-xr-x | popt/testit.sh | 5 | ||||
-rw-r--r-- | rpm.spec | 8 | ||||
-rw-r--r-- | rpm.spec.in | 8 |
39 files changed, 162 insertions, 66 deletions
@@ -86,6 +86,8 @@ - (python): bind initdb (#20988). - (popt): fix float/double handling (#19701). - (popt): non-linux needs <float.h> (#22732). + - (popt): add POPT_ARGFLAG_OPTIONAL for long options with optional arg. + - (popt): diddle auto-help to include type of arg expected. 3.0.6 -> 4.0 - use DIRNAMES/BASENAMES/DIRINDICES not FILENAMES in packages and db. diff --git a/Makefile.am b/Makefile.am index fa44df9df..60dabf9ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,37 +50,37 @@ rpm_LDFLAGS = @LDFLAGS_STATIC@ $(myLDFLAGS) rpm_LDADD = $(myLDADD) @LIBMISC@ rpmb_SOURCES = build.c -rpmb_LDFLAGS = @LDFLAGS_STATIC@ $(myLDFLAGS) +rpmb_LDFLAGS = $(myLDFLAGS) rpmb_LDADD = rpmb.o $(myLDADD) rpmb.o: rpmqv.c $(COMPILE) -DIAM_RPMBT -o $@ -c $< rpmdb_SOURCES = -rpmdb_LDFLAGS = @LDFLAGS_STATIC@ $(myLDFLAGS) +rpmdb_LDFLAGS = $(myLDFLAGS) rpmdb_LDADD = rpmdb.o $(myLDADD) rpmdb.o: rpmqv.c $(COMPILE) -DIAM_RPMDB -o $@ -c $< rpmi_SOURCES = -rpmi_LDFLAGS = @LDFLAGS_STATIC@ $(myLDFLAGS) +rpmi_LDFLAGS = $(myLDFLAGS) rpmi_LDADD = rpmi.o $(myLDADD) rpmi.o: rpmqv.c $(COMPILE) -DIAM_RPMEIU -o $@ -c $< rpmk_SOURCES = -rpmk_LDFLAGS = @LDFLAGS_STATIC@ $(myLDFLAGS) +rpmk_LDFLAGS = $(myLDFLAGS) rpmk_LDADD = rpmk.o $(myLDADD) rpmk.o: rpmqv.c $(COMPILE) -DIAM_RPMK -o $@ -c $< rpmq_SOURCES = -rpmq_LDFLAGS = @LDFLAGS_STATIC@ $(myLDFLAGS) +rpmq_LDFLAGS = $(myLDFLAGS) rpmq_LDADD = rpmq.o $(myLDADD) rpmq.o: rpmqv.c $(COMPILE) -DIAM_RPMQV -o $@ -c $< rpm2cpio_SOURCES = rpm2cpio.c -rpm2cpio_LDFLAGS = @LDFLAGS_STATIC@ $(myLDFLAGS) +rpm2cpio_LDFLAGS = $(myLDFLAGS) rpm2cpio_LDADD = $(myLDADD) @LIBMISC@ $(PROGRAMS): $(myLDADD) @WITH_APIDOCS_TARGET@ diff --git a/popt/po/cs.po b/popt/po/cs.po index d81453bdf..b453b9f30 100644 --- a/popt/po/cs.po +++ b/popt/po/cs.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-08-23 22:24+0100\n" "Last-Translator: Milan Kerslager <milan.kerslager@spsselib.hiedu.cz>\n" "Language-Team: Czech <cs@li.org>\n" diff --git a/popt/po/da.po b/popt/po/da.po index ab784a524..348e8c2ec 100644 --- a/popt/po/da.po +++ b/popt/po/da.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-03-07 05:17+01:00\n" "Last-Translator: K. Christiansen <kenneth@gnu.org>\n" "Language-Team: Danish/Dansk <dansk@klid.dk>\n" diff --git a/popt/po/de.po b/popt/po/de.po index 35c422612..92426ed88 100644 --- a/popt/po/de.po +++ b/popt/po/de.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/es.po b/popt/po/es.po index 35c422612..92426ed88 100644 --- a/popt/po/es.po +++ b/popt/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/fi.po b/popt/po/fi.po index 35c422612..92426ed88 100644 --- a/popt/po/fi.po +++ b/popt/po/fi.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/fr.po b/popt/po/fr.po index 35c422612..92426ed88 100644 --- a/popt/po/fr.po +++ b/popt/po/fr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/gl.po b/popt/po/gl.po index 989e96354..38f28935d 100644 --- a/popt/po/gl.po +++ b/popt/po/gl.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-01-06 20:31+0100\n" "Last-Translator: Jesús Bravo Álvarez <jba@pobox.com>\n" "Language-Team: Galician <gpul-traduccion@ceu.fi.udc.es>\n" diff --git a/popt/po/hu.po b/popt/po/hu.po index 22b953f0d..d90a9ee6e 100644 --- a/popt/po/hu.po +++ b/popt/po/hu.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-08-03 23:26+0200\n" "Last-Translator: László Németh <nemeth@qwertynet.hu>\n" "Language-Team: Hungarian\n" diff --git a/popt/po/id.po b/popt/po/id.po index 35c422612..92426ed88 100644 --- a/popt/po/id.po +++ b/popt/po/id.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/is.po b/popt/po/is.po index 2e582b259..6d6d63ded 100644 --- a/popt/po/is.po +++ b/popt/po/is.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-06-16 02:12+0000\n" "Last-Translator: Richard Allen <ra@hp.is>\n" "Language-Team: is <kde-isl@mmedia.is>\n" diff --git a/popt/po/it.po b/popt/po/it.po index 35c422612..92426ed88 100644 --- a/popt/po/it.po +++ b/popt/po/it.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/ja.po b/popt/po/ja.po index 35c422612..92426ed88 100644 --- a/popt/po/ja.po +++ b/popt/po/ja.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/ko.po b/popt/po/ko.po index 35c422612..92426ed88 100644 --- a/popt/po/ko.po +++ b/popt/po/ko.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/no.po b/popt/po/no.po index 4443b9847..4864b4168 100644 --- a/popt/po/no.po +++ b/popt/po/no.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-06-21 16:11+02:00\n" "Last-Translator: Kjartan Maraas <kmaraas@online.no>\n" "Language-Team: Norwegian <no@li.org>\n" diff --git a/popt/po/pl.po b/popt/po/pl.po index 35c422612..92426ed88 100644 --- a/popt/po/pl.po +++ b/popt/po/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/popt.pot b/popt/po/popt.pot index 4fb4a861d..acd8de004 100644 --- a/popt/po/popt.pot +++ b/popt/po/popt.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/pt.po b/popt/po/pt.po index 398e7f799..9b10b57e3 100644 --- a/popt/po/pt.po +++ b/popt/po/pt.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-06-22 01:02+01:00\n" "Last-Translator: Pedro Morais <morais@kde.org>\n" "Language-Team: pt <morais@kde.org>\n" diff --git a/popt/po/pt_BR.po b/popt/po/pt_BR.po index 35c422612..92426ed88 100644 --- a/popt/po/pt_BR.po +++ b/popt/po/pt_BR.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/ro.po b/popt/po/ro.po index cf36c526d..c721649aa 100644 --- a/popt/po/ro.po +++ b/popt/po/ro.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-06-14 23:23+EST\n" "Last-Translator: Cristian Gafton <gafton@redhat.com>\n" "Language-Team: Romanian <ro@li.org>\n" diff --git a/popt/po/ru.po b/popt/po/ru.po index 692381b3a..f8f053b92 100644 --- a/popt/po/ru.po +++ b/popt/po/ru.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-08-13 21:00+0300\n" "Last-Translator: Leon Kanter <leon@blackcatlinux.com>\n" "Language-Team: Black Cat Linux Team <blackcat-support@blackcatlinux.com>\n" diff --git a/popt/po/sk.po b/popt/po/sk.po index 1a7cf7a3b..d17e68373 100644 --- a/popt/po/sk.po +++ b/popt/po/sk.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 1999-08-04 21:40+0200\n" "Last-Translator: Stanislav Meduna <stano@eunet.sk>\n" "Language-Team: Slovak <sk-i18n@rak.isternet.sk>\n" diff --git a/popt/po/sl.po b/popt/po/sl.po index 35071edbe..d33261225 100644 --- a/popt/po/sl.po +++ b/popt/po/sl.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-09-05 12:30+0200\n" "Last-Translator: Roman Maurer <roman.maurer@hermes.si>\n" "Language-Team: Slovenian <sl@li.org>\n" diff --git a/popt/po/sr.po b/popt/po/sr.po index 35c422612..92426ed88 100644 --- a/popt/po/sr.po +++ b/popt/po/sr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/sv.po b/popt/po/sv.po index 32fd97d91..e2f13287f 100644 --- a/popt/po/sv.po +++ b/popt/po/sv.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-06-20 00:07+0200\n" "Last-Translator: Christian Rose <menthos@menthos.com>\n" "Language-Team: Swedish <sv@li.org>\n" diff --git a/popt/po/tr.po b/popt/po/tr.po index 8e5c43d3e..e5280342f 100644 --- a/popt/po/tr.po +++ b/popt/po/tr.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 2000-01-06 13:01+0100\n" "Last-Translator: Görkem Çetin <kabalak@gmx.net>\n" "Language-Team: Gelecek A.Ţ <gorkem@gelecek.com.tr>\n" diff --git a/popt/po/uk.po b/popt/po/uk.po index 94d689028..913a46a67 100644 --- a/popt/po/uk.po +++ b/popt/po/uk.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 1999-09-30 16:54+0200\n" "Last-Translator: Yuri Syrota <rasta@renome.rovno.ua>\n" "Language-Team: Ukrainian <uk@li.org>\n" diff --git a/popt/po/wa.po b/popt/po/wa.po index 8731d70fb..c0c7ef51e 100644 --- a/popt/po/wa.po +++ b/popt/po/wa.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 1999-03-18 23:11+0100\n" "Last-Translator: Nobody yet\n" "Language-Team: walon <linux-wa@chanae.alphanet.ch>\n" diff --git a/popt/po/zh.po b/popt/po/zh.po index 35c422612..92426ed88 100644 --- a/popt/po/zh.po +++ b/popt/po/zh.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/po/zh_CN.GB2312.po b/popt/po/zh_CN.GB2312.po index 4459f615a..64932fa1d 100644 --- a/popt/po/zh_CN.GB2312.po +++ b/popt/po/zh_CN.GB2312.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: popt 1.6.1\n" -"POT-Creation-Date: 2000-12-30 14:24-0500\n" +"POT-Creation-Date: 2000-12-31 15:18-0500\n" "PO-Revision-Date: 1999-11-11 05:04+0800\n" "Last-Translator: Dillion Chen <dillon.chen@turbolinux.com.cn>\n" "Language-Team: TLDN\n" diff --git a/popt/popt.3 b/popt/popt.3 index 8d17f17c8..0d9e0b0d3 100644 --- a/popt/popt.3 +++ b/popt/popt.3 @@ -169,6 +169,12 @@ specified to win; for example, "rm -i -f". \fBPOPT_ARG_VAL\fP causes the parsing function not to return a value, since the value of \fIval\fP has already been used. .sp +If the \fIargInfo\fR value is bitwise or'd with \fBPOPT_ARGFLAG_OPTIONAL\fR, +the argument to the long option may be omitted. If the long option +is used without an argument, a default value of zero or NULL will be saved +(if the arg pointer is present), otherwise behavior will be identical to +a long option with argument. +.sp .RI "The next option, " val ", is the value popt's parsing function should return when the option is encountered. If it is 0, the parsing function does not return a value, instead parsing the next diff --git a/popt/popt.c b/popt/popt.c index 79bfdaaa0..d67e31373 100644 --- a/popt/popt.c +++ b/popt/popt.c @@ -674,35 +674,43 @@ int poptGetNextOpt(poptContext con) con->os > con->optionStack) { cleanOSE(con->os--); } - if (con->os->next == con->os->argc) - return POPT_ERROR_NOARG; - - /* make sure this isn't part of a short arg or the - result of an alias expansion */ - if (con->os == con->optionStack && - opt->argInfo & POPT_ARGFLAG_STRIP && - canstrip) { - poptStripArg(con, con->os->next); - } + if (con->os->next == con->os->argc) { + if (opt->argInfo & POPT_ARGFLAG_OPTIONAL) + con->os->nextArg = NULL; + else + return POPT_ERROR_NOARG; + } else { + + /* make sure this isn't part of a short arg or the + result of an alias expansion */ + if (con->os == con->optionStack && + opt->argInfo & POPT_ARGFLAG_STRIP && + canstrip) { + poptStripArg(con, con->os->next); + } - con->os->nextArg = expandNextArg(con, con->os->argv[con->os->next++]); + con->os->nextArg = expandNextArg(con, con->os->argv[con->os->next++]); + } } if (opt->arg) { switch (opt->argInfo & POPT_ARG_MASK) { case POPT_ARG_STRING: /* XXX memory leak, hard to plug */ - *((const char **) opt->arg) = xstrdup(con->os->nextArg); + *((const char **) opt->arg) = (con->os->nextArg) + ? xstrdup(con->os->nextArg) : NULL; break; case POPT_ARG_INT: case POPT_ARG_LONG: - { long aLong; + { long aLong = 0; char *end; - aLong = strtol(con->os->nextArg, &end, 0); - if (!(end && *end == '\0')) - return POPT_ERROR_BADNUMBER; + if (con->os->nextArg) { + aLong = strtol(con->os->nextArg, &end, 0); + if (!(end && *end == '\0')) + return POPT_ERROR_BADNUMBER; + } if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_LONG) { if (aLong == LONG_MIN || aLong == LONG_MAX) @@ -719,12 +727,14 @@ int poptGetNextOpt(poptContext con) case POPT_ARG_FLOAT: case POPT_ARG_DOUBLE: - { double aDouble; + { double aDouble = 0.0; char *end; - aDouble = strtod(con->os->nextArg, &end); - if (*end) - return POPT_ERROR_BADNUMBER; + if (con->os->nextArg) { + aDouble = strtod(con->os->nextArg, &end); + if (*end) + return POPT_ERROR_BADNUMBER; + } if (aDouble == +HUGE_VAL || aDouble == -HUGE_VAL) return POPT_ERROR_OVERFLOW; @@ -778,7 +788,9 @@ int poptGetNextOpt(poptContext con) else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL) /*@-ifempty@*/ ; else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) { - con->finalArgv[con->finalArgvCount++] = xstrdup(con->os->nextArg); + if (con->os->nextArg) + con->finalArgv[con->finalArgvCount++] = + xstrdup(con->os->nextArg); } } diff --git a/popt/popt.h b/popt/popt.h index 7a0a6b1b6..5bae6793b 100644 --- a/popt/popt.h +++ b/popt/popt.h @@ -37,7 +37,8 @@ extern "C" { #define POPT_ARG_MASK 0x0000FFFF #define POPT_ARGFLAG_ONEDASH 0x80000000 /* allow -longoption */ #define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /* don't show in help/usage */ -#define POPT_ARGFLAG_STRIP 0x20000000 /* strip this arg from argv (only applies to long args) */ +#define POPT_ARGFLAG_STRIP 0x20000000 /* strip this arg from argv(only applies to long args) */ +#define POPT_ARGFLAG_OPTIONAL 0x10000000 /* arg may be missing */ #define POPT_ARGFLAG_OR 0x08000000 /* arg will be or'ed */ #define POPT_ARGFLAG_NOR 0x09000000 /* arg will be nor'ed */ diff --git a/popt/popthelp.c b/popt/popthelp.c index c88d09440..12fb484ea 100644 --- a/popt/popthelp.c +++ b/popt/popthelp.c @@ -54,7 +54,17 @@ getArgDescrip(const struct poptOption * opt, const char *translation_domain) if (opt->argDescrip) return POPT_(opt->argDescrip); if (opt->argDescrip) return D_(translation_domain, opt->argDescrip); - return POPT_("ARG"); + + switch (opt->argInfo & POPT_ARG_MASK) { + case POPT_ARG_NONE: return POPT_("NONE"); + case POPT_ARG_VAL: return POPT_("VAL"); + case POPT_ARG_INT: return POPT_("INT"); + case POPT_ARG_LONG: return POPT_("LONG"); + case POPT_ARG_STRING: return POPT_("STRING"); + case POPT_ARG_FLOAT: return POPT_("FLOAT"); + case POPT_ARG_DOUBLE: return POPT_("DOUBLE"); + default: return POPT_("ARG"); + } } static void singleOptionHelp(FILE * f, int maxLeftCol, @@ -70,18 +80,60 @@ static void singleOptionHelp(FILE * f, int maxLeftCol, const char * argDescrip = getArgDescrip(opt, translation_domain); left = malloc(maxLeftCol + 1); - *left = '\0'; + left[0] = left[maxLeftCol] = '\0'; if (opt->longName && opt->shortName) - sprintf(left, "-%c, --%s", opt->shortName, opt->longName); + snprintf(left, maxLeftCol, "-%c, --%s", opt->shortName, opt->longName); else if (opt->shortName) - sprintf(left, "-%c", opt->shortName); + snprintf(left, maxLeftCol, "-%c", opt->shortName); else if (opt->longName) - sprintf(left, "--%s", opt->longName); + snprintf(left, maxLeftCol, "--%s", opt->longName); if (!*left) return ; if (argDescrip) { - strcat(left, "="); - strcat(left, argDescrip); + char * le = left + strlen(left); + int nl = maxLeftCol - (le - left); + if (opt->argInfo & POPT_ARGFLAG_OPTIONAL) { + *le++ = '['; nl--; + } + if (opt->argDescrip == NULL) { + switch (opt->argInfo & POPT_ARG_MASK) { + case POPT_ARG_NONE: + snprintf(le, nl-1, "[true]"); + break; + case POPT_ARG_VAL: + { long aLong = opt->val; + + if (opt->argInfo & POPT_ARGFLAG_NOT) aLong = ~aLong; + switch (opt->argInfo & POPT_ARGFLAG_LOGICALOPS) { + case POPT_ARGFLAG_OR: + snprintf(le, nl-1, "[|=0x%lx]", aLong); break; + case POPT_ARGFLAG_AND: + snprintf(le, nl-1, "[&=0x%lx]", aLong); break; + case POPT_ARGFLAG_XOR: + snprintf(le, nl-1, "[^=0x%lx]", aLong); break; + default: + if (!(aLong == 0L || aLong == 1L || aLong == -1L)) + snprintf(le, nl-1, "[=%ld]", aLong); + break; + } + } break; + case POPT_ARG_INT: + case POPT_ARG_LONG: + case POPT_ARG_STRING: + case POPT_ARG_FLOAT: + case POPT_ARG_DOUBLE: + snprintf(le, nl-1, "=%s", argDescrip); + break; + } + } else { + snprintf(le, nl-1, "=%s", argDescrip); + } + nl -= strlen(le); + le += strlen(le); + if (opt->argInfo & POPT_ARGFLAG_OPTIONAL) { + *le++ = ']'; nl--; + } + *le = '\0'; } if (help) diff --git a/popt/test1.c b/popt/test1.c index 5b6aeb723..7b7f55fe0 100644 --- a/popt/test1.c +++ b/popt/test1.c @@ -19,6 +19,7 @@ int inc = 0; int shortopt = 0; float aFloat = 0.0; double aDouble = 0.0; +char * oStr = (char *)-1; int singleDash = 0; static struct poptOption moreCallbackArgs[] = { @@ -54,6 +55,9 @@ static struct poptOption options[] = { "A float argument", "FLOAT" }, { "double", 'd', POPT_ARG_DOUBLE, &aDouble, 0, "A double argument", "DOUBLE" }, + { "ostr", '\0', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &oStr, 0, + "An optional str", "ARG" }, + { NULL, '-', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, &singleDash, 0 }, { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &moreArgs, 0, NULL }, { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &callbackArgs, 0, "Callback arguments" }, @@ -128,6 +132,8 @@ int main(int argc, const char ** argv) { fprintf(stdout, " aFloat: %g", aFloat); if (aDouble != 0.0) fprintf(stdout, " aDouble: %g", aDouble); + if (oStr != (char *)-1) + fprintf(stdout, " oStr: %s", (oStr ? oStr : "(none)")); if (singleDash) fprintf(stdout, " -"); diff --git a/popt/testit.sh b/popt/testit.sh index 975b5efde..ce5530a97 100755 --- a/popt/testit.sh +++ b/popt/testit.sh @@ -62,6 +62,11 @@ run test1 "test1 - 32" "arg1: 0 arg2: (none) aFloat: 10.1" -f 10.1 run test1 "test1 - 33" "arg1: 0 arg2: (none) aFloat: 10.1" --float 10.1 run test1 "test1 - 34" "arg1: 0 arg2: (none) aDouble: 10.1" -d 10.1 run test1 "test1 - 35" "arg1: 0 arg2: (none) aDouble: 10.1" --double 10.1 +run test1 "test1 - 36" "arg1: 0 arg2: (none) oStr: (none)" --ostr +run test1 "test1 - 37" "arg1: 0 arg2: (none) oStr: yadda" --ostr=yadda +run test1 "test1 - 38" "arg1: 0 arg2: (none) oStr: yadda" --ostr yadda +run test1 "test1 - 39" "arg1: 0 arg2: (none) oStr: ping rest: pong" --ostr=ping pong +run test1 "test1 - 40" "arg1: 0 arg2: (none) oStr: ping rest: pong" --ostr ping pong echo "" echo "Passed." @@ -13,7 +13,7 @@ Summary: The Red Hat package management system. Name: rpm %define version 4.0.2 Version: %{version} -Release: 0.12 +Release: 0.13 Group: System Environment/Base Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{version}.tar.gz Copyright: GPL @@ -309,6 +309,12 @@ fi %{__prefix}/include/popt.h %changelog +* Sun Dec 31 2000 Jeff Johnson <jbj@redhat.com> +- (popt): fix float/double handling (#19701). +- (popt): non-linux needs <float.h> (#22732). +- (popt): add POPT_ARGFLAG_OPTIONAL for long options with optional arg. +- (popt): diddle auto-help to include type of arg expected. + * Sat Dec 30 2000 Jeff Johnson <jbj@redhat.com> - (non-linux): move stubs.c to rpmio (#21132). - (python): bind initdb (#20988). diff --git a/rpm.spec.in b/rpm.spec.in index d6384aef1..a1f60a17e 100644 --- a/rpm.spec.in +++ b/rpm.spec.in @@ -13,7 +13,7 @@ Summary: The Red Hat package management system. Name: rpm %define version @VERSION@ Version: %{version} -Release: 0.12 +Release: 0.13 Group: System Environment/Base Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{version}.tar.gz Copyright: GPL @@ -309,6 +309,12 @@ fi %{__prefix}/include/popt.h %changelog +* Sun Dec 31 2000 Jeff Johnson <jbj@redhat.com> +- (popt): fix float/double handling (#19701). +- (popt): non-linux needs <float.h> (#22732). +- (popt): add POPT_ARGFLAG_OPTIONAL for long options with optional arg. +- (popt): diddle auto-help to include type of arg expected. + * Sat Dec 30 2000 Jeff Johnson <jbj@redhat.com> - (non-linux): move stubs.c to rpmio (#21132). - (python): bind initdb (#20988). |