]> Dogcows Code - chaz/tar/blobdiff - src/names.c
Minor change.
[chaz/tar] / src / names.c
index 3704a919cecd7e59b73ec81febaa718332e6404b..e3fbf7b7027044967e9307ff01208fdab14e8117 100644 (file)
@@ -291,6 +291,7 @@ name_add_file (const char *name, int term)
   ep->type = NELT_FILE;
   ep->v.file.name = name;
   ep->v.file.term = term;
+  ep->v.file.fp = NULL;
 }
 \f
 /* Names from external name file.  */
@@ -363,11 +364,10 @@ read_name_from_file (struct name_elt *ent)
   size_t counter = 0;
   FILE *fp = ent->v.file.fp;
   int term = ent->v.file.term;
-  size_t count;
   
   for (c = getc (fp); c != EOF && c != term; c = getc (fp))
     {
-      if (count == name_buffer_length)
+      if (counter == name_buffer_length)
        name_buffer = x2realloc (name_buffer, &name_buffer_length);
       name_buffer[counter++] = c;
       if (c == 0)
@@ -381,7 +381,7 @@ read_name_from_file (struct name_elt *ent)
   if (counter == 0 && c != EOF)
     return file_list_skip;
 
-  if (count == name_buffer_length)
+  if (counter == name_buffer_length)
     name_buffer = x2realloc (name_buffer, &name_buffer_length);
   name_buffer[counter] = 0;
 
@@ -403,7 +403,7 @@ handle_option (const char *str)
   if (wordsplit (str, &ws, WRDSF_DEFFLAGS|WRDSF_DOOFFS))
     FATAL_ERROR ((0, 0, _("cannot split string '%s': %s"),
                  str, wordsplit_strerror (&ws)));
-  ws.ws_wordv[0] = "tar";
+  ws.ws_wordv[0] = program_invocation_short_name;
   more_options (ws.ws_wordc+ws.ws_offs, ws.ws_wordv);
   for (i = 0; i < ws.ws_wordc+ws.ws_offs; i++)
     ws.ws_wordv[i] = NULL;
@@ -415,8 +415,6 @@ handle_option (const char *str)
 static int
 read_next_name (struct name_elt *ent, struct name_elt *ret)
 {
-  enum read_file_list_state read_state;
-
   if (!ent->v.file.fp)
     {
       if (!strcmp (ent->v.file.name, "-"))
@@ -512,15 +510,14 @@ name_next_elt (int change_dirs)
       struct name_elt *ep;
 
       ep = &name_array[scanned];
-      if (ep->type == NELT_FMASK)
+
+      switch (ep->type)
        {
+       case NELT_FMASK:
          matching_flags = ep->v.matching_flags;
          ++scanned;
          continue;
-       }
-
-      switch (ep->type)
-       {
+         
        case NELT_FILE:
          if (read_next_name (ep, &entry) == 0)
            return &entry;
This page took 0.02727 seconds and 4 git commands to generate.