Module Name:    src
Committed By:   christos
Date:           Wed Oct 29 17:14:50 UTC 2014

Modified Files:
        src/usr.bin/config: Makefile defs.h files.c gram.y hash.c lint.c main.c
            mkdevsw.c mkheaders.c mkioconf.c mkmakefile.c mkswap.c pack.c
            scan.l sem.c sem.h util.c

Log Message:
- add RCSID's
- fix -Wconversion (except scanner)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/config/Makefile \
    src/usr.bin/config/pack.c
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/config/defs.h
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/config/files.c
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/config/gram.y
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/config/hash.c \
    src/usr.bin/config/mkdevsw.c
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/config/lint.c
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/config/main.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/config/mkheaders.c \
    src/usr.bin/config/mkioconf.c
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/config/mkmakefile.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/config/mkswap.c
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/config/scan.l \
    src/usr.bin/config/util.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/config/sem.c
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/config/sem.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/config/Makefile
diff -u src/usr.bin/config/Makefile:1.8 src/usr.bin/config/Makefile:1.9
--- src/usr.bin/config/Makefile:1.8	Sun May 13 16:22:45 2007
+++ src/usr.bin/config/Makefile	Wed Oct 29 13:14:50 2014
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.8 2007/05/13 20:22:45 veego Exp $
+#	$NetBSD: Makefile,v 1.9 2014/10/29 17:14:50 christos Exp $
 #	from: @(#)Makefile	8.2 (Berkeley) 4/19/94
 
 .include <bsd.own.mk>
+WARNS=6
 
 PROG=	config
 SRCS=	files.c gram.y hash.c lint.c main.c mkdevsw.c mkheaders.c mkioconf.c \
@@ -21,6 +22,8 @@ LDADD+=-lutil
 DPADD+=${LIBUTIL}
 .endif
 
+COPTS.scan.c+=-Wno-conversion
+
 CWARNFLAGS+=-Wno-format-y2k
 
 .include <bsd.prog.mk>
Index: src/usr.bin/config/pack.c
diff -u src/usr.bin/config/pack.c:1.8 src/usr.bin/config/pack.c:1.9
--- src/usr.bin/config/pack.c:1.8	Mon Mar  8 05:19:14 2010
+++ src/usr.bin/config/pack.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pack.c,v 1.8 2010/03/08 10:19:14 pooka Exp $	*/
+/*	$NetBSD: pack.c,v 1.9 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: pack.c,v 1.9 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <stdlib.h>
 #include <string.h>
@@ -137,7 +140,7 @@ packdevi(void)
 {
 	struct devi *firststar, *i, **ip, *l, *p;
 	struct devbase *d;
-	int j, m, n;
+	u_short j, m, n;
 
 	/*
 	 * Sort all the cloning units to after the non-cloning units,

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.58 src/usr.bin/config/defs.h:1.59
--- src/usr.bin/config/defs.h:1.58	Sat Oct 18 02:36:40 2014
+++ src/usr.bin/config/defs.h	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.58 2014/10/18 06:36:40 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.59 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -304,8 +304,8 @@ struct devi {
 
 	/* created during packing or ioconf.c generation */
 	short	i_collapsed;	/* set => this alias no longer needed */
-	short	i_cfindex;	/* our index in cfdata */
-	short	i_locoff;	/* offset in locators.vec */
+	u_short	i_cfindex;	/* our index in cfdata */
+	int	i_locoff;	/* offset in locators.vec */
 
 };
 /* special units */
@@ -530,8 +530,8 @@ void	checkfiles(void);
 int	fixfiles(void);		/* finalize */
 int	fixobjects(void);
 int	fixdevsw(void);
-void	addfile(const char *, struct condexpr *, int, const char *);
-void	addobject(const char *, struct condexpr *, int);
+void	addfile(const char *, struct condexpr *, u_char, const char *);
+void	addobject(const char *, struct condexpr *, u_char);
 int	expr_eval(struct condexpr *, int (*)(const char *, void *), void *);
 
 /* hash.c */
@@ -625,7 +625,7 @@ int	mkswap(void);
 void	pack(void);
 
 /* scan.l */
-int	currentline(void);
+u_short	currentline(void);
 int	firstfile(const char *);
 void	package(const char *);
 int	include(const char *, int, int, int);

