"C:\\> nmrpflash.exe -i net0 -f firmware.bin\n"
#endif
"\n"
- "When using -c, the environment variables IP, NETMASK and MAC are\n"
- "set to the device IP address, subnet mask and MAC address.\n"
+ "When using -c, the environment variables IP, PORT, NETMASK\n"
+ "and MAC are set to the device IP address, TFTP port, subnet\n"
+ "mask and MAC address, respectively.\n"
"\n"
"nmrpflash %s, Copyright (C) 2016 Joseph C. Lehner\n"
"nmrpflash is free software, licensed under the GNU GPLv3.\n"
if (args->tftpcmd) {
printf("Executing '%s' ... \n", args->tftpcmd);
setenv("IP", inet_ntoa(ipconf.addr), 1);
+ setenv("PORT", lltostr(args->port, 10), 1);
setenv("MAC", mac_to_str(rx.eh.ether_shost), 1);
setenv("NETMASK", inet_ntoa(ipconf.mask), 1);
+ //setenv("FILENAME", args->file_remote ? args->file_remote : "", 1);
status = system(args->tftpcmd);
}
int ethsock_ip_del(struct ethsock *sock, struct ethsock_ip_undo **undo);
time_t time_monotonic();
+char *lltostr(long long ll, int base);
#endif
+#include <stdio.h>
#include <time.h>
#include <math.h>
#include "nmrpd.h"
return round(GetTickCount() / 1000.0);
#endif
}
+
+char *lltostr(long long ll, int base)
+{
+ static char buf[32];
+ snprintf(buf, sizeof(buf) - 1, (base == 16 ? "%llx" : (base == 8 ? "%llo" : "%lld")), ll);
+ return buf;
+}