annotate toys/dirname.c @ 562:4d802d438983

Match uint64_t with PRIu64 to avoid warnings on 64 bit builds.
author Rob Landley <rob@landley.net>
date Sat, 14 Apr 2012 21:27:00 -0500
parents 31215cc6c9f2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
387
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 /* vi: set sw=4 ts=4:
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 * dirname.c - show directory portion of path
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 * Copyright 2011 Rob Landley <rob@landley.net>
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 * 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
8
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 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
10
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 config DIRNAME
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 bool "dirname"
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 default y
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 help
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 usage: dirname PATH
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 Show directory portion of path.
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 */
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 #include "toys.h"
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
21
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 void dirname_main(void)
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 {
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 puts(dirname(*toys.optargs));
67b0ded3c56c Add dirname, and typo fixes to wc header.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 }