Index: src/usr.bin/config/files.c
diff -u src/usr.bin/config/files.c:1.16 src/usr.bin/config/files.c:1.17
--- src/usr.bin/config/files.c:1.16	Thu Oct  9 15:27:04 2014
+++ src/usr.bin/config/files.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: files.c,v 1.16 2014/10/09 19:27:04 uebayasi Exp $	*/
+/*	$NetBSD: files.c,v 1.17 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: files.c,v 1.17 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <errno.h>
 #include <stdio.h>
@@ -83,7 +86,7 @@ initfiles(void)
 }
 
 void
-addfile(const char *path, struct condexpr *optx, int flags, const char *rule)
+addfile(const char *path, struct condexpr *optx, u_char flags, const char *rule)
 {
 	struct files *fi;
 	const char *dotp, *tail;
@@ -112,7 +115,7 @@ addfile(const char *path, struct condexp
 		tail++;
 	dotp = strrchr(tail, '.');
 	if (dotp == NULL || dotp[1] == 0 ||
-	    (baselen = dotp - tail) >= sizeof(base)) {
+	    (baselen = (size_t)(dotp - tail)) >= sizeof(base)) {
 		cfgerror("invalid pathname `%s'", path);
 		goto bad;
 	}
@@ -168,7 +171,7 @@ addfile(const char *path, struct condexp
 }
 
 void
-addobject(const char *path, struct condexpr *optx, int flags)
+addobject(const char *path, struct condexpr *optx, u_char flags)
 {
 	struct objects *oi;
 
@@ -298,7 +301,7 @@ fixfiles(void)
 				if (ht_replace(basetab, fi->fi_base, fi) != 1)
 					panic("fixfiles ht_replace(%s)",
 					    fi->fi_base);
-				ofi->fi_flags &= ~FI_SEL;
+				ofi->fi_flags &= (u_char)~FI_SEL;
 				ofi->fi_flags |= FI_HIDDEN;
 			} else {
 				cfgxerror(fi->fi_srcfile, fi->fi_srcline,

Index: src/usr.bin/config/gram.y
diff -u src/usr.bin/config/gram.y:1.43 src/usr.bin/config/gram.y:1.44
--- src/usr.bin/config/gram.y:1.43	Fri Oct 10 07:09:50 2014
+++ src/usr.bin/config/gram.y	Wed Oct 29 13:14:50 2014
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: gram.y,v 1.43 2014/10/10 11:09:50 uebayasi Exp $	*/
+/*	$NetBSD: gram.y,v 1.44 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,6 +41,9 @@
  *	from: @(#)gram.y	8.1 (Berkeley) 6/6/93
  */
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: gram.y,v 1.44 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/types.h>
 #include <sys/param.h>
 #include <ctype.h>
@@ -159,6 +162,9 @@ static struct loclist *namelocvals(const
 	const char *str;
 	struct	numconst num;
 	int64_t	val;
+	u_char	flag;
+	devmajor_t devmajor;
+	int32_t i32;
 }
 
 %token	AND AT ATTACH
