From owner-freebsd-hackers Thu Aug 26 12:52:33 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from gateway.cybernet.com (gateway.cybernet.com [192.245.33.1]) by hub.freebsd.org (Postfix) with ESMTP id 550C515E09 for ; Thu, 26 Aug 1999 12:52:28 -0700 (PDT) (envelope-from mtaylor@cybernet.com) Received: from spiffy.cybernet.com (spiffy.cybernet.com [192.245.33.55]) by gateway.cybernet.com (8.8.8/8.8.8) with ESMTP id PAA21118 for ; Thu, 26 Aug 1999 15:52:23 -0400 (EDT) (envelope-from mtaylor@cybernet.com) Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Date: Thu, 26 Aug 1999 15:57:14 -0400 (EDT) Reply-To: mtaylor@cybernet.com Organization: Cybernet Systems From: "Mark J. Taylor" To: hackers@freebsd.org Subject: Request for review: vnconfig.c Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG (Since this will be one of my first commits, I'd like to pass it by as many people as possible.) This patch makes "vnconfig" like "ccdconfig" where you don't have to specify "/dev/xxx": it will add "/dev/" for you. Same goes for the "vntab" file. Also includes "-Wall" cleanup. [I already know about the malloc() w/o an associated free().] Anyone opposed? Comments? style(9) bugs? -Mark Taylor NetMAX Developer mtaylor@cybernet.com http://www.netmax.com/ Index: vnconfig.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/vnconfig/vnconfig.c,v retrieving revision 1.10 diff -u -r1.10 vnconfig.c --- vnconfig.c 1999/05/16 08:09:23 1.10 +++ vnconfig.c 1999/08/26 19:48:47 @@ -46,6 +46,7 @@ "$Id: vnconfig.c,v 1.10 1999/05/16 08:09:23 phk Exp $"; #endif /* not lint */ +#include #include #include #include @@ -54,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -236,6 +238,17 @@ FILE *f; u_long l; + rv = 0; + + /* + * Prepend "/dev/" to the specified device name, if necessary. + * Operate on vnp->dev because it is used later. + */ + if (vnp->dev[0] != '/' && vnp->dev[0] != '.') { + dev = malloc(strlen(vnp->dev)+6); + (void)sprintf(dev, "/dev/%s", vnp->dev); + vnp->dev = dev; + } dev = vnp->dev; file = vnp->file; flags = vnp->flags; @@ -318,7 +331,7 @@ if (rv) { warn("VNIO[GU]SET"); } else if (verbose) - printf("%s: flags now=%08x\n",dev,l); + printf("%s: flags now=%08lx\n",dev,l); } /* * Reset an option @@ -332,7 +345,7 @@ if (rv) { warn("VNIO[GU]CLEAR"); } else if (verbose) - printf("%s: flags now=%08x\n",dev,l); + printf("%s: flags now=%08lx\n",dev,l); } /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message