… | |
… | |
51 | #include <uudeview.h> |
51 | #include <uudeview.h> |
52 | #include <uuint.h> |
52 | #include <uuint.h> |
53 | #include <fptools.h> |
53 | #include <fptools.h> |
54 | #include <uustring.h> |
54 | #include <uustring.h> |
55 | |
55 | |
56 | char * uucheck_id = "$Id: uucheck.c,v 1.6 2002/03/31 21:42:37 root Exp $"; |
56 | char * uucheck_id = "$Id: uucheck.c,v 1.7 2003/07/28 15:47:54 root Exp $"; |
57 | |
57 | |
58 | /* |
58 | /* |
59 | * Arbitrary number. This is the maximum number of part numbers we |
59 | * Arbitrary number. This is the maximum number of part numbers we |
60 | * store for our have-parts and missing-parts lists |
60 | * store for our have-parts and missing-parts lists |
61 | */ |
61 | */ |
… | |
… | |
405 | return -2; |
405 | return -2; |
406 | |
406 | |
407 | /* |
407 | /* |
408 | * First try numbers in () or [] (or vice versa, according to bracket |
408 | * First try numbers in () or [] (or vice versa, according to bracket |
409 | * policy) |
409 | * policy) |
|
|
410 | * For multiple occurences, give priority to the bracket with a slash |
|
|
411 | * or the last one, whichever is "found" first. |
410 | */ |
412 | */ |
411 | |
413 | |
412 | for (bpc=0, length=0; brackchr[uu_bracket_policy][bpc]; bpc+=2) { |
414 | for (bpc=0, length=0; brackchr[uu_bracket_policy][bpc]; bpc+=2) { |
413 | ptr = subject; |
415 | iter = subject; |
|
|
416 | length = 0; |
414 | while ((iter = strchr (ptr, brackchr[uu_bracket_policy][bpc])) != NULL) { |
417 | while ((iter = strchr (iter, brackchr[uu_bracket_policy][bpc])) != NULL) { |
|
|
418 | int plength; |
|
|
419 | |
415 | count = length = 0; iter++; |
420 | count = 0; iter++; |
416 | |
421 | |
417 | while (*iter == ' ' || *iter == '#') |
422 | while (*iter == ' ' || *iter == '#') |
418 | iter++; |
423 | iter++; |
419 | |
424 | |
420 | if (!isdigit (*iter)) { |
425 | if (!isdigit (*iter)) { |
421 | ptr = iter; |
|
|
422 | continue; |
426 | continue; |
423 | } |
427 | } |
424 | while (isdigit (iter[count])) |
428 | while (isdigit (iter[count])) |
425 | count++; |
429 | count++; |
426 | length = count; |
|
|
427 | |
430 | |
428 | if (iter[count] == '\0' || iter[count+1] == '\0') { |
431 | if (iter[count] == '\0') { |
429 | iter += count; |
432 | iter += count; |
430 | length = 0; |
|
|
431 | break; |
433 | break; |
432 | } |
434 | } |
|
|
435 | |
|
|
436 | plength = count; |
|
|
437 | |
433 | if (iter[count] == brackchr[uu_bracket_policy][bpc+1]) { |
438 | if (iter[count] == brackchr[uu_bracket_policy][bpc+1]) { |
434 | *where = iter; |
439 | *where = iter; |
435 | bdel[0] = brackchr[uu_bracket_policy][bpc+1]; |
440 | bdel[0] = brackchr[uu_bracket_policy][bpc+1]; |
436 | delim = bdel; |
441 | delim = bdel; |
437 | break; |
442 | length = plength; |
438 | } |
443 | continue; |
439 | |
444 | } |
|
|
445 | |
440 | while (iter[count] == ' ' || iter[count] == '#' || |
446 | while (iter[count] == ' ' || iter[count] == '#' || |
441 | iter[count] == '/' || iter[count] == '\\') count++; |
447 | iter[count] == '/' || iter[count] == '\\') count++; |
442 | |
448 | |
443 | if (_FP_strnicmp (iter + count, "of", 2) == 0) |
449 | if (_FP_strnicmp (iter + count, "of", 2) == 0) |
444 | count += 2; |
450 | count += 2; |
… | |
… | |
449 | |
455 | |
450 | if (iter[count] == brackchr[uu_bracket_policy][bpc+1]) { |
456 | if (iter[count] == brackchr[uu_bracket_policy][bpc+1]) { |
451 | *where = iter; |
457 | *where = iter; |
452 | bdel[0] = brackchr[uu_bracket_policy][bpc+1]; |
458 | bdel[0] = brackchr[uu_bracket_policy][bpc+1]; |
453 | delim = bdel; |
459 | delim = bdel; |
|
|
460 | length = plength; |
454 | break; |
461 | break; |
455 | } |
462 | } |
456 | |
|
|
457 | length = 0; |
|
|
458 | ptr = iter; |
|
|
459 | } |
463 | } |
460 | if (length) |
464 | if (length) |
|
|
465 | { |
|
|
466 | iter = *where; /* strange control flow, but less changes == less hassle */ |
461 | break; |
467 | break; |
|
|
468 | } |
462 | } |
469 | } |
463 | |
470 | |
464 | /* |
471 | /* |
465 | * look for the string "part " followed by a number |
472 | * look for the string "part " followed by a number |
466 | */ |
473 | */ |