From 98607d141bd8deec3cedb599277589b3d1dc6280 Mon Sep 17 00:00:00 2001 From: "Joseph C. Lehner" Date: Fri, 12 Feb 2016 14:16:55 +0100 Subject: [PATCH] nmrpd_args::filename -> file_local --- main.c | 8 ++++---- nmrp.c | 10 +++++----- nmrpd.h | 2 +- tftp.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/main.c b/main.c index 36e0e42..45b406f 100644 --- a/main.c +++ b/main.c @@ -71,7 +71,7 @@ int main(int argc, char **argv) .rx_timeout = 200, .ul_timeout = 120000, .tftpcmd = NULL, - .filename = NULL, + .file_local = NULL, .ipaddr = NULL, .ipmask = "255.255.255.0", .intf = NULL, @@ -102,7 +102,7 @@ int main(int argc, char **argv) args.tftpcmd = optarg; break; case 'f': - args.filename = optarg; + args.file_local = optarg; break; case 'i': args.intf = optarg; @@ -148,7 +148,7 @@ int main(int argc, char **argv) goto out; #ifdef NMRPFLASH_TFTP_TEST case 'U': - if (args.ipaddr && args.filename) { + if (args.ipaddr && args.file_local) { val = tftp_put(&args); goto out; } @@ -161,7 +161,7 @@ int main(int argc, char **argv) } } - if ((!args.filename && !args.tftpcmd) || !args.intf || !args.ipaddr) { + if ((!args.file_local && !args.tftpcmd) || !args.intf || !args.ipaddr) { usage(stderr); return 1; } diff --git a/nmrp.c b/nmrp.c index 947329b..e412a4f 100644 --- a/nmrp.c +++ b/nmrp.c @@ -310,8 +310,8 @@ int nmrp_do(struct nmrpd_args *args) return 1; } - if (strcmp(args->filename, "-") && access(args->filename, R_OK) == -1) { - fprintf(stderr, "Error accessing file '%s'.\n", args->filename); + if (strcmp(args->file_local, "-") && access(args->file_local, R_OK) == -1) { + fprintf(stderr, "Error accessing file '%s'.\n", args->file_local); return 1; } @@ -461,11 +461,11 @@ int nmrp_do(struct nmrpd_args *args) } } - if (!err && args->filename) { - if (!strcmp(args->filename, "-")) { + if (!err && args->file_local) { + if (!strcmp(args->file_local, "-")) { printf("Uploading from stdin ... "); } else { - printf("Uploading %s ... ", args->filename); + printf("Uploading %s ... ", args->file_local); } fflush(stdout); err = tftp_put(args); diff --git a/nmrpd.h b/nmrpd.h index ec39203..1e0997f 100644 --- a/nmrpd.h +++ b/nmrpd.h @@ -59,7 +59,7 @@ struct nmrpd_args { unsigned rx_timeout; unsigned ul_timeout; const char *tftpcmd; - const char *filename; + const char *file_local; const char *ipaddr; const char *ipmask; const char *intf; diff --git a/tftp.c b/tftp.c index cbc9eba..e18c0aa 100644 --- a/tftp.c +++ b/tftp.c @@ -234,10 +234,10 @@ int tftp_put(struct nmrpd_args *args) sock = -1; ret = -1; - if (!strcmp(args->filename, "-")) { + if (!strcmp(args->file_local, "-")) { fd = STDIN_FILENO; } else { - fd = open(args->filename, O_RDONLY); + fd = open(args->file_local, O_RDONLY); if (fd < 0) { perror("open"); ret = fd; @@ -267,7 +267,7 @@ int tftp_put(struct nmrpd_args *args) /* Not really, but this way the loop sends our WRQ before receiving */ timeout = 1; - pkt_mkwrq(tx, args->filename); + pkt_mkwrq(tx, args->file_local); do { if (!timeout && pkt_num(rx) == ACK) {