Last change
on this file since 3691 was 3232, checked in by Bruno Cornec, 11 years ago |
- Update mindi-busybox to 1.21.1
|
File size:
993 bytes
|
Rev | Line | |
---|
[821] | 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
|
---|
[1765] | 8 | * if one or more paths cannot be resolved.
|
---|
[821] | 9 | *
|
---|
[2725] | 10 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
[821] | 11 | */
|
---|
| 12 |
|
---|
[3232] | 13 | //usage:#define realpath_trivial_usage
|
---|
| 14 | //usage: "FILE..."
|
---|
| 15 | //usage:#define realpath_full_usage "\n\n"
|
---|
| 16 | //usage: "Return the absolute pathnames of given FILE"
|
---|
| 17 |
|
---|
[1765] | 18 | #include "libbb.h"
|
---|
[821] | 19 |
|
---|
[2725] | 20 | int realpath_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
| 21 | int realpath_main(int argc UNUSED_PARAM, char **argv)
|
---|
[821] | 22 | {
|
---|
| 23 | int retval = EXIT_SUCCESS;
|
---|
| 24 |
|
---|
[2725] | 25 | if (!*++argv) {
|
---|
[821] | 26 | bb_show_usage();
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | do {
|
---|
[2725] | 30 | char *resolved_path = xmalloc_realpath(*argv);
|
---|
| 31 | if (resolved_path != NULL) {
|
---|
[821] | 32 | puts(resolved_path);
|
---|
[2725] | 33 | free(resolved_path);
|
---|
[821] | 34 | } else {
|
---|
| 35 | retval = EXIT_FAILURE;
|
---|
[2725] | 36 | bb_simple_perror_msg(*argv);
|
---|
[821] | 37 | }
|
---|
[2725] | 38 | } while (*++argv);
|
---|
[821] | 39 |
|
---|
[1765] | 40 | fflush_stdout_and_exit(retval);
|
---|
[821] | 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.