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

Diff of /global/global/global.c

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

revision 1.95 by h-iwamoto, Sun Jun 26 04:57:30 2005 UTC revision 1.96 by h-iwamoto, Mon Jun 27 13:04:38 2005 UTC
# Line 48  Line 48 
48  #include "regex.h"  #include "regex.h"
49  #include "const.h"  #include "const.h"
50    
51    #if !defined(ARG_MAX) && defined(_SC_ARG_MAX)
52    #define ARG_MAX         sysconf(_SC_ARG_MAX)
53    #endif
54    
55  static void usage(void);  static void usage(void);
56  static void help(void);  static void help(void);
57  static void setcom(int);  static void setcom(int);
# Line 911  parsefile(argc, argv, cwd, root, dbpath, Line 915  parsefile(argc, argv, cwd, root, dbpath,
915          STRBUF *sb = strbuf_open(0);          STRBUF *sb = strbuf_open(0);
916          STRBUF *path_list = strbuf_open(MAXPATHLEN);          STRBUF *path_list = strbuf_open(MAXPATHLEN);
917          int path_list_max;          int path_list_max;
         int force_processing_one_file;  
918    
919          /*          /*
920           * teach parser where is dbpath.           * teach parser where is dbpath.
# Line 928  parsefile(argc, argv, cwd, root, dbpath, Line 931  parsefile(argc, argv, cwd, root, dbpath,
931          /*          /*
932           * determine the maximum length of the list of paths.           * determine the maximum length of the list of paths.
933           */           */
 #if !defined(ARG_MAX) && defined(_SC_ARG_MAX)  
 #define ARG_MAX         sysconf(_SC_ARG_MAX)  
 #endif  
934  #ifdef ARG_MAX  #ifdef ARG_MAX
935          path_list_max = ARG_MAX;          path_list_max = ARG_MAX;
936          path_list_max -= 2048;          path_list_max -= 2048;
# Line 939  parsefile(argc, argv, cwd, root, dbpath, Line 939  parsefile(argc, argv, cwd, root, dbpath,
939          path_list_max -= env_size();          path_list_max -= env_size();
940          path_list_max -= strbuf_getlen(sb);          path_list_max -= strbuf_getlen(sb);
941          path_list_max -= 40;          path_list_max -= 40;
942          force_processing_one_file = (path_list_max <= 0);          if (path_list_max < 0)
943                    path_list_max = 0;
944  #else  #else
945          path_list_max = 0;          path_list_max = 0;
         force_processing_one_file = 1;  
946  #endif  #endif
947    
948          if (!(op = openfilter()))          if (!(op = openfilter()))
# Line 983  parsefile(argc, argv, cwd, root, dbpath, Line 983  parsefile(argc, argv, cwd, root, dbpath,
983                          continue;                          continue;
984                  }                  }
985    
986                  if (force_processing_one_file) {                  if (strbuf_getlen(path_list)
987                          count += exec_parser(parser, path, cwd, root, op);                      && strbuf_getlen(path_list) + 1 + strlen(path) > path_list_max) {
                         continue;  
                 }  
   
                 if (strbuf_getlen(path_list) + 1 + strlen(path) > path_list_max) {  
988                          count += exec_parser(parser, strbuf_value(path_list),                          count += exec_parser(parser, strbuf_value(path_list),
989                                          cwd, root, op);                                          cwd, root, op);
990                          strbuf_reset(path_list);                          strbuf_reset(path_list);

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.96

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