[BACK]Return to sort.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sort

Diff for /src/usr.bin/sort/sort.c between version 1.46 and 1.47

version 1.46, 2015/03/19 13:11:05 version 1.47, 2015/03/20 00:26:38
Line 167 
Line 167 
 static void  static void
 read_fns_from_file0(const char *fn)  read_fns_from_file0(const char *fn)
 {  {
         if (fn) {          FILE *f;
                 struct file0_reader f0r;          char *line = NULL;
                 FILE *f;          size_t linesize = 0;
           ssize_t linelen;
   
                 f = fopen(fn, "r");          if (fn == NULL)
                 if (f == NULL)                  return;
                         err(2, "%s", fn);  
   
                 memset(&f0r, 0, sizeof(f0r));          f = fopen(fn, "r");
                 f0r.f = f;          if (f == NULL)
                   err(2, "%s", fn);
   
                 while (!feof(f)) {          while ((linelen = getdelim(&line, &linesize, '\0', f)) != -1) {
                         char *line = read_file0_line(&f0r);                  if (*line != '\0') {
                           if (argc_from_file0 == (size_t)-1)
                         if (line && *line) {                                  argc_from_file0 = 0;
                                 if (argc_from_file0 == (size_t)-1)                          ++argc_from_file0;
                                         argc_from_file0 = 0;                          argv_from_file0 = sort_reallocarray(argv_from_file0,
                                 ++argc_from_file0;                              argc_from_file0, sizeof(char *));
                                 argv_from_file0 = sort_reallocarray(argv_from_file0,                          argv_from_file0[argc_from_file0 - 1] = line;
                                     argc_from_file0, sizeof(char *));                  } else {
                                 argv_from_file0[argc_from_file0 - 1] =                          free(line);
                                     sort_strdup(line);  
                         }  
                 }                  }
                 closefile(f, fn);                  line = NULL;
                   linesize = 0;
         }          }
           if (ferror(f))
                   err(2, "%s: getdelim", fn);
   
           closefile(f, fn);
 }  }
   
 /*  /*

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47