[hackers] [sbase] Testing before rage. Suffix is fixed in basename. || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Mon, 23 Apr 2012 16:34:41 +0200 (CEST)

changeset: 111:49376e8fcecf
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Mon Apr 23 16:34:34 2012 +0200
files: basename.c
description:
Testing before rage. Suffix is fixed in basename.


diff -r 9af7eeae21d5 -r 49376e8fcecf basename.c
--- a/basename.c Mon Apr 23 16:32:41 2012 +0200
+++ b/basename.c Mon Apr 23 16:34:34 2012 +0200
_AT_@ -32,9 +32,9 @@
                 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);
Received on Mon Apr 23 2012 - 16:34:41 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 23 2012 - 16:36:10 CEST