/[global]/global/libutil/find.c
ViewVC logotype

Diff of /global/libutil/find.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.48 by shigio, Wed Aug 24 05:44:51 2005 UTC revision 1.49 by shigio, Sat Aug 27 14:32:39 2005 UTC
# Line 78  static STRBUF *list; Line 78  static STRBUF *list;
78  static int list_count;  static int list_count;
79  static char **listarray;                /* list for skipping full path */  static char **listarray;                /* list for skipping full path */
80  static FILE *ip;  static FILE *ip;
81    static FILE *temp;
82  static STRBUF *ib;  static STRBUF *ib;
83  static char root[MAXPATHLEN + 1];  static char root[MAXPATHLEN + 1];
84  static size_t rootlen;  static size_t rootlen;
# Line 444  find_open_filelist(filename, rootdir) Line 445  find_open_filelist(filename, rootdir)
445          assert(opened == 0);          assert(opened == 0);
446          opened = FILELIST_OPEN;          opened = FILELIST_OPEN;
447          ib = strbuf_open(MAXBUFLEN);          ib = strbuf_open(MAXBUFLEN);
448          if (filename[0] == '-' && filename[1] == '\0') {  
449                  ip = stdin;          if (!strcmp(filename, "-")) {
450                    /*
451                     * If the filename is '-', copy standard input onto
452                     * temporary file to be able to read repeatedly.
453                     */
454                    if (temp == NULL) {
455                            char buf[MAXPATHLEN+1];
456    
457                            temp = tmpfile();
458                            while (fgets(buf, sizeof(buf), stdin) != NULL)
459                                    fputs(buf, temp);
460                    }
461                    rewind(temp);
462                    ip = temp;
463          } else {          } else {
464                  if (test("d", filename))                  if (test("d", filename))
465                          die("'%s' is a directory.", filename);                          die("'%s' is a directory.", filename);
# Line 459  find_open_filelist(filename, rootdir) Line 473  find_open_filelist(filename, rootdir)
473          }          }
474          strlimcpy(root, rootdir, sizeof(root));          strlimcpy(root, rootdir, sizeof(root));
475          rootlen = strlen(root);          rootlen = strlen(root);
476    
477            /*
478             * prepare regular expressions.
479             */
480          prepare_skip();          prepare_skip();
481          prepare_source();          prepare_source();
482  }  }

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26