annotate toys/dirname.c @ 233:d4176f3f3835

Zap toys/Config.in and instead create generated/Config.in from contents of toys/*.c. Move relevant info into comment at the top of each toys/*.c. Also convert more of Makefile into a thin wrapper around shell scripts that actually do the work. (Makefile is only still there for the user interface.)
author Rob Landley <rob@landley.net>
date Sat, 19 Jan 2008 17:08:39 -0600
parents 25447caf1b4b
children 163498bf547b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
1 /* vi: set sw=4 ts=4:
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
2 *
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
3 * dirname.c - print directory portion of path, or "." if none.
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
4 *
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
5 * Copyright 2007 Charlie Shephard <masterdriverz@gentoo.org>
178
0e94f5f14f08 Add comment and very minor tweak.
Rob Landley <rob@landley.net>
parents: 176
diff changeset
6 *
0e94f5f14f08 Add comment and very minor tweak.
Rob Landley <rob@landley.net>
parents: 176
diff changeset
7 * See http://www.opengroup.org/onlinepubs/009695399/utilities/dirname.html
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
8
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
9 config DIRNAME
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
10 bool "dirname"
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
11 default y
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
12 help
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
13 usage: dirname path
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
14
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
15 Print the part of path up to the last slash.
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 186
diff changeset
16 */
178
0e94f5f14f08 Add comment and very minor tweak.
Rob Landley <rob@landley.net>
parents: 176
diff changeset
17
176
07533cabeede Patch from Charlie Shepherd to add basename and dirname. (Fixed up to apply.)
Rob Landley <rob@landley.net>
parents:
diff changeset
18 #include "toys.h"
07533cabeede Patch from Charlie Shepherd to add basename and dirname. (Fixed up to apply.)
Rob Landley <rob@landley.net>
parents:
diff changeset
19 #include <libgen.h>
07533cabeede Patch from Charlie Shepherd to add basename and dirname. (Fixed up to apply.)
Rob Landley <rob@landley.net>
parents:
diff changeset
20
186
25447caf1b4b Change command main() functions to return void, and exit(toys.exitval) from
Rob Landley <rob@landley.net>
parents: 178
diff changeset
21 void dirname_main(void)
176
07533cabeede Patch from Charlie Shepherd to add basename and dirname. (Fixed up to apply.)
Rob Landley <rob@landley.net>
parents:
diff changeset
22 {
178
0e94f5f14f08 Add comment and very minor tweak.
Rob Landley <rob@landley.net>
parents: 176
diff changeset
23 puts(dirname(*toys.optargs));
176
07533cabeede Patch from Charlie Shepherd to add basename and dirname. (Fixed up to apply.)
Rob Landley <rob@landley.net>
parents:
diff changeset
24 }