From 9f739445cd3deddd0343c3a8d5a981ede26bef30 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 16 Dec 2006 23:49:13 +0000 Subject: inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid] --- networking/ftpgetput.c | 7 +++---- networking/libiproute/ipaddress.c | 2 +- networking/tftp.c | 2 +- networking/wget.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) (limited to 'networking') diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 223d243..dff8944 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -132,7 +132,7 @@ int ftp_receive(ftp_host_info_t *server, FILE *control_stream, do_continue = 0; } - if ((local_path[0] == '-') && (local_path[1] == '\0')) { + if (LONE_DASH(local_path)) { fd_local = STDOUT_FILENO; do_continue = 0; } @@ -212,9 +212,8 @@ int ftp_send(ftp_host_info_t *server, FILE *control_stream, fd_data = xconnect_ftpdata(server, buf); /* get the local file */ - if ((local_path[0] == '-') && (local_path[1] == '\0')) { - fd_local = STDIN_FILENO; - } else { + fd_local = STDIN_FILENO; + if (NOT_LONE_DASH(local_path)) { fd_local = xopen(local_path, O_RDONLY); fstat(fd_local, &sbuf); diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index 2a267fe..9fb08e6 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c @@ -681,7 +681,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv) if (strcmp(*argv, "+") == 0) { brd_len = -1; } - else if (strcmp(*argv, "-") == 0) { + else if (LONE_DASH(*argv)) { brd_len = -2; } else { get_addr(&addr, *argv, req.ifa.ifa_family); diff --git a/networking/tftp.c b/networking/tftp.c index 64d376f..a62c5d8 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -530,7 +530,7 @@ int tftp_main(int argc, char **argv) if ((localfile == NULL && remotefile == NULL) || (argv[optind] == NULL)) bb_show_usage(); - if (localfile == NULL || strcmp(localfile, "-") == 0) { + if (localfile == NULL || LONE_DASH(localfile)) { fd = (cmd == tftp_cmd_get) ? STDOUT_FILENO : STDIN_FILENO; } else { fd = open(localfile, flags, 0644); /* fail below */ diff --git a/networking/wget.c b/networking/wget.c index 19bf8f8..fbdbf62 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -217,7 +217,7 @@ int wget_main(int argc, char **argv) /* * Determine where to start transfer. */ - if (fname_out[0] == '-' && !fname_out[1]) { + if (LONE_DASH(fname_out)) { output_fd = 1; opt &= ~WGET_OPT_CONTINUE; } -- cgit v1.1