@@ -187,7 +193,7 @@ static struct loclist *namelocvals(const
 %type	<condexpr>	cond_or_expr cond_and_expr cond_prefix_expr
 %type	<condexpr>	 cond_base_expr
 %type	<str>	fs_spec
-%type	<val>	fflags fflag oflags oflag
+%type	<flag>	fflags fflag oflags oflag
 %type	<str>	rule
 %type	<attr>	depend
 %type	<devb>	devbase
@@ -204,9 +210,9 @@ static struct loclist *namelocvals(const
 %type	<str>	device_instance
 %type	<str>	attachment
 %type	<str>	value
-%type	<val>	major_minor npseudo
+%type	<val>	major_minor
 %type	<num>	signed_number
-%type	<val>	device_flags
+%type	<i32>	int32 npseudo device_flags
 %type	<str>	deffs
 %type	<list>	deffses
 %type	<defoptlist>	defopt
@@ -217,7 +223,7 @@ static struct loclist *namelocvals(const
 %type	<str>	optfile_opt
 %type	<list>	subarches
 %type	<str>	filename stringvalue locname mkvarname
-%type	<val>	device_major_block device_major_char
+%type	<devmajor>	device_major_block device_major_char
 %type	<list>	devnodes devnodetype devnodeflags devnode_dims
 
 %%
@@ -404,12 +410,12 @@ define_device_attachment:
 ;
 
 define_maxpartitions:
-	MAXPARTITIONS NUMBER		{ maxpartitions = $2.val; }
+	MAXPARTITIONS int32		{ maxpartitions = $2; }
 ;
 
 define_maxusers:
-	MAXUSERS NUMBER NUMBER NUMBER
-					{ setdefmaxusers($2.val, $3.val, $4.val); }
+	MAXUSERS int32 int32 int32
+					{ setdefmaxusers($2, $3, $4); }
 ;
 
 define_makeoptions:
@@ -432,7 +438,7 @@ define_major:
 ;
 
 define_version:
-	VERSION NUMBER		{ setversion($2.val); }
+	VERSION int32		{ setversion($2); }
 ;
 
 /* file options: optional expression of conditions */
@@ -473,13 +479,13 @@ oflag:
 /* char 55 */
 device_major_char:
 	  /* empty */			{ $$ = -1; }
-	| CHAR NUMBER			{ $$ = $2.val; }
+	| CHAR int32			{ $$ = $2; }
 ;
 
 /* block 33 */
 device_major_block:
 	  /* empty */			{ $$ = -1; }
-	| BLOCK NUMBER			{ $$ = $2.val; }
+	| BLOCK int32			{ $$ = $2; }
 ;
 
 /* device node specification */
@@ -550,11 +556,11 @@ locdef:
 	  locname locdefault 		{ $$ = MK3(loc, $1, $2, 0); }
 	| locname			{ $$ = MK3(loc, $1, NULL, 0); }
 	| '[' locname locdefault ']'	{ $$ = MK3(loc, $2, $3, 1); }
-	| locname '[' NUMBER ']'	{ $$ = locarray($1, $3.val, NULL, 0); }
-	| locname '[' NUMBER ']' locdefaults
-					{ $$ = locarray($1, $3.val, $5, 0); }
-	| '[' locname '[' NUMBER ']' locdefaults ']'
-					{ $$ = locarray($2, $4.val, $6, 1); }
+	| locname '[' int32 ']'	{ $$ = locarray($1, $3, NULL, 0); }
+	| locname '[' int32 ']' locdefaults
+					{ $$ = locarray($1, $3, $5, 0); }
+	| '[' locname '[' int32 ']' locdefaults ']'
+					{ $$ = locarray($2, $4, $6, 1); }
 ;
 
 /* locator name */
@@ -665,7 +671,16 @@ majorlist:
 
 /* one major number */
 majordef:
-	devbase '=' NUMBER		{ setmajor($1, $3.val); }
+	devbase '=' int32		{ setmajor($1, $3); }
+;
+
+int32:
+	NUMBER	{
+		if ($1.val > INT_MAX || $1.val < INT_MIN)
+			cfgerror("overflow %" PRId64, $1.val);
+		else
+			$$ = (int32_t)$1.val;
+	}
 ;
 
 /************************************************************/
@@ -735,7 +750,7 @@ select_options:
 ;
 
 select_maxusers:
-	MAXUSERS NUMBER			{ setmaxusers($2.val); }
+	MAXUSERS int32			{ setmaxusers($2); }
 ;
 
 select_ident:
@@ -874,8 +889,10 @@ root_spec:
 
 /* device for root fs or dump */
 dev_spec:
-	  '?'				{ $$ = new_si(intern("?"), NODEV); }
-	| WORD				{ $$ = new_si($1, NODEV); }
+	  '?'				{ $$ = new_si(intern("?"),
+					    (long long)NODEV); }
+	| WORD				{ $$ = new_si($1,
+					    (long long)NODEV); }
 	| major_minor			{ $$ = new_si(NULL, $1); }
 ;
 
@@ -904,7 +921,7 @@ sysparam:
 /* number of pseudo devices to configure (which is optional) */
 npseudo:
 	  /* empty */			{ $$ = 1; }
-	| NUMBER			{ $$ = $1.val; }
+	| int32				{ $$ = $1; }
 ;
 
 /* name of a device to configure */
@@ -935,7 +952,7 @@ locator:
 /* optional device flags */
 device_flags:
 	  /* empty */			{ $$ = 0; }
-	| FLAGS NUMBER			{ $$ = $2.val; }
+	| FLAGS int32			{ $$ = $2; }
 ;
 
 /************************************************************/

Index: src/usr.bin/config/hash.c
diff -u src/usr.bin/config/hash.c:1.10 src/usr.bin/config/hash.c:1.11
--- src/usr.bin/config/hash.c:1.10	Sun Oct 12 01:25:21 2014
+++ src/usr.bin/config/hash.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.10 2014/10/12 05:25:21 uebayasi Exp $	*/
+/*	$NetBSD: hash.c,v 1.11 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: hash.c,v 1.11 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <assert.h>
 #include <stdlib.h>
@@ -67,9 +70,9 @@ struct hashent {
 };
 struct hashtab {
 	size_t	ht_size;		/* size (power of 2) */
-	u_int	ht_mask;		/* == ht_size - 1 */
-	u_int	ht_used;		/* number of entries used */
-	u_int	ht_lim;			/* when to expand */
+	size_t	ht_mask;		/* == ht_size - 1 */
+	size_t	ht_used;		/* number of entries used */
+	size_t	ht_lim;			/* when to expand */
 	TAILQ_HEAD(hashenthead, hashent) *ht_tab;
 };
 
@@ -113,7 +116,7 @@ ht_expand(struct hashtab *ht)
 {
 	struct hashenthead *h, *oldh;
 	struct hashent *p;
-	u_int n, i;
+	size_t n, i;
 
 	n = ht->ht_size * 2;
 	h = emalloc(n * sizeof *h);
@@ -162,7 +165,7 @@ newhashent(const char *name, u_int h)
 static inline u_int
 hv(u_int h, char c)
 {
-	return (h << 5) + h + c;
+	return (h << 5) + h + (unsigned char)c;
 }
 
 /*
Index: src/usr.bin/config/mkdevsw.c
diff -u src/usr.bin/config/mkdevsw.c:1.10 src/usr.bin/config/mkdevsw.c:1.11
--- src/usr.bin/config/mkdevsw.c:1.10	Fri Jul 30 12:23:49 2010
+++ src/usr.bin/config/mkdevsw.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkdevsw.c,v 1.10 2010/07/30 16:23:49 cube Exp $	*/
+/*	$NetBSD: mkdevsw.c,v 1.11 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -33,6 +33,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: mkdevsw.c,v 1.11 2014/10/29 17:14:50 christos Exp $");
+
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
@@ -189,7 +192,9 @@ emitconv(FILE *fp)
 				d_flags = nv->nv_str;
 				break;
 			}
-			d_vec[i++] = nv->nv_num;
+			if (nv->nv_num > INT_MAX || nv->nv_num < INT_MIN)
+				panic("out of range devnode definition");
+			d_vec[i++] = (int)nv->nv_num;
 		}
 
 		fprintf(fp, "\t{ \"%s\", %d, %d, %s, %s, { %d, %d }},\n",

Index: src/usr.bin/config/lint.c
diff -u src/usr.bin/config/lint.c:1.14 src/usr.bin/config/lint.c:1.15
--- src/usr.bin/config/lint.c:1.14	Tue Mar 20 16:34:57 2012
+++ src/usr.bin/config/lint.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.c,v 1.14 2012/03/20 20:34:57 matt Exp $	*/
+/*	$NetBSD: lint.c,v 1.15 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  *  Copyright (c) 2007 The NetBSD Foundation.
@@ -30,6 +30,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: lint.c,v 1.15 2014/10/29 17:14:50 christos Exp $");
+
 #include <assert.h>
 #include <stdlib.h>
 

Index: src/usr.bin/config/main.c
diff -u src/usr.bin/config/main.c:1.69 src/usr.bin/config/main.c:1.70
--- src/usr.bin/config/main.c:1.69	Sat Oct 18 02:36:40 2014
+++ src/usr.bin/config/main.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.69 2014/10/18 06:36:40 uebayasi Exp $	*/
+/*	$NetBSD: main.c,v 1.70 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: main.c,v 1.70 2014/10/29 17:14:50 christos Exp $");
+
 #ifndef MAKE_BOOTSTRAP
 #include <sys/cdefs.h>
 #define	COPYRIGHT(x)	__COPYRIGHT(x)
@@ -1557,10 +1560,10 @@ strtolower(const char *name)
 {
 	const char *n;
 	char *p, low[500];
-	unsigned char c;
+	char c;
 
 	for (n = name, p = low; (c = *n) != '\0'; n++)
-		*p++ = isupper(c) ? tolower(c) : c;
+		*p++ = isupper((u_char)c) ? tolower((u_char)c) : c;
 	*p = 0;
 	return (intern(low));
 }
@@ -1585,8 +1588,9 @@ static int
 extract_config(const char *kname, const char *cname, int cfd)
 {
 	char *ptr;
-	int found, kfd, i;
+	int found, kfd;
 	struct stat st;
+	off_t i;
 
 	found = 0;
 
@@ -1596,7 +1600,7 @@ extract_config(const char *kname, const 
 		err(EXIT_FAILURE, "cannot open %s", kname);
 	if (fstat(kfd, &st) == -1)
 		err(EXIT_FAILURE, "cannot stat %s", kname);
-	ptr = mmap(0, st.st_size, PROT_READ, MAP_FILE | MAP_SHARED,
+	ptr = mmap(0, (size_t)st.st_size, PROT_READ, MAP_FILE | MAP_SHARED,
 	    kfd, 0);
 	if (ptr == MAP_FAILED)
 		err(EXIT_FAILURE, "cannot mmap %s", kname);

Index: src/usr.bin/config/mkheaders.c
diff -u src/usr.bin/config/mkheaders.c:1.21 src/usr.bin/config/mkheaders.c:1.22
--- src/usr.bin/config/mkheaders.c:1.21	Sun Mar 11 22:58:55 2012
+++ src/usr.bin/config/mkheaders.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkheaders.c,v 1.21 2012/03/12 02:58:55 dholland Exp $	*/
+/*	$NetBSD: mkheaders.c,v 1.22 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: mkheaders.c,v 1.22 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <ctype.h>
 #include <errno.h>
@@ -137,7 +140,7 @@ fprint_global(FILE *fp, const char *name
 static unsigned int
 global_hash(const char *str)
 {
-        unsigned int h;
+        unsigned long h;
 	char *ep;
 
 	/* If the value is a valid numeric, just use it */
@@ -145,10 +148,12 @@ global_hash(const char *str)
 	if (*ep != 0)
 		/* Otherwise shove through a 32bit CRC function */
 		h = crc_buf(0, str, strlen(str));
+	else if (h > UINT_MAX)
+		panic("overflow");
 
 	/* Avoid colliding with the value used for undefined options. */
 	/* At least until I stop any options being set to zero */
-	return h != UNDEFINED ? h : DEFINED;
+	return (unsigned int)(h != UNDEFINED ? h : DEFINED);
 }
 
 static void
@@ -520,13 +525,13 @@ static char *
 cntname(const char *src)
 {
 	char *dst;
-	unsigned char c;
+	char c;
 	static char buf[100];
 
 	dst = buf;
 	*dst++ = 'N';
 	while ((c = *src++) != 0)
-		*dst++ = islower(c) ? toupper(c) : c;
+		*dst++ = islower((u_char)c) ? toupper((u_char)c) : c;
 	*dst = 0;
 	return (buf);
 }
Index: src/usr.bin/config/mkioconf.c
diff -u src/usr.bin/config/mkioconf.c:1.21 src/usr.bin/config/mkioconf.c:1.22
--- src/usr.bin/config/mkioconf.c:1.21	Sun Mar 11 17:16:08 2012
+++ src/usr.bin/config/mkioconf.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkioconf.c,v 1.21 2012/03/11 21:16:08 dholland Exp $	*/
+/*	$NetBSD: mkioconf.c,v 1.22 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: mkioconf.c,v 1.22 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <err.h>
 #include <errno.h>
@@ -136,7 +139,7 @@ static void
 emithdr(FILE *ofp)
 {
 	FILE *ifp;
-	int n;
+	size_t n;
 	char ifnbuf[200], buf[BUFSIZ];
 	char *ifn;
 

Index: src/usr.bin/config/mkmakefile.c
diff -u src/usr.bin/config/mkmakefile.c:1.24 src/usr.bin/config/mkmakefile.c:1.25
--- src/usr.bin/config/mkmakefile.c:1.24	Thu Oct  9 15:33:43 2014
+++ src/usr.bin/config/mkmakefile.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkmakefile.c,v 1.24 2014/10/09 19:33:43 uebayasi Exp $	*/
+/*	$NetBSD: mkmakefile.c,v 1.25 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: mkmakefile.c,v 1.25 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <ctype.h>
 #include <errno.h>
@@ -432,7 +435,7 @@ static void
 emitfiles(FILE *fp, int suffix, int upper_suffix)
 {
 	struct files *fi;
-	int len;
+	size_t len;
 	const char *fpath;
  	struct config *cf;
  	char swapname[100];

Index: src/usr.bin/config/mkswap.c
diff -u src/usr.bin/config/mkswap.c:1.7 src/usr.bin/config/mkswap.c:1.8
--- src/usr.bin/config/mkswap.c:1.7	Tue Jan 20 13:20:48 2009
+++ src/usr.bin/config/mkswap.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkswap.c,v 1.7 2009/01/20 18:20:48 drochner Exp $	*/
+/*	$NetBSD: mkswap.c,v 1.8 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: mkswap.c,v 1.8 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <errno.h>
 #include <stdio.h>
@@ -114,7 +117,7 @@ mkoneswap(struct config *cf)
 		    cf->cf_root->nv_str);
 	fprintf(fp, "const char *rootspec = %s;\n", specinfo);
 	fprintf(fp, "dev_t\trootdev = %s;\t/* %s */\n\n",
-		mkdevstr(nv->nv_num),
+		mkdevstr((dev_t)nv->nv_num),
 		nv->nv_str == s_qmark ? "wildcarded" : nv->nv_str);
 
 	/*
@@ -127,7 +130,7 @@ mkoneswap(struct config *cf)
 		snprintf(specinfo, sizeof(specinfo), "\"%s\"", cf->cf_dump->nv_str);
 	fprintf(fp, "const char *dumpspec = %s;\n", specinfo);
 	fprintf(fp, "dev_t\tdumpdev = %s;\t/* %s */\n\n",
-		nv ? mkdevstr(nv->nv_num) : "NODEV",
+		nv ? mkdevstr((dev_t)nv->nv_num) : "NODEV",
 		nv ? nv->nv_str : "unspecified");
 
 	/*

Index: src/usr.bin/config/scan.l
diff -u src/usr.bin/config/scan.l:1.18 src/usr.bin/config/scan.l:1.19
--- src/usr.bin/config/scan.l:1.18	Sat Oct 11 11:20:36 2014
+++ src/usr.bin/config/scan.l	Wed Oct 29 13:14:50 2014
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: scan.l,v 1.18 2014/10/11 15:20:36 uebayasi Exp $	*/
+/*	$NetBSD: scan.l,v 1.19 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,6 +41,9 @@
  *	from: @(#)scan.l	8.1 (Berkeley) 6/6/93
  */
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: scan.l,v 1.19 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <errno.h>
 #include <libgen.h>
