commit 3863ccdf98c8a4b26748ab23d71f8a2576ae6672 parent 3817f78f8781c184441fb17066bd87bde145fd1f Author: Christoph Lohmann <20h@r-36.net> Date: Mon, 23 Apr 2012 16:34:34 +0200 Testing before rage. Suffix is fixed in basename. Diffstat:
M | basename.c | | | 6 | +++--- |
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/basename.c b/basename.c @@ -32,9 +32,9 @@ main(int argc, char *argv[]) usage(); s = basename(argv[0]); - if (suffix) { - n = strlen(s) - strlen(suffix); - if (!strcmp(&s[n], suffix)) + if (argc == 2 && argv[1]) { + n = strlen(s) - strlen(argv[1]); + if (!strcmp(&s[n], argv[1])) s[n] = '\0'; } puts(s);