diff options
author | johnsonm <devnull@localhost> | 1998-11-19 20:56:15 +0000 |
---|---|---|
committer | johnsonm <devnull@localhost> | 1998-11-19 20:56:15 +0000 |
commit | 8d6486d50f9bac50b3d49245e15b159933958cf9 (patch) | |
tree | 3776582bae30704ba54ac1ab1f46d0855873e7bf /popt | |
parent | 7e617bde3629f7fbfa7e600621a6196f2653498e (diff) | |
download | librpm-tizen-8d6486d50f9bac50b3d49245e15b159933958cf9.tar.gz librpm-tizen-8d6486d50f9bac50b3d49245e15b159933958cf9.tar.bz2 librpm-tizen-8d6486d50f9bac50b3d49245e15b159933958cf9.zip |
Improved man page a bit, install by default.
Added POPT_ARG_VAL
CVS patchset: 2545
CVS date: 1998/11/19 20:56:15
Diffstat (limited to 'popt')
-rw-r--r-- | popt/Makefile.am | 1 | ||||
-rw-r--r-- | popt/Makefile.in | 69 | ||||
-rw-r--r-- | popt/popt.3 | 34 | ||||
-rw-r--r-- | popt/popt.c | 6 | ||||
-rw-r--r-- | popt/popt.h | 1 | ||||
-rw-r--r-- | popt/popt.spec | 4 |
6 files changed, 89 insertions, 26 deletions
diff --git a/popt/Makefile.am b/popt/Makefile.am index 4284910f0..9777e2e04 100644 --- a/popt/Makefile.am +++ b/popt/Makefile.am @@ -14,6 +14,7 @@ test1_LDADD = -lpopt include_HEADERS = popt.h lib_LIBRARIES = libpopt.a libpopt_a_SOURCES = popt.c findme.c poptparse.c poptconfig.c popthelp.c +man_MANS = popt.3 CVSTAG = $(PACKAGE)-$(subst .,_,$(VERSION)) diff --git a/popt/Makefile.in b/popt/Makefile.in index 9fe78ed82..3ab14d4f4 100644 --- a/popt/Makefile.in +++ b/popt/Makefile.in @@ -82,6 +82,7 @@ test1_LDADD = -lpopt include_HEADERS = popt.h lib_LIBRARIES = libpopt.a libpopt_a_SOURCES = popt.c findme.c poptparse.c poptconfig.c popthelp.c +man_MANS = popt.3 CVSTAG = $(PACKAGE)-$(subst .,_,$(VERSION)) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -105,11 +106,15 @@ test1_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ +man3dir = $(mandir)/man3 +MANS = $(man_MANS) + +NROFF = nroff HEADERS = $(include_HEADERS) DIST_COMMON = README COPYING Makefile.am Makefile.in acconfig.h \ -aclocal.m4 config.h.in configure configure.in install-sh missing \ -mkinstalldirs stamp-h.in +aclocal.m4 config.h.in configure.in install-sh missing mkinstalldirs \ +stamp-h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -227,6 +232,45 @@ test1: $(test1_OBJECTS) $(test1_DEPENDENCIES) @rm -f test1 $(LINK) $(test1_LDFLAGS) $(test1_OBJECTS) $(test1_LDADD) $(LIBS) +install-man3: + $(mkinstalldirs) $(DESTDIR)$(man3dir) + @list='$(man3_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.3*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man3dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man3dir)/$$inst; \ + done + +uninstall-man3: + @list='$(man3_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.3*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man3dir)/$$inst"; \ + rm -f $(DESTDIR)$(man3dir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) install-man3 +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) uninstall-man3 + install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(includedir) @@ -394,13 +438,13 @@ installcheck: installcheck-recursive all-recursive-am: config.h $(MAKE) all-recursive -all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) config.h +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) config.h install-exec-am: install-libLIBRARIES -install-data-am: install-includeHEADERS +install-data-am: install-man install-includeHEADERS -uninstall-am: uninstall-libLIBRARIES uninstall-includeHEADERS +uninstall-am: uninstall-libLIBRARIES uninstall-man uninstall-includeHEADERS install-exec: install-exec-recursive install-exec-am @$(NORMAL_INSTALL) @@ -416,7 +460,8 @@ uninstall: uninstall-recursive uninstall-am install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: installdirs-recursive - $(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(includedir) + $(mkinstalldirs) $(DATADIR)$(libdir) $(DESTDIR)$(mandir)/man3 \ + $(DATADIR)$(includedir) mostlyclean-generic: @@ -469,12 +514,12 @@ maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ install-libLIBRARIES mostlyclean-compile distclean-compile \ clean-compile maintainer-clean-compile mostlyclean-noinstPROGRAMS \ distclean-noinstPROGRAMS clean-noinstPROGRAMS \ -maintainer-clean-noinstPROGRAMS uninstall-includeHEADERS \ -install-includeHEADERS install-data-recursive uninstall-data-recursive \ -install-exec-recursive uninstall-exec-recursive installdirs-recursive \ -uninstalldirs-recursive all-recursive check-recursive \ -installcheck-recursive info-recursive dvi-recursive \ -mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-noinstPROGRAMS install-man3 uninstall-man3 install-man \ +uninstall-man uninstall-includeHEADERS install-includeHEADERS \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir \ mostlyclean-depend distclean-depend clean-depend \ diff --git a/popt/popt.3 b/popt/popt.3 index eaf6c4026..e299826af 100644 --- a/popt/popt.3 +++ b/popt/popt.3 @@ -110,23 +110,23 @@ first two members, the first is a long name, while the latter is a single character. .sp The -.IR argInfo " member tell popt what type of argument is expected" +.IR argInfo " member tells popt what type of argument is expected" after the argument. If no option is expected, -.BR POPT_ARG_NONE " should be used. (Connoisseurs of " getopt() -.RI "will note that " argInfo " is the only required field of " -.BR "struct poptOption" " that is not directly analogous to a field in " -.RB "the " getopt_long() " argument table. The similarity between the " -.RB "two allows for easy transitions from " getopt_long " to popt.) " +.B POPT_ARG_NONE +should be used. The rest of the valid values are shown in the following table: .sp -.nf -.B " Value Description arg Type" -.BR POPT_ARG_NONE " No argument expected int" -.BR POPT_ARG_STRING " No type checking to be performed char *" -.BR POPT_ARG_INT " An integer argument is expected int" -.BR POPT_ARG_LONG " A long integer is expected long" +.TS +lfB lfB lfB +lfB lfR lfR. +Value Description arg Type +POPT_ARG_NONE No argument expected int +POPT_ARG_STRING No type checking to be performed char * +POPT_ARG_INT An integer argument is expected int +POPT_ARG_LONG A long integer is expected long +POPT_ARG_VAL Integer value taken from \f(CWval\fR int +.TE .sp -.fi If \fIargInfo\fR value is logically or'd with \fBPOPT_ARGFLAG_ONEDASH\fR, the long argument may be given with a single - instead of two. For example, if \fB--longopt\fR is an option with \fBPOPT_ARGFLAG_ONEDASH\fR, is @@ -149,6 +149,14 @@ an argument, the variable that .BR POPT_ARG_INT " and " POPT_ARG_LONG " are converted to the appropriate type, and an error returned if the conversion fails. .sp +\fBPOPT_ARG_VAL\fR causes \fIarg\fP to be set to the (integer) value of +\fIval\fP when the argument is found. This is most often useful for +mutually-exclusive arguments in cases where it is not an error for +multiple arguments to occur and where you want the last argument +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 .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 ca97e5de4..f9e615388 100644 --- a/popt/popt.c +++ b/popt/popt.c @@ -392,6 +392,10 @@ int poptGetNextOpt(poptContext con) { *((char **) opt->arg) = con->os->nextArg; break; + case POPT_ARG_VAL: + *((int *) opt->arg) = opt->val; + break; + case POPT_ARG_INT: case POPT_ARG_LONG: aLong = strtol(con->os->nextArg, &end, 0); @@ -419,7 +423,7 @@ int poptGetNextOpt(poptContext con) { if (cb) cb(con, POPT_CALLBACK_REASON_OPTION, opt, con->os->nextArg, cbData); - else if (opt->val) + else if (opt->val && ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL)) done = 1; if ((con->finalArgvCount + 2) >= (con->finalArgvAlloced)) { diff --git a/popt/popt.h b/popt/popt.h index e21604949..069cab112 100644 --- a/popt/popt.h +++ b/popt/popt.h @@ -22,6 +22,7 @@ for this table and any included tables; arg points to the domain string */ +#define POPT_ARG_VAL 7 /* arg should take value val */ #define POPT_ARG_MASK 0x0000FFFF #define POPT_ARGFLAG_ONEDASH 0x80000000 /* allow -longoption */ #define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /* don't show in help/usage */ diff --git a/popt/popt.spec b/popt/popt.spec index 718e75caa..3a2ddc124 100644 --- a/popt/popt.spec +++ b/popt/popt.spec @@ -32,8 +32,12 @@ rm -rf $RPM_BUILD_ROOT %files %attr(0644, root, root) /usr/lib/libpopt.a %attr(0644, root, root) /usr/include/popt.h +%attr(0644, root, root) /usr/man/man3/popt.3 %changelog +* Tue Nov 17 1998 Michael K. Johnson <johnsonm@redhat.com> +- added man page to default install + * Thu Oct 22 1998 Erik Troan <ewt@redhat.com> - see CHANGES file for 1.2 |