if (!strcmp(args->file_local, "-")) {
printf("Uploading from stdin ... ");
} else {
- printf("Uploading %s ... ", args->file_local);
+ printf("Uploading %s ... ", leafname(args->file_local));
}
fflush(stdout);
status = tftp_put(args);
int force_root;
};
+const char *leafname(const char *path);
int tftp_put(struct nmrpd_args *args);
bool tftp_is_valid_filename(const char *filename);
ERR = 5
};
-static const char *leafname(const char *path)
-{
- const char *slash, *bslash;
-
- slash = strrchr(path, '/');
- bslash = strrchr(path, '\\');
-
- if (slash && bslash) {
- path = 1 + (slash > bslash ? slash : bslash);
- } else if (slash) {
- path = 1 + slash;
- } else if (bslash) {
- path = 1 + bslash;
- }
-
- return path;
-}
-
static bool is_netascii(const char *str)
{
uint8_t *p = (uint8_t*)str;
return sent;
}
+const char *leafname(const char *path)
+{
+ const char *slash, *bslash;
+
+ slash = strrchr(path, '/');
+ bslash = strrchr(path, '\\');
+
+ if (slash && bslash) {
+ path = 1 + (slash > bslash ? slash : bslash);
+ } else if (slash) {
+ path = 1 + slash;
+ } else if (bslash) {
+ path = 1 + bslash;
+ }
+
+ return path;
+}
+
#ifdef NMRPFLASH_WINDOWS
void sock_perror(const char *msg)
{