annotate toys/readlink.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 52a0c06b2dad
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: 223
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: 223
diff changeset
2 *
129
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * readlink.c - Return string representation of a symbolic link.
194
30a6db5a95c2 Add comments about SUSv3 specs (or lack thereof).
Rob Landley <rob@landley.net>
parents: 186
diff changeset
4 *
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
5 * Copyright 2007 Rob Landley <rob@landley.net>
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
6 *
194
30a6db5a95c2 Add comments about SUSv3 specs (or lack thereof).
Rob Landley <rob@landley.net>
parents: 186
diff changeset
7 * Not in SUSv3.
233
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
8
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
9 config READLINK
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
10 bool "readlink"
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
11 default n
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
12 help
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
13 usage: readlink
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
14
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
15 Show what a symbolic link points to.
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
16
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
17 config READLINK_F
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
18 bool "readlink -f"
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
19 default n
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
20 depends on READLINK
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
21 help
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
22 usage: readlink [-f]
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
23
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
24 -f Show full cannonical path, with no symlinks in it. Returns
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
25 nonzero if nothing could currently exist at this location.
d4176f3f3835 Zap toys/Config.in and instead create generated/Config.in from contents of
Rob Landley <rob@landley.net>
parents: 223
diff changeset
26 */
129
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
27
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
28 #include "toys.h"
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
29
186
25447caf1b4b Change command main() functions to return void, and exit(toys.exitval) from
Rob Landley <rob@landley.net>
parents: 129
diff changeset
30 void readlink_main(void)
129
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
31 {
223
52a0c06b2dad Teach readlink to actually do -f.
Rob Landley <rob@landley.net>
parents: 194
diff changeset
32 char *s;
52a0c06b2dad Teach readlink to actually do -f.
Rob Landley <rob@landley.net>
parents: 194
diff changeset
33
52a0c06b2dad Teach readlink to actually do -f.
Rob Landley <rob@landley.net>
parents: 194
diff changeset
34 // Calculating full cannonical path?
52a0c06b2dad Teach readlink to actually do -f.
Rob Landley <rob@landley.net>
parents: 194
diff changeset
35
52a0c06b2dad Teach readlink to actually do -f.
Rob Landley <rob@landley.net>
parents: 194
diff changeset
36 if (CFG_READLINK_F && toys.optflags) s = realpath(*toys.optargs, NULL);
52a0c06b2dad Teach readlink to actually do -f.
Rob Landley <rob@landley.net>
parents: 194
diff changeset
37 else s = xreadlink(*toys.optargs);
129
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
38
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
39 if (s) {
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
40 xputs(s);
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
41 if (CFG_TOYBOX_FREE) free(s);
186
25447caf1b4b Change command main() functions to return void, and exit(toys.exitval) from
Rob Landley <rob@landley.net>
parents: 129
diff changeset
42 } else toys.exitval = 1;
129
0dfead29c893 Add readlink. Why doesn't mercurial show newly added files in "hg diff"?
Rob Landley <rob@landley.net>
parents:
diff changeset
43 }