Ticket #587: omindex.patch
File omindex.patch, 1.9 KB (added by , 13 years ago) |
---|
-
omindex.cc
old new 80 80 static bool follow_symlinks = false; 81 81 static bool ignore_exclusions = false; 82 82 static bool spelling = false; 83 static size_t max_size = 0; 83 84 static bool verbose = false; 84 85 static enum { 85 86 EMPTY_BODY_WARN, EMPTY_BODY_INDEX, EMPTY_BODY_SKIP … … 382 383 return; 383 384 } 384 385 386 if (max_size>0) { 387 if (d.get_size() > max_size) { 388 skip(file, "Larger than size limit", SKIP_VERBOSE_ONLY); 389 return; 390 } 391 } 392 385 393 string urlterm("U"); 386 394 urlterm += url; 387 395 … … 1030 1038 { "spelling", no_argument, NULL, 'S' }, 1031 1039 { "verbose", no_argument, NULL, 'v' }, 1032 1040 { "empty-docs", required_argument, NULL, 'e' }, 1041 { "max-size", required_argument, NULL, 'm' }, 1033 1042 { 0, 0, NULL, 0 } 1034 1043 }; 1035 1044 … … 1192 1201 1193 1202 string dbpath; 1194 1203 int getopt_ret; 1195 while ((getopt_ret = gnu_getopt_long(argc, argv, "hvd:D:U:M:F:l:s:pfSVe:i ",1204 while ((getopt_ret = gnu_getopt_long(argc, argv, "hvd:D:U:M:F:l:s:pfSVe:im:", 1196 1205 longopts, NULL)) != -1) { 1197 1206 switch (getopt_ret) { 1198 1207 case 'h': { … … 1222 1231 " -f, --follow follow symbolic links\n" 1223 1232 " -i, --ignore-exclusions ignore meta robots tags and similar exclusions\n" 1224 1233 " -S, --spelling index data for spelling correction\n" 1234 " -m, --max-size maximum size of file to index (in bytes)\n" 1225 1235 " -v, --verbose show more information about what is happening\n" 1226 1236 " --overwrite create the database anew (the default is to update\n" 1227 1237 " if the database already exists)" << endl; … … 1326 1336 case 'v': 1327 1337 verbose = true; 1328 1338 break; 1339 case 'm': { 1340 int arg = atoi(optarg); 1341 if (arg < 0) arg = 0; 1342 max_size = size_t(arg); 1343 break; 1344 } 1329 1345 case ':': // missing param 1330 1346 return 1; 1331 1347 case '?': // unknown option: FIXME -> char