source: MondoRescue/branches/2.2.9/mindi-busybox/coreutils/realpath.c@ 2725

Last change on this file since 2725 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File size: 824 bytes
RevLine 
[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
[1765]13#include "libbb.h"
[821]14
[2725]15int realpath_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int realpath_main(int argc UNUSED_PARAM, char **argv)
[821]17{
18 int retval = EXIT_SUCCESS;
19
[2725]20 if (!*++argv) {
[821]21 bb_show_usage();
22 }
23
24 do {
[2725]25 char *resolved_path = xmalloc_realpath(*argv);
26 if (resolved_path != NULL) {
[821]27 puts(resolved_path);
[2725]28 free(resolved_path);
[821]29 } else {
30 retval = EXIT_FAILURE;
[2725]31 bb_simple_perror_msg(*argv);
[821]32 }
[2725]33 } while (*++argv);
[821]34
[1765]35 fflush_stdout_and_exit(retval);
[821]36}
Note: See TracBrowser for help on using the repository browser.