summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2002-01-21 06:42:45 +0000
committerMartin Pool <mbp@samba.org>2002-01-21 06:42:45 +0000
commit2a2f4a24f7c0a9c624db119a11d9afdb27a11b8a (patch)
tree96286f9cd066ed8a22f6002a9a1a145907df71f6
parentfb76d58d164829304293f867732d4544b8fa0125 (diff)
downloadsamba-2a2f4a24f7c0a9c624db119a11d9afdb27a11b8a.tar.gz
samba-2a2f4a24f7c0a9c624db119a11d9afdb27a11b8a.tar.bz2
samba-2a2f4a24f7c0a9c624db119a11d9afdb27a11b8a.zip
Make the -L option to smbclient slightly less gross:
smbclient -L //nautilus1/ should definitely not say "unknown host "nautilus1/". Sheesh. (This used to be commit 1cd431b8f17e5ac394436d31f64032387ca11930)
-rw-r--r--source3/client/client.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index eb9750299b..9e9135f2d6 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -2531,6 +2531,27 @@ static int do_message_op(void)
}
+/**
+ * Process "-L hostname" option.
+ *
+ * We don't actually do anything yet -- we just stash the name in a
+ * global variable and do the query when all options have been read.
+ **/
+static void remember_query_host(const char *arg,
+ pstring query_host)
+{
+ char *slash;
+
+ while (*arg == '\\' || *arg == '/')
+ arg++;
+ pstrcpy(query_host, arg);
+ if ((slash = strchr(query_host, '/'))
+ || (slash = strchr(query_host, '\\'))) {
+ *slash = 0;
+ }
+}
+
+
/****************************************************************************
main program
****************************************************************************/
@@ -2811,10 +2832,7 @@ static int do_message_op(void)
break;
case 'L':
- p = optarg;
- while(*p == '\\' || *p == '/')
- p++;
- pstrcpy(query_host,p);
+ remember_query_host(optarg, query_host);
break;
case 't':
pstrcpy(term_code, optarg);