From e7ab3d10e0ffb7a78ab79907242e15d2982e79f8 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Tue, 18 Apr 2006 17:27:57 +0000 Subject: [PATCH] Make netgrp and netgrpd take an optional ",host" argument instead of always defaulting to ${host} or ${hostd} respectively. --- amd/opts.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) 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; } -- 2.43.0