| # | Line 437 | Line 437 | int pred; | |
|---|---|---|
| 437 | register int n; | |
| 438 | int suffix; | |
| 439 | ||
| 440 | < | suffix = n = strlen(orig); /* find start of suffix */ |
| 441 | < | if ((cp = rindex(orig, '.')) != NULL) |
| 442 | < | suffix = cp - orig; |
| 440 | > | n = 0; cp = orig; suffix = -1; /* suffix position, length */ |
| 441 | > | while (*cp) { |
| 442 | > | if (*cp == '.') suffix = n; |
| 443 | > | else if (ISDIRSEP(*cp)) suffix = -1; |
| 444 | > | cp++; n++; |
| 445 | > | } |
| 446 | > | if (suffix == -1) suffix = n; |
| 447 | if ((cp = bmalloc(n+2)) == NULL) | |
| 448 | syserr(progname); | |
| 449 | strncpy(cp, orig, suffix); | |
| – | Removed lines |
| + | Added lines |
| < | Changed lines (old) |
| > | Changed lines (new) |