summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rwxr-xr-xconfigure.ac4
-rw-r--r--popt.c9
-rw-r--r--poptconfig.c9
-rw-r--r--popthelp.c9
-rw-r--r--poptparse.c3
-rw-r--r--system.h5
-rw-r--r--test1.c4
8 files changed, 32 insertions, 14 deletions
diff --git a/CHANGES b/CHANGES
index 3ecd969..c345ed3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,7 @@
1.13 -> 1.14:
+ - jbj: test for <glob.h>, disable reading directory poptrc files if not.
+ - jbj: add __attribute__(__unused__) (Wayne Davidson<wayned@samba.org>).
+ - jbj: permit equal after short option (Wayne Davidson<wayned@samba.org>).
- jbj: make sure that short options are printed only once with --usage.
- jbj: don't display hidden short options with --usage.
- jbj: updated sv.po (Translation Project).
diff --git a/configure.ac b/configure.ac
index f027c93..5bfda5b 100755
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ AC_PROG_INSTALL
AC_PROG_LIBTOOL
if test "X$CC" = Xgcc; then
- CFLAGS="-Wall $CFLAGS"
+ CFLAGS="-Wall -W $CFLAGS"
fi
AC_GCC_TRADITIONAL
@@ -59,7 +59,7 @@ else
fi
AC_SUBST(TARGET)
-AC_CHECK_HEADERS(float.h libintl.h mcheck.h unistd.h langinfo.h)
+AC_CHECK_HEADERS(float.h glob.h libintl.h mcheck.h unistd.h langinfo.h)
# For some systems we know that we have ld_version scripts.
# Use it then as default.
diff --git a/popt.c b/popt.c
index 2883770..d7d9e23 100644
--- a/popt.c
+++ b/popt.c
@@ -644,8 +644,8 @@ static void poptStripArg(/*@special@*/ poptContext con, int which)
/*@=compdef@*/
}
-int poptSaveString(const char *** argvp, /*@unused@*/ unsigned int argInfo,
- const char * val)
+int poptSaveString(const char *** argvp,
+ /*@unused@*/ UNUSED(unsigned int argInfo), const char * val)
{
poptArgv argv;
int argc = 0;
@@ -937,6 +937,9 @@ int poptGetNextOpt(poptContext con)
origOptString++;
if (*origOptString != '\0')
con->os->nextCharArg = origOptString;
+#ifdef NOTYET /* XXX causes test 9 failure. */
+ con->os->nextCharArg = origOptString + (*origOptString == '=');
+#endif
}
if (opt == NULL) return POPT_ERROR_BADOPT; /* XXX can't happen */
@@ -1217,7 +1220,7 @@ poptContext poptFreeContext(poptContext con)
}
int poptAddAlias(poptContext con, struct poptAlias alias,
- /*@unused@*/ int flags)
+ /*@unused@*/ UNUSED(int flags))
{
struct poptItem_s item_buf;
poptItem item = &item_buf;
diff --git a/poptconfig.c b/poptconfig.c
index e81bf68..aef4082 100644
--- a/poptconfig.c
+++ b/poptconfig.c
@@ -9,7 +9,10 @@
#include "system.h"
#include "poptint.h"
#include <sys/stat.h>
+#if defined(HAVE_GLOB_H)
#include <glob.h>
+#endif
+
/*@access poptContext @*/
/*@-compmempass@*/ /* FIX: item->option.longName kept, not dependent. */
@@ -170,7 +173,7 @@ int poptReadConfigFile(poptContext con, const char * fn)
return 0;
}
-int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv)
+int poptReadDefaultConfig(poptContext con, /*@unused@*/ UNUSED(int useEnv))
{
static const char _popt_sysconfdir[] = POPT_SYSCONFDIR "/popt";
static const char _popt_etc[] = "/etc/popt";
@@ -188,11 +191,12 @@ int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv)
rc = poptReadConfigFile(con, _popt_etc);
if (rc) return rc;
+#if defined(HAVE_GLOB_H)
if (!stat("/etc/popt.d", &s) && S_ISDIR(s.st_mode)) {
glob_t g;
/*@-moduncon -nullpass -type @*/ /* FIX: annotations for glob/globfree */
if (!glob("/etc/popt.d/*", 0, NULL, &g)) {
- int i;
+ unsigned i;
for (i=0; i<g.gl_pathc; i++) {
char *f=g.gl_pathv[i];
if (strstr(f, ".rpmnew") || strstr(f, ".rpmsave"))
@@ -210,6 +214,7 @@ int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv)
}
/*@=moduncon =nullpass =type @*/
}
+#endif
if ((home = getenv("HOME"))) {
fn = malloc(strlen(home) + 20);
diff --git a/popthelp.c b/popthelp.c
index 0de5e6a..bd64d2c 100644
--- a/popthelp.c
+++ b/popthelp.c
@@ -34,9 +34,10 @@
*/
/*@exits@*/
static void displayArgs(poptContext con,
- /*@unused@*/ enum poptCallbackReason foo,
+ /*@unused@*/ UNUSED(enum poptCallbackReason foo),
struct poptOption * key,
- /*@unused@*/ const char * arg, /*@unused@*/ void * data)
+ /*@unused@*/ UNUSED(const char * arg),
+ /*@unused@*/ UNUSED(void * data))
/*@globals fileSystem@*/
/*@modifies fileSystem@*/
{
@@ -645,7 +646,7 @@ static size_t showHelpIntro(poptContext con, FILE * fp)
return len;
}
-void poptPrintHelp(poptContext con, FILE * fp, /*@unused@*/ int flags)
+void poptPrintHelp(poptContext con, FILE * fp, /*@unused@*/ UNUSED(int flags))
{
columns_t columns = calloc((size_t)1, sizeof(*columns));
int xx;
@@ -866,7 +867,7 @@ static size_t showShortOptions(const struct poptOption * opt, FILE * fp,
return len;
}
-void poptPrintUsage(poptContext con, FILE * fp, /*@unused@*/ int flags)
+void poptPrintUsage(poptContext con, FILE * fp, /*@unused@*/ UNUSED(int flags))
{
columns_t columns = calloc((size_t)1, sizeof(*columns));
struct poptDone_s done_buf;
diff --git a/poptparse.c b/poptparse.c
index eaf8427..f203743 100644
--- a/poptparse.c
+++ b/poptparse.c
@@ -126,7 +126,8 @@ exit:
* 2== line to long
* 3== umm.... more?
*/
-int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ int flags)
+int poptConfigFileToString(FILE *fp, char ** argstrp,
+ /*@unused@*/ UNUSED(int flags))
{
char line[999];
char * argstr;
diff --git a/system.h b/system.h
index 68a5c2a..9ed5a09 100644
--- a/system.h
+++ b/system.h
@@ -82,4 +82,9 @@ char * xstrdup (const char *str)
#define getenv(_s) __secure_getenv(_s)
#endif
+#ifndef __GNUC__
+#define __attribute__(x)
+#endif
+#define UNUSED(x) x __attribute__((__unused__))
+
#include "popt.h"
diff --git a/test1.c b/test1.c
index 7473040..24e7371 100644
--- a/test1.c
+++ b/test1.c
@@ -6,8 +6,8 @@
/*@unchecked@*/
static int pass2 = 0;
-static void option_callback(/*@unused@*/ poptContext con,
- /*@unused@*/ enum poptCallbackReason reason,
+static void option_callback(/*@unused@*/ UNUSED(poptContext con),
+ /*@unused@*/ UNUSED(enum poptCallbackReason reason),
const struct poptOption * opt,
char * arg, void * data)
/*@globals fileSystem @*/