From 752cb4134db68b5d5ac2b6bde086a2a7f9809a5a Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 18 Jul 2021 07:46:09 +1000 Subject: [PATCH] url: add support for server:port syntax in the url Signed-off-by: Ronnie Sahlberg --- README | 2 +- lib/libnfs.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README b/README index e321af4..d3e37b2 100644 --- a/README +++ b/README @@ -40,7 +40,7 @@ URL-FORMAT: Libnfs uses RFC2224 style URLs extended with some minor libnfs extensions. The basic syntax of these URLs is : -nfs:///path[?arg=val[&arg=val]*] +nfs://[:]/path[?arg=val[&arg=val]*] Arguments supported by libnfs are : tcp-syncnt= : Number of SYNs to send during the session establish diff --git a/lib/libnfs.c b/lib/libnfs.c index 9c8045b..4681728 100755 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -358,6 +358,12 @@ nfs_parse_url(struct nfs_context *nfs, const char *url, int dir, int incomplete) } *strp = 0; + strp = strchr(urls->server, ':'); + if (strp) { + *strp++ = 0; + nfs->nfsport = atoi(strp); + } + if (dir) { flagsp = strchr(urls->path, '?'); goto flags;