Last change
on this file since 904 was 821, checked in by Bruno Cornec, 19 years ago |
Addition of busybox 1.2.1 as a mindi-busybox new package
This should avoid delivering binary files in mindi not built there (Fedora and Debian are quite serious about that)
|
File size:
1.0 KB
|
Line | |
---|
1 | /* vi: set sw=4 ts=4: */
|
---|
2 |
|
---|
3 | /* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
|
---|
4 |
|
---|
5 | /* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
---|
6 | *
|
---|
7 | * Now does proper error checking on output and returns a failure exit code
|
---|
8 | * if one or more paths can not be resolved.
|
---|
9 | *
|
---|
10 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
---|
11 | */
|
---|
12 |
|
---|
13 | #include <limits.h>
|
---|
14 | #include <stdlib.h>
|
---|
15 | #include "busybox.h"
|
---|
16 |
|
---|
17 | int realpath_main(int argc, char **argv)
|
---|
18 | {
|
---|
19 | int retval = EXIT_SUCCESS;
|
---|
20 |
|
---|
21 | #if PATH_MAX > (BUFSIZ+1)
|
---|
22 | RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX);
|
---|
23 | # define resolved_path_MUST_FREE 1
|
---|
24 | #else
|
---|
25 | #define resolved_path bb_common_bufsiz1
|
---|
26 | # define resolved_path_MUST_FREE 0
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | if (--argc == 0) {
|
---|
30 | bb_show_usage();
|
---|
31 | }
|
---|
32 |
|
---|
33 | do {
|
---|
34 | argv++;
|
---|
35 | if (realpath(*argv, resolved_path) != NULL) {
|
---|
36 | puts(resolved_path);
|
---|
37 | } else {
|
---|
38 | retval = EXIT_FAILURE;
|
---|
39 | bb_perror_msg("%s", *argv);
|
---|
40 | }
|
---|
41 | } while (--argc);
|
---|
42 |
|
---|
43 | #if ENABLE_FEATURE_CLEAN_UP && resolved_path_MUST_FREE
|
---|
44 | RELEASE_CONFIG_BUFFER(resolved_path);
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | bb_fflush_stdout_and_exit(retval);
|
---|
48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.