From: Ulrich Drepper Date: Fri, 30 Jan 1998 16:53:36 +0000 (+0000) Subject: (process_input): Continue processing if a duplicate key is X-Git-Tag: cvs/before-sparc-2_0_x-branch~270 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4809e16cf057604ff4fd3f4af868f5c29066c629;p=thirdparty%2Fglibc.git (process_input): Continue processing if a duplicate key is encountered. --- diff --git a/db/makedb.c b/db/makedb.c index 7ce95487888..87c1cc9de17 100644 --- a/db/makedb.c +++ b/db/makedb.c @@ -1,5 +1,5 @@ /* makedb -- create simple DB database from textual input. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -298,7 +298,7 @@ process_input (input, inname, output, to_lowercase, be_quiet) ++cp; val.data = cp; - val.size = &line[n] - cp; + val.size = (&line[n] - cp) + 1; /* Store the value. */ status = output->put (output, &key, &val, R_NOOVERWRITE); @@ -311,11 +311,12 @@ process_input (input, inname, output, to_lowercase, be_quiet) gettext ("duplicate key")); /* This is no real error. Just give a warning. */ status = 0; + continue; } else - error (0, errno, gettext ("while writing data base file")); + error (0, errno, gettext ("while writing database file")); - status = status ? EXIT_FAILURE : EXIT_SUCCESS; + status = EXIT_FAILURE; clearerr (input); break; @@ -324,7 +325,7 @@ process_input (input, inname, output, to_lowercase, be_quiet) if (ferror (input)) { - error (0, 0, gettext ("problems while reading `%s'")); + error (0, 0, gettext ("problems while reading `%s'"), inname); status = EXIT_FAILURE; } @@ -343,7 +344,7 @@ print_database (db) no_more = db->seq (db, &key, &val, R_FIRST); while (!no_more) { - printf ("%.*s %.*s\n", (int) key.size, (char *) key.data, (int) val.size, + printf ("%.*s %s\n", (int) key.size, (char *) key.data, (char *) val.data); no_more = db->seq (db, &key, &val, R_NEXT);