From 2371f5e29eebbd71c2970998dabbfaf500d59a3c Mon Sep 17 00:00:00 2001 From: "Michael K. Johnson" Date: Tue, 16 Sep 1997 18:35:46 +0000 Subject: Users are not required to specify the "ifcfg-" part of the config file name. --- src/usernetctl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/usernetctl.c') diff --git a/src/usernetctl.c b/src/usernetctl.c index 1139a8c5..040aa2c9 100644 --- a/src/usernetctl.c +++ b/src/usernetctl.c @@ -88,6 +88,16 @@ int main(int argc, char ** argv) { ifaceConfig = chptr + 1; chptr++; } + + /* automatically prepend "ifcfg-" if it is not specified */ + if (!strncmp(ifaceConfig, "ifcfg-", 6)) { + char *temp; + temp = (char *) malloc(strlen(ifaceConfig) + 6); + strcpy(temp, "ifcfg-"); + /* strcat is safe because we got the length from strlen */ + strcat(temp, ifaceConfig); + ifaceConfig = temp; + } /* these shouldn't be symbolic links -- anal, but that's fine w/ me */ if (lstat(ifaceConfig, &sb)) { -- cgit v1.2.1