.rx_timeout = 200,
.ul_timeout = 120000,
.tftpcmd = NULL,
- .filename = NULL,
+ .file_local = NULL,
.ipaddr = NULL,
.ipmask = "255.255.255.0",
.intf = NULL,
args.tftpcmd = optarg;
break;
case 'f':
- args.filename = optarg;
+ args.file_local = optarg;
break;
case 'i':
args.intf = optarg;
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;
}
}
}
- if ((!args.filename && !args.tftpcmd) || !args.intf || !args.ipaddr) {
+ if ((!args.file_local && !args.tftpcmd) || !args.intf || !args.ipaddr) {
usage(stderr);
return 1;
}
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;
}
}
}
- 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);
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;
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;
/* 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) {