Make netgrp and netgrpd take an optional ",host" argument instead of always
authorChristos Zoulas <christos@zoulas.com>
Tue, 18 Apr 2006 17:27:57 +0000 (17:27 +0000)
committerChristos Zoulas <christos@zoulas.com>
Tue, 18 Apr 2006 17:27:57 +0000 (17:27 +0000)
defaulting to ${host} or ${hostd} respectively.

amd/opts.c

index 2680ffb7e33694fa561438e235b0e34362cd025c..cddc993429b4d83a71bf043d941f443c5e53bc88 100644 (file)
@@ -896,9 +896,19 @@ static int
 f_netgrp(char *arg)
 {
   int status;
+  char *ptr, *nhost;
 
-  status = innetgr(arg, opt_host, NULL, NULL);
-  dlog("netgrp = %s status = %d host = %s", arg, status, opt_host);
+  if ((ptr = strchr(arg, ',')) != NULL) {
+    *ptr = '\0';
+    nhost = ptr + 1;
+  } else {
+    nhost = opt_host;
+  }
+
+  status = innetgr(arg, nhost, NULL, NULL);
+  dlog("netgrp = %s status = %d host = %s", arg, status, nhost);
+  if (ptr)
+    *ptr = ',';
   return status;
 }
 
@@ -908,9 +918,18 @@ static int
 f_netgrpd(char *arg)
 {
   int status;
+  char *ptr, *nhost;
 
-  status = innetgr(arg, opt_hostd, NULL, NULL);
-  dlog("netgrp = %s status = %d hostd = %s", arg, status, opt_hostd);
+  if ((ptr = strchr(arg, ',')) != NULL) {
+    *ptr = '\0';
+    nhost = ptr + 1;
+  } else {
+    nhost = opt_hostd;
+  }
+  status = innetgr(arg, nhost, NULL, NULL);
+  dlog("netgrp = %s status = %d hostd = %s", arg, status, nhost);
+  if (ptr)
+    *ptr = ',';
   return status;
 }