diff options
author | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-09-05 21:20:15 +0200 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-10-01 14:18:15 +0200 |
commit | d543aa01480f1b54041f98707102622308252e11 (patch) | |
tree | 1b0a9b9134a4199340846ae5651084eb6003278a | |
parent | 96a56ba086ec94e577e4b3562010710abb2087c6 (diff) | |
download | openocd+libswd-d543aa01480f1b54041f98707102622308252e11.tar.gz openocd+libswd-d543aa01480f1b54041f98707102622308252e11.tar.bz2 openocd+libswd-d543aa01480f1b54041f98707102622308252e11.tar.xz openocd+libswd-d543aa01480f1b54041f98707102622308252e11.zip |
zy1000: add : port number syntax for tftp filing system
Allows using non-standard port number. Default to port 69.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
-rw-r--r-- | src/ecosboard.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ecosboard.c b/src/ecosboard.c index f6e040fa..26313b42 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -1277,6 +1277,7 @@ struct Tftp cyg_uint8 *mem; int actual; char *server; + int port; char *file; }; @@ -1333,6 +1334,15 @@ static int tftpfs_open(cyg_mtab_entry *mte, cyg_dir dir, const char *name, strncpy(tftp->server, name, server - name); tftp->server[server - name] = 0; + tftp->port = 0; /* default port 69 */ + char *port; + port = strchr(tftp->server, ':'); + if (port != NULL) + { + tftp->port = atoi(port + 1); + *port = 0; + } + tftp->file = strdup(server + 1); if (tftp->file == NULL) { @@ -1350,7 +1360,7 @@ static int fetchTftp(struct Tftp *tftp) if (!tftp->readFile) { int err; - tftp->actual = tftp_client_get(tftp->file, tftp->server, 0, tftp->mem, + tftp->actual = tftp_client_get(tftp->file, tftp->server, tftp->port, tftp->mem, tftpMaxSize, TFTP_OCTET, &err); if (tftp->actual < 0) |