@@ -605,12 +608,12 @@ endinclude(void)
  * us to consume a newline, we have to subtract one.  yychar is yacc's
  * token lookahead, so we can tell.
  */
-int
+u_short
 currentline(void)
 {
 	extern int yychar;
 
-	return (yyline - (yychar == '\n'));
+	return (u_short)(yyline - (yychar == '\n'));
 }
 
 static int
Index: src/usr.bin/config/util.c
diff -u src/usr.bin/config/util.c:1.18 src/usr.bin/config/util.c:1.19
--- src/usr.bin/config/util.c:1.18	Fri Oct 10 23:17:40 2014
+++ src/usr.bin/config/util.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.18 2014/10/11 03:17:40 uebayasi Exp $	*/
+/*	$NetBSD: util.c,v 1.19 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: util.c,v 1.19 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/types.h>
 #include <assert.h>
 #include <ctype.h>

Index: src/usr.bin/config/sem.c
diff -u src/usr.bin/config/sem.c:1.64 src/usr.bin/config/sem.c:1.65
--- src/usr.bin/config/sem.c:1.64	Sat Oct 18 02:36:40 2014
+++ src/usr.bin/config/sem.c	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sem.c,v 1.64 2014/10/18 06:36:40 uebayasi Exp $	*/
+/*	$NetBSD: sem.c,v 1.65 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
 #include "nbtool_config.h"
 #endif
 
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: sem.c,v 1.65 2014/10/29 17:14:50 christos Exp $");
+
 #include <sys/param.h>
 #include <ctype.h>
 #include <stdio.h>
@@ -885,7 +888,7 @@ resolve(struct nvlist **nvp, const char 
 	const char *cp;
 	devmajor_t maj;
 	devminor_t min;
-	int i, l;
+	size_t i, l;
 	int unit;
 	char buf[NAMESIZE];
 
@@ -905,7 +908,7 @@ resolve(struct nvlist **nvp, const char 
 			cp = makedevstr(maj, min);
 		} else
 			cp = NULL;
-		*nvp = nv = newnv(NULL, cp, NULL, d, NULL);
+		*nvp = nv = newnv(NULL, cp, NULL, (long long)d, NULL);
 	}
 	if ((dev_t)nv->nv_num != NODEV) {
 		/*
@@ -952,7 +955,7 @@ resolve(struct nvlist **nvp, const char 
 	 * don't bother making a device number.
 	 */
 	if (has_attr(dev->d_attrs, s_ifnet)) {
-		nv->nv_num = NODEV;
+		nv->nv_num = (long long)NODEV;
 		nv->nv_ifunit = unit;	/* XXX XXX XXX */
 	} else {
 		maj = dev2major(dev);
@@ -1466,14 +1469,18 @@ deldeva(const char *at)
 			if (i->i_at == NULL)
 				stack = newnv(NULL, NULL, i, 0, stack);
 	} else {
-		int l;
+		size_t l;
 
 		CFGDBG(5, "deselecting deva `%s'", at);
+		if (at[0] == '\0')
+			goto out;
+			
 		l = strlen(at) - 1;
 		if (at[l] == '?' || isdigit((unsigned char)at[l])) {
 			char base[NAMESIZE];
 
 			if (split(at, l+1, base, sizeof base, &unit)) {
+out:
 				cfgerror("invalid attachment name `%s'", at);
 				return;
 			}
@@ -1548,16 +1555,20 @@ deldeva(const char *at)
 void
 deldev(const char *name)
 {
-	int l;
+	size_t l;
 	struct devi *firsti, *i;
 	struct nvlist *nv, *stack = NULL;
 
 	CFGDBG(5, "deselecting dev `%s'", name);
+	if (name[0] == '\0')
+		goto out;
+
 	l = strlen(name) - 1;
 	if (name[l] == '*' || isdigit((unsigned char)name[l])) {
 		/* `no mydev0' or `no mydev*' */
 		firsti = ht_lookup(devitab, name);
 		if (firsti == NULL) {
+out:
 			cfgerror("unknown instance %s", name);
 			return;
 		}
@@ -1883,8 +1894,8 @@ concat(const char *name, int c)
 		len = sizeof(buf) - 2;
 	}
 	memmove(buf, name, len);
-	buf[len] = c;
-	buf[len + 1] = 0;
+	buf[len] = (char)c;
+	buf[len + 1] = '\0';
 	return (intern(buf));
 }
 
@@ -2047,7 +2058,7 @@ fixloc(const char *name, struct attr *at
 	if (attr->a_loclen == 0)	/* e.g., "at root" */
 		lp = nullvec;
 	else
-		lp = emalloc((attr->a_loclen + 1) * sizeof(const char *));
+		lp = emalloc((size_t)(attr->a_loclen + 1) * sizeof(const char *));
 	for (n = got; n != NULL; n = n->ll_next)
 		n->ll_num = -1;
 	nmissing = 0;

Index: src/usr.bin/config/sem.h
diff -u src/usr.bin/config/sem.h:1.15 src/usr.bin/config/sem.h:1.16
--- src/usr.bin/config/sem.h:1.15	Sat Oct 18 02:36:40 2014
+++ src/usr.bin/config/sem.h	Wed Oct 29 13:14:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sem.h,v 1.15 2014/10/18 06:36:40 uebayasi Exp $	*/
+/*	$NetBSD: sem.h,v 1.16 2014/10/29 17:14:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -74,7 +74,7 @@ void		deldev(const char *);
 void		addpseudo(const char *, int);
 void		delpseudo(const char *);
 void		addpseudoroot(const char *);
-void		adddevm(const char *, int, int,
+void		adddevm(const char *, devmajor_t, devmajor_t,
 			struct condexpr *, struct nvlist *);
 int		fixdevis(void);
 const char     *ref(const char *);

Reply via email to