ccanlint: fix trailing / in -d.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 17 Jan 2011 05:49:13 +0000 (16:19 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 17 Jan 2011 05:49:13 +0000 (16:19 +1030)
Before:
$ tools/ccanlint/ccanlint -d ccan/talloc/
Module's source code has no trailing whitespace (no_trailing_whitespace): FAIL
: Total score: 0/1

After:
$ tools/ccanlint/ccanlint -d ccan/talloc/
Module's source code has no trailing whitespace (no_trailing_whitespace): FAIL
talloc: Total score: 0/1

tools/ccanlint/ccanlint.c

index 1b11803c220e7e38b5537cb3c4a065aecdfafbc0..8acad9329e4c7280d0fef58eb8b833cf9ca7cd72 100644 (file)
@@ -499,6 +499,8 @@ int main(int argc, char *argv[])
 
        if (dir[0] != '/')
                dir = talloc_asprintf_append(NULL, "%s/%s", base_dir, dir);
+       while (strends(dir, "/"))
+               dir[strlen(dir)-1] = '\0';
        if (dir != base_dir)
                prefix = talloc_append_string(talloc_basename(NULL, dir), ": ");
        if (verbose >= 3)