FreeBSD Bugzilla – Attachment 11049 Details for
Bug 21918
Revision 1.5 provides incomplete fix for 1.4 breakage by DES
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.08 KB, created by
ak03
on 2000-10-11 20:50:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
ak03
Created:
2000-10-11 20:50:01 UTC
Size:
1.08 KB
patch
obsolete
>Index: basename.c >=================================================================== >RCS file: /usr/ncvs/src/usr.bin/basename/basename.c,v >retrieving revision 1.5 >diff -u -r1.5 basename.c >--- basename.c 2000/09/06 07:28:02 1.5 >+++ basename.c 2000/10/11 19:00:43 >@@ -56,7 +56,7 @@ > int argc; > char **argv; > { >- char *p, *q; >+ char *p; > int ch; > > while ((ch = getopt(argc, argv, "")) != -1) >@@ -73,8 +73,25 @@ > > if ((p = basename(argv[0])) == NULL) > err(1, "%s", argv[0]); >- if (*++argv && (q = strstr(p, *argv)) && strcmp(q, *argv) == 0) >- *q = '\0'; >+ >+ /* >+ * If the suffix operand is present, is not identical to the >+ * characters remaining in string, and is identical to a suffix >+ * of the characters remaining in string, the suffix >+ * shall be removed from string. >+ */ >+ if (*++argv) { >+ int suffixlen, stringlen, off; >+ >+ suffixlen = strlen(*argv); >+ stringlen = strlen(p); >+ >+ if (suffixlen < stringlen) { >+ off = stringlen - suffixlen; >+ if (!strcmp(p + off, *argv)) >+ p[off] = '\0'; >+ } >+ } > (void)printf("%s\n", p); > exit(0); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 21918
: 11049