mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-06 14:10:30 +08:00
(process_input): Continue processing if a duplicate key is
encountered.
This commit is contained in:
parent
1f49584358
commit
4809e16cf0
13
db/makedb.c
13
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 <drepper@cygnus.com>, 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user