Mercurial > hg > toybox
annotate toys/posix/dirname.c @ 841:cb0c3a773437
Kyungwan Han submitted ifconfig.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 02 Apr 2013 01:58:18 -0500 |
parents | 786841fdb1e0 |
children | aafd2f28245a |
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 } |