Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Mar 2010 18:51:13 +0000 (UTC)
From:      Ulrich Spoerlein <uqs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r204966 - head/sbin/nos-tun
Message-ID:  <201003101851.o2AIpDAR031598@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: uqs
Date: Wed Mar 10 18:51:13 2010
New Revision: 204966
URL: http://svn.freebsd.org/changeset/base/204966

Log:
  nos-tun(8): make WARNS=3 clean
  
  The renames are in spirit of DragonflyBSD, to keep diff minimal.
  
  PR:		bin/140060
  Approved by:	ed (co-mentor)

Modified:
  head/sbin/nos-tun/Makefile
  head/sbin/nos-tun/nos-tun.c

Modified: head/sbin/nos-tun/Makefile
==============================================================================
--- head/sbin/nos-tun/Makefile	Wed Mar 10 18:30:55 2010	(r204965)
+++ head/sbin/nos-tun/Makefile	Wed Mar 10 18:51:13 2010	(r204966)
@@ -1,8 +1,8 @@
 # $FreeBSD$
 
 PROG=	nos-tun
-WARNS?=	0
 MAN=	nos-tun.8
+WARNS?=	3
 
 .include <bsd.prog.mk>
 

Modified: head/sbin/nos-tun/nos-tun.c
==============================================================================
--- head/sbin/nos-tun/nos-tun.c	Wed Mar 10 18:30:55 2010	(r204965)
+++ head/sbin/nos-tun/nos-tun.c	Wed Mar 10 18:51:13 2010	(r204966)
@@ -89,7 +89,8 @@ int tun;                          /* tun
 
 static void usage(void);
 
-int Set_address(char *addr, struct sockaddr_in *sin)
+static int
+Set_address(char *addr, struct sockaddr_in *sin)
 {
   struct hostent *hp;
 
@@ -107,15 +108,16 @@ int Set_address(char *addr, struct socka
   return 0;
 }
 
-int tun_open(char *devname, struct sockaddr *ouraddr, char *theiraddr)
+static int
+tun_open(char *dev_name, struct sockaddr *ouraddr, char *theiraddr)
 {
   int s;
   struct sockaddr_in *sin;
 
   /* Open tun device */
-  tun = open (devname, O_RDWR);
+  tun = open(dev_name, O_RDWR);
   if (tun < 0) {
-    syslog(LOG_ERR,"can't open %s - %m",devname);
+    syslog(LOG_ERR,"can't open %s - %m", dev_name);
     return(1);
   }
 
@@ -125,8 +127,8 @@ int tun_open(char *devname, struct socka
   bzero((char *)&ifra, sizeof(ifra));
   bzero((char *)&ifrq, sizeof(ifrq));
 
-  strncpy(ifrq.ifr_name, devname+5, IFNAMSIZ);
-  strncpy(ifra.ifra_name, devname+5, IFNAMSIZ);
+  strncpy(ifrq.ifr_name, dev_name+5, IFNAMSIZ);
+  strncpy(ifra.ifra_name, dev_name+5, IFNAMSIZ);
 
   s = socket(AF_INET, SOCK_DGRAM, 0);
   if (s < 0) {
@@ -189,7 +191,8 @@ tunc_return:
   return(1);
 }
 
-void Finish(int signum)
+static void
+Finish(int signum)
 {
   int s;
 
@@ -238,7 +241,7 @@ int main (int argc, char **argv)
 {
   int  c, len, ipoff;
 
-  char *devname = NULL;
+  char *dev_name = NULL;
   char *point_to = NULL;
   char *to_point = NULL;
   char *target;
@@ -268,7 +271,7 @@ int main (int argc, char **argv)
       point_to = optarg;
       break;
     case 't':
-      devname = optarg;
+      dev_name = optarg;
       break;
     case 'p':
       protocol = optarg;
@@ -278,7 +281,7 @@ int main (int argc, char **argv)
   argc -= optind;
   argv += optind;
 
-  if ((argc != 1 && argc != 2) || (devname == NULL) ||
+  if ((argc != 1 && argc != 2) || (dev_name == NULL) ||
       (point_to == NULL) || (to_point == NULL)) {
     usage();
   }
@@ -302,7 +305,7 @@ int main (int argc, char **argv)
     exit(2);
   }
 
-  if(tun_open(devname, &t_laddr, to_point)) {
+  if(tun_open(dev_name, &t_laddr, to_point)) {
     closelog();
     exit(3);
   }
@@ -386,7 +389,7 @@ int main (int argc, char **argv)
 }
 
 static void
-usage()
+usage(void)
 {
 	fprintf(stderr,
 "usage: nos-tun -t tunnel -s source -d destination -p protocol_number [source] target\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003101851.o2AIpDAR031598>