SUSv2 specifies that if the extension is identical to the basename, it

should not be removed.
This commit is contained in:
Matt Kraai 2001-08-29 20:19:29 +00:00
parent dcbca62e89
commit 5171bf6d40
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ extern int basename_main(int argc, char **argv)
argv++; argv++;
n = strlen(*argv); n = strlen(*argv);
m = strlen(s); m = strlen(s);
if (m>=n && strncmp(s+m-n, *argv, n)==0) if (m>n && strncmp(s+m-n, *argv, n)==0)
s[m-n] = '\0'; s[m-n] = '\0';
} }
puts(s); puts(s);

View File

@ -44,7 +44,7 @@ extern int basename_main(int argc, char **argv)
argv++; argv++;
n = strlen(*argv); n = strlen(*argv);
m = strlen(s); m = strlen(s);
if (m>=n && strncmp(s+m-n, *argv, n)==0) if (m>n && strncmp(s+m-n, *argv, n)==0)
s[m-n] = '\0'; s[m-n] = '\0';
} }
puts(s); puts(s);