From: Adam Heath Date: Sun, 14 Jan 2001 18:31:49 +0000 (+0000) Subject: Fix -Wall messages. Also, fix handling of user-defined fields in X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1223023a31b091a151a6f9a84c2da89f0bc4e779;p=dpkg Fix -Wall messages. Also, fix handling of user-defined fields in parsedb(). --- diff --git a/ChangeLog b/ChangeLog index 3f7657ec..38f060dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Jan 14 12:29:46 CST 2001 Adam Heath + + * lib/mlib.c, lib/fields.c, lib/parse.c, main/help.c, main/main.c, + po/dpkg.pot: Fix -Wall messages. Also, fix handling of user-defined + fields in parsedb(). + Sun Jan 14 02:46:14 CST 2001 Adam Heath * po/dpkg.pot: Bring up to date. diff --git a/lib/fields.c b/lib/fields.c index c377fec4..386c54b3 100644 --- a/lib/fields.c +++ b/lib/fields.c @@ -35,7 +35,7 @@ static int convert_string const char **endpp) { const char *ep; - int c, l; + int c, l = 0; ep= startp; if (!*ep) parseerr(0,filename,lno, warnto,warncount,pigp,0, _("%s is missing"),what); diff --git a/lib/mlib.c b/lib/mlib.c index e67f54d5..f741b60c 100644 --- a/lib/mlib.c +++ b/lib/mlib.c @@ -121,6 +121,7 @@ int checksubprocerr(int status, const char *description, int sigpipeok, int warn } else { ohshit(_("subprocess %s failed with wait status code %d"),description,status); } + return -1; } int waitsubproc(pid_t pid, const char *description, int sigpipeok, int warn) { diff --git a/lib/parse.c b/lib/parse.c index d10e0f68..ae6a8028 100644 --- a/lib/parse.c +++ b/lib/parse.c @@ -81,7 +81,6 @@ int parsedb(const char *filename, enum parsedbflags flags, /* warnto, warncount and donep may be null. * If donep is not null only one package's information is expected. */ - static char readbuf[16384]; int fd; struct pkginfo newpig, *pigp; @@ -92,7 +91,6 @@ int parsedb(const char *filename, enum parsedbflags flags, int fieldencountered[NFIELDS]; const struct fieldinfo *fip; const struct nickname *nick; - const char *fieldname; char *data, *dataptr, *endptr; const char *fieldstart, *valuestart; char *value= NULL; @@ -211,9 +209,9 @@ int parsedb(const char *filename, enum parsedbflags flags, _("user-defined field name `%.*s' too short"), fieldstart,fieldlen); larpp= &newpifp->arbs; while ((arp= *larpp) != 0) { - if (!strncasecmp(arp->name,fieldname,fieldlen)) + if (!strncasecmp(arp->name,fieldstart,fieldlen)) parseerr(0,filename,lno, warnto,warncount,&newpig,0, - _("duplicate value for user-defined field `%.*s'"), fieldname,fieldlen); + _("duplicate value for user-defined field `%.*s'"), fieldstart,fieldlen); larpp= &arp->next; } arp= nfmalloc(sizeof(struct arbitraryfield)); diff --git a/main/help.c b/main/help.c index 0ee2d42f..452456b9 100644 --- a/main/help.c +++ b/main/help.c @@ -272,11 +272,10 @@ static int do_script(const char *pkg, const char *scriptname, const char *script int maintainer_script_installed(struct pkginfo *pkg, const char *scriptname, const char *description, ...) { /* all ...'s are const char*'s */ - const char *scriptpath, *scriptexec; + const char *scriptpath; char *const *arglist; struct stat stab; va_list ap; - int c1; char buf[100]; scriptpath= pkgadminfile(pkg,scriptname); @@ -301,11 +300,9 @@ int maintainer_script_new(const char *pkgname, const char *scriptname, const char *description, const char *cidir, char *cidirrest, ...) { char *const *arglist; - const char *scriptexec; struct stat stab; va_list ap; char buf[100]; - int c1; va_start(ap,cidirrest); arglist= vbuildarglist(scriptname,ap); @@ -329,12 +326,10 @@ int maintainer_script_alternative(struct pkginfo *pkg, const char *scriptname, const char *description, const char *cidir, char *cidirrest, const char *ifok, const char *iffallback) { - const char *oldscriptpath, *scriptexec; + const char *oldscriptpath; char *const *arglist; struct stat stab; - int c1, n, status; char buf[100]; - pid_t r; oldscriptpath= pkgadminfile(pkg,scriptname); arglist= buildarglist(scriptname, diff --git a/main/main.c b/main/main.c index 6c658e8a..b1cdfed6 100644 --- a/main/main.c +++ b/main/main.c @@ -420,10 +420,10 @@ void commandfd(const char *const *argv) { jmp_buf ejbuf; struct varbuf linevb; const char * pipein; - const char **newargs, **oldargs= NULL; + const char **newargs; char *ptr, *endptr; FILE *in; - int argc= 1, mode= 0, c, lno= 0, infd, i; + int c, lno, infd, i; static void (*actionfunction)(const char *const *argv); if ((pipein= *argv++) == NULL) badusage(_("--command-fd takes 1 argument, not 0")); @@ -433,11 +433,14 @@ void commandfd(const char *const *argv) { if ((in= fdopen(infd, "r")) == NULL) ohshite(_("couldn't open `%i' for stream"), infd); + if (setjmp(ejbuf)) { /* expect warning about possible clobbering of argv */ + error_unwind(ehflag_bombout); exit(2); + } varbufinit(&linevb); - for (;;argc= 1,mode= 0) { - if (setjmp(ejbuf)) { /* expect warning about possible clobbering of argv */ - error_unwind(ehflag_bombout); exit(2); - } + for (;;lno= 0) { + const char **oldargs= NULL; + int argc= 1, mode= 0; + lno= 0; push_error_handler(&ejbuf,print_error_fatal,0); do { c= getc(in); if (c == '\n') lno++; } while (c != EOF && isspace(c)); diff --git a/po/dpkg.pot b/po/dpkg.pot index 8dea0a13..0ea341e6 100644 --- a/po/dpkg.pot +++ b/po/dpkg.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-01-14 02:41-0600\n" +"POT-Creation-Date: 2001-01-14 12:29-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -462,52 +462,52 @@ msgstr "" msgid "subprocess %s failed with wait status code %d" msgstr "" -#: lib/mlib.c:131 +#: lib/mlib.c:132 #, c-format msgid "wait for %s failed" msgstr "" -#: lib/mlib.c:179 +#: lib/mlib.c:180 #, c-format msgid "failed in buffer_write(fd) (%i, ret=%i, %s)" msgstr "" -#: lib/mlib.c:186 +#: lib/mlib.c:187 #, c-format msgid "eof in buffer_write(stream): %s" msgstr "" -#: lib/mlib.c:188 +#: lib/mlib.c:189 #, c-format msgid "error in buffer_write(stream): %s" msgstr "" -#: lib/mlib.c:194 +#: lib/mlib.c:195 #, c-format msgid "unknown data type `%i' in buffer_write\n" msgstr "" -#: lib/mlib.c:210 +#: lib/mlib.c:211 #, c-format msgid "failed in buffer_read(fd): %s" msgstr "" -#: lib/mlib.c:217 +#: lib/mlib.c:218 #, c-format msgid "error in buffer_read(stream): %s" msgstr "" -#: lib/mlib.c:220 +#: lib/mlib.c:221 #, c-format msgid "unknown data type `%i' in buffer_read\n" msgstr "" -#: lib/mlib.c:267 +#: lib/mlib.c:268 #, c-format msgid "failed to allocate buffer in buffer_copy (%s)" msgstr "" -#: lib/mlib.c:298 +#: lib/mlib.c:299 #, c-format msgid "failed in buffer_copy (%s)" msgstr "" @@ -572,99 +572,99 @@ msgstr "" msgid "-%c option does not take a value" msgstr "" -#: lib/parse.c:106 +#: lib/parse.c:104 #, c-format msgid "failed to open package info file `%.255s' for reading" msgstr "" -#: lib/parse.c:111 +#: lib/parse.c:109 #, c-format msgid "can't stat package info file `%.255s'" msgstr "" -#: lib/parse.c:115 +#: lib/parse.c:113 #, c-format msgid "can't mmap package info file `%.255s'" msgstr "" -#: lib/parse.c:118 +#: lib/parse.c:116 #, c-format msgid "failed to malloc for info file `%.255s'" msgstr "" -#: lib/parse.c:120 +#: lib/parse.c:118 #, c-format msgid "copy info file `%.255s'" msgstr "" -#: lib/parse.c:149 +#: lib/parse.c:147 #, c-format msgid "EOF after field name `%.*s'" msgstr "" -#: lib/parse.c:152 +#: lib/parse.c:150 #, c-format msgid "newline in field name `%.*s'" msgstr "" -#: lib/parse.c:155 +#: lib/parse.c:153 #, c-format msgid "MSDOS EOF (^Z) in field name `%.*s'" msgstr "" -#: lib/parse.c:158 +#: lib/parse.c:156 #, c-format msgid "field name `%.*s' must be followed by colon" msgstr "" -#: lib/parse.c:166 +#: lib/parse.c:164 #, c-format msgid "EOF before value of field `%.*s' (missing final newline)" msgstr "" -#: lib/parse.c:170 +#: lib/parse.c:168 #, c-format msgid "MSDOS EOF char in value of field `%.*s' (missing newline?)" msgstr "" -#: lib/parse.c:183 +#: lib/parse.c:181 #, c-format msgid "EOF during value of field `%.*s' (missing final newline)" msgstr "" -#: lib/parse.c:206 +#: lib/parse.c:204 #, c-format msgid "duplicate value for `%s' field" msgstr "" -#: lib/parse.c:211 +#: lib/parse.c:209 #, c-format msgid "user-defined field name `%.*s' too short" msgstr "" -#: lib/parse.c:216 +#: lib/parse.c:214 #, c-format msgid "duplicate value for user-defined field `%.*s'" msgstr "" -#: lib/parse.c:229 +#: lib/parse.c:227 msgid "several package info entries found, only one allowed" msgstr "" -#: lib/parse.c:257 +#: lib/parse.c:255 msgid "Configured-Version for package with inappropriate Status" msgstr "" -#: lib/parse.c:271 +#: lib/parse.c:269 msgid "Package which in state not-installed has conffiles, forgetting them" msgstr "" -#: lib/parse.c:326 +#: lib/parse.c:324 #, c-format msgid "failed to close after read: `%.255s'" msgstr "" -#: lib/parse.c:327 +#: lib/parse.c:325 #, c-format msgid "no package information in `%.255s'" msgstr "" @@ -1948,65 +1948,65 @@ msgstr "" msgid "unable to set execute permissions on `%.250s'" msgstr "" -#: main/help.c:293 +#: main/help.c:292 #, c-format msgid "unable to stat installed %s script `%.250s'" msgstr "" -#: main/help.c:295 main/help.c:355 main/help.c:375 +#: main/help.c:294 main/help.c:350 main/help.c:370 #, c-format msgid "unable to execute %s" msgstr "" -#: main/help.c:321 +#: main/help.c:318 #, c-format msgid "unable to stat new %s script `%.250s'" msgstr "" -#: main/help.c:323 +#: main/help.c:320 #, c-format msgid "unable to execute new %s" msgstr "" -#: main/help.c:344 +#: main/help.c:339 #, c-format msgid "old %s script" msgstr "" -#: main/help.c:352 +#: main/help.c:347 #, c-format msgid "dpkg: warning - unable to stat %s `%.250s': %s\n" msgstr "" -#: main/help.c:359 +#: main/help.c:354 msgid "dpkg - trying script from the new package instead ...\n" msgstr "" -#: main/help.c:366 +#: main/help.c:361 #, c-format msgid "new %s script" msgstr "" -#: main/help.c:370 +#: main/help.c:365 msgid "there is no script in the new version of the package - giving up" msgstr "" -#: main/help.c:372 +#: main/help.c:367 #, c-format msgid "unable to stat %s `%.250s'" msgstr "" -#: main/help.c:376 +#: main/help.c:371 msgid "dpkg: ... it looks like that went OK.\n" msgstr "" #. Huh ? -#: main/help.c:471 +#: main/help.c:466 #, c-format msgid "failed to rmdir/unlink `%.255s'" msgstr "" -#: dpkg-deb/info.c:52 main/help.c:475 +#: dpkg-deb/info.c:52 main/help.c:470 msgid "failed to exec rm for cleanup" msgstr "" @@ -2226,12 +2226,12 @@ msgstr "" msgid "couldn't open `%i' for stream" msgstr "" -#: main/main.c:456 +#: main/main.c:459 #, c-format msgid "unexpected eof before end of line %d" msgstr "" -#: dpkg-deb/main.c:155 main/main.c:495 main/main.c:539 split/main.c:163 +#: dpkg-deb/main.c:155 main/main.c:498 main/main.c:542 split/main.c:163 msgid "need an action option" msgstr ""