Magellan Linux

Annotation of /trunk/mkinitrd-magellan/busybox/coreutils/realpath.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1123 - (hide annotations) (download)
Wed Aug 18 21:56:57 2010 UTC (13 years, 9 months ago) by niro
File MIME type: text/plain
File size: 832 byte(s)
-updated to busybox-1.17.1
1 niro 532 /* 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 cannot be resolved.
9     *
10     * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
11     */
12    
13 niro 816 #include "libbb.h"
14 niro 532
15 niro 816 int realpath_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16     int realpath_main(int argc UNUSED_PARAM, char **argv)
17 niro 532 {
18     int retval = EXIT_SUCCESS;
19    
20 niro 816 if (!*++argv) {
21 niro 532 bb_show_usage();
22     }
23    
24     do {
25 niro 1123 char *resolved_path = xmalloc_realpath(*argv);
26     if (resolved_path != NULL) {
27 niro 532 puts(resolved_path);
28 niro 1123 free(resolved_path);
29 niro 532 } else {
30     retval = EXIT_FAILURE;
31 niro 816 bb_simple_perror_msg(*argv);
32 niro 532 }
33 niro 816 } while (*++argv);
34 niro 532
35     fflush_stdout_and_exit(retval);
36     }