annotate toys/posix/dirname.c @ 694:786841fdb1e0

Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring.
author Rob Landley <rob@landley.net>
date Tue, 13 Nov 2012 17:14:08 -0600
parents 2986aa63a021
children aafd2f28245a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
1 /* dirname.c - show directory portion of path
387
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 *
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * Copyright 2011 Rob Landley <rob@landley.net>
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 *
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 * See http://opengroup.org/onlinepubs/9699919799/utilities/dirname.html
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 USE_DIRNAME(NEWTOY(dirname, "<1", TOYFLAG_USR|TOYFLAG_BIN))
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 config DIRNAME
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
10 bool "dirname"
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
11 default y
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
12 help
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
13 usage: dirname PATH
387
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
14
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
15 Show directory portion of path.
387
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 */
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
17
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 #include "toys.h"
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
19
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 void dirname_main(void)
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 {
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 653
diff changeset
22 puts(dirname(*toys.optargs));
387
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 }