diff options
author | Rob Landley <rob@landley.net> | 2005-09-17 15:13:25 +0400 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2005-09-17 15:13:25 +0400 |
commit | 07e42dc05612653f83d31fcea325afbe38182c1f (patch) | |
tree | 6c324c359a322a942ef46b1e4f1394520e805c0a /debianutils/readlink.c | |
parent | a882126feeebb2616910a43ed388a402277434f8 (diff) |
Tito pointed out that if readlink doesn't have -f, there's no need to call
the option parsing code at all.
Diffstat (limited to 'debianutils/readlink.c')
-rw-r--r-- | debianutils/readlink.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/debianutils/readlink.c b/debianutils/readlink.c index 3042b83ec..83abdbfa6 100644 --- a/debianutils/readlink.c +++ b/debianutils/readlink.c @@ -18,16 +18,16 @@ int readlink_main(int argc, char **argv) { char *buf; - unsigned long opt = bb_getopt_ulflags(argc, argv, - ENABLE_FEATURE_READLINK_FOLLOW ? "f" : ""); + unsigned long opt = ENABLE_FEATURE_READLINK_FOLLOW ? + bb_getopt_ulflags(argc, argv, "f") : 0; - if (optind + 1 != argc) - bb_show_usage(); + if (argc != (ENABLE_FEATURE_READLINK_FOLLOW ? optind + 1 : 2)) + bb_show_usage(); - if (ENABLE_FEATURE_READLINK_FOLLOW && (opt & READLINK_FLAG_f)) + if (opt & READLINK_FLAG_f) buf = realpath(argv[optind], NULL); else - buf = xreadlink(argv[optind]); + buf = xreadlink(argv[ENABLE_FEATURE_READLINK_FOLLOW ? optind : 1]); if (!buf) return EXIT_FAILURE; |