]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(process_input): Continue processing if a duplicate key is
authorUlrich Drepper <drepper@redhat.com>
Fri, 30 Jan 1998 16:53:36 +0000 (16:53 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 30 Jan 1998 16:53:36 +0000 (16:53 +0000)
encountered.

db/makedb.c

index 7ce95487888184ed07eeef8a71b1618e16916fa0..87c1cc9de17190fb52f5f069dcbb218609c1d976 100644 (file)
@@ -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);