From: Christos Zoulas Date: Tue, 18 Apr 2006 17:27:57 +0000 (+0000) Subject: Make netgrp and netgrpd take an optional ",host" argument instead of always X-Git-Tag: am-utils-6_2a2~7 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=e7ab3d10e0ffb7a78ab79907242e15d2982e79f8;p=am-utils-6.0.git Make netgrp and netgrpd take an optional ",host" argument instead of always defaulting to ${host} or ${hostd} respectively. --- diff --git a/amd/opts.c b/amd/opts.c index 2680ffb..cddc993 100644 --- a/amd/opts.c +++ b/amd/opts.c @@ -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; }