SUSv2 specifies that if the extension is identical to the basename, it
should not be removed.
This commit is contained in:
parent
dcbca62e89
commit
5171bf6d40
@ -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);
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user