svn commit: r246256 - in head/usr.sbin/crunch: crunchgen crunchide examples

Pedro F. Giffuni pfg at FreeBSD.org
Sat Feb 2 21:51:15 UTC 2013


Author: pfg
Date: Sat Feb  2 21:51:14 2013
New Revision: 246256
URL: http://svnweb.freebsd.org/changeset/base/246256

Log:
  crunch: Sync some NetBSD changes.
  
  crunchide:
  Apr 11, 2009: fix some -Wsign-compare issues.
  Sep 20, 1999: Free the right thing.
  
  crunchgen:
  Apr 14, 2009: Fix some WARNS=4 issues (-Wshadow -Wcast-qual)
  Oct 30, 2004: Add (unsigned char) cast to ctype functions
  Feb 5, 2001: fix nested extern.
  
  examples:
  Aug 30, 2007: NetBSD 36867 - trsp references are deprecated
  
  Obtained from:	NetBSD
  MFC after:	1 week

Modified:
  head/usr.sbin/crunch/crunchgen/crunchgen.c
  head/usr.sbin/crunch/crunchide/exec_elf32.c
  head/usr.sbin/crunch/examples/really-big.conf

Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c
==============================================================================
--- head/usr.sbin/crunch/crunchgen/crunchgen.c	Sat Feb  2 18:08:09 2013	(r246255)
+++ head/usr.sbin/crunch/crunchgen/crunchgen.c	Sat Feb  2 21:51:14 2013	(r246256)
@@ -105,15 +105,16 @@ int list_mode;
 
 /* general library routines */
 
-void status(char *str);
+void status(const char *str);
 void out_of_memory(void);
 void add_string(strlst_t **listp, char *str);
-int is_dir(char *pathname);
-int is_nonempty_file(char *pathname);
+int is_dir(const char *pathname);
+int is_nonempty_file(const char *pathname);
 int subtract_strlst(strlst_t **lista, strlst_t **listb);
 int in_list(strlst_t **listp, char *str);
 
-/* helper routines for main() */
+
+extern char *crunched_skel[];
 
 void usage(void);
 void parse_conf_file(void);
@@ -245,7 +246,7 @@ usage(void)
 /* helper routines for parse_conf_file */
 
 void parse_one_file(char *filename);
-void parse_line(char *line, int *fc, char **fv, int nf);
+void parse_line(char *pline, int *fc, char **fv, int nf);
 void add_srcdirs(int argc, char **argv);
 void add_progs(int argc, char **argv);
 void add_link(int argc, char **argv);
@@ -340,15 +341,15 @@ parse_one_file(char *filename)
 
 
 void
-parse_line(char *line, int *fc, char **fv, int nf)
+parse_line(char *pline, int *fc, char **fv, int nf)
 {
 	char *p;
 
-	p = line;
+	p = pline;
 	*fc = 0;
 
 	while (1) {
-		while (isspace(*p))
+		while (isspace((unsigned char)*p))
 			p++;
 
 		if (*p == '\0' || *p == '#')
@@ -357,7 +358,7 @@ parse_line(char *line, int *fc, char **f
 		if (*fc < nf)
 			fv[(*fc)++] = p;
 
-		while (*p && !isspace(*p) && *p != '#')
+		while (*p && !isspace((unsigned char)*p) && *p != '#')
 			p++;
 
 		if (*p == '\0' || *p == '#')
@@ -767,17 +768,17 @@ fillin_program_objs(prog_t *p, char *pat
 		}
 
 		cp = line + 6;
-		while (isspace(*cp))
+		while (isspace((unsigned char)*cp))
 			cp++;
 
 		while(*cp) {
 			obj = cp;
-			while (*cp && !isspace(*cp))
+			while (*cp && !isspace((unsigned char)*cp))
 				cp++;
 			if (*cp)
 				*cp++ = '\0';
 			add_string(&p->objs, obj);
-			while (isspace(*cp))
+			while (isspace((unsigned char)*cp))
 				cp++;
 		}
 	}
@@ -887,7 +888,6 @@ gen_output_makefile(void)
 void
 gen_output_cfile(void)
 {
-	extern char *crunched_skel[];
 	char **cp;
 	FILE *outcf;
 	prog_t *p;
@@ -945,7 +945,7 @@ char *genident(char *str)
 	for (d = s = n; *s != '\0'; s++) {
 		if (*s == '-')
 			*d++ = '_';
-		else if (*s == '_' || isalnum(*s))
+		else if (*s == '_' || isalnum((unsigned char)*s))
 			*d++ = *s;
 	}
 	*d = '\0';
@@ -1135,7 +1135,7 @@ output_strlst(FILE *outf, strlst_t *lst)
  */
 
 void
-status(char *str)
+status(const char *str)
 {
 	static int lastlen = 0;
 	int len, spaces;
@@ -1211,7 +1211,7 @@ in_list(strlst_t **listp, char *str)
 }
 
 int
-is_dir(char *pathname)
+is_dir(const char *pathname)
 {
 	struct stat buf;
 
@@ -1222,7 +1222,7 @@ is_dir(char *pathname)
 }
 
 int
-is_nonempty_file(char *pathname)
+is_nonempty_file(const char *pathname)
 {
 	struct stat buf;
 

Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c
==============================================================================
--- head/usr.sbin/crunch/crunchide/exec_elf32.c	Sat Feb  2 18:08:09 2013	(r246255)
+++ head/usr.sbin/crunch/crunchide/exec_elf32.c	Sat Feb  2 21:51:14 2013	(r246256)
@@ -31,7 +31,7 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
-__RCSID("$NetBSD: exec_elf32.c,v 1.4 1997/08/12 06:07:24 mikel Exp $");
+__RCSID("$NetBSD: exec_elf32.c,v 1.6 1999/09/20 04:12:16 christos Exp $");
 #endif
 #endif
 __FBSDID("$FreeBSD$");
@@ -98,7 +98,7 @@ xreadatoff(int fd, void *buf, off_t off,
 		perror(fn);
 		return -1;
 	}
-	if ((rv = read(fd, buf, size)) != size) {
+	if ((size_t)(rv = read(fd, buf, size)) != size) {
 		fprintf(stderr, "%s: read error: %s\n", fn,
 		    rv == -1 ? strerror(errno) : "short read");
 		return -1;
@@ -115,7 +115,7 @@ xwriteatoff(int fd, void *buf, off_t off
 		perror(fn);
 		return -1;
 	}
-	if ((rv = write(fd, buf, size)) != size) {
+	if ((size_t)(rv = write(fd, buf, size)) != size) {
 		fprintf(stderr, "%s: write error: %s\n", fn,
 		    rv == -1 ? strerror(errno) : "short write");
 		return -1;
@@ -162,7 +162,7 @@ ELFNAMEEND(check)(int fd, const char *fn
 	 */
 	if (fstat(fd, &sb) == -1)
 		return 0;
-	if (sb.st_size < sizeof eh)
+	if (sb.st_size < (off_t)(sizeof eh))
 		return 0;
 	if (read(fd, &eh, sizeof eh) != sizeof eh)
 		return 0;
@@ -305,7 +305,7 @@ ELFNAMEEND(hide)(int fd, const char *fn)
 	if ((symtabp = xmalloc(xewtoh(symtabshdr->sh_size), fn, "symbol table"))
 	    == NULL)
 		goto bad;
-	if (xreadatoff(fd, symtabp, xewtoh(symtabshdr->sh_offset),
+	if ((size_t)xreadatoff(fd, symtabp, xewtoh(symtabshdr->sh_offset),
 	    xewtoh(symtabshdr->sh_size), fn) != xewtoh(symtabshdr->sh_size))
 		goto bad;
 
@@ -313,7 +313,7 @@ ELFNAMEEND(hide)(int fd, const char *fn)
 	if ((strtabp = xmalloc(xewtoh(strtabshdr->sh_size), fn, "string table"))
 	    == NULL)
 		goto bad;
-	if (xreadatoff(fd, strtabp, xewtoh(strtabshdr->sh_offset),
+	if ((size_t)xreadatoff(fd, strtabp, xewtoh(strtabshdr->sh_offset),
 	    xewtoh(strtabshdr->sh_size), fn) != xewtoh(strtabshdr->sh_size))
 		goto bad;
 
@@ -370,7 +370,7 @@ ELFNAMEEND(hide)(int fd, const char *fn)
 	if (xwriteatoff(fd, shdrp, xewtoh(ehdr.e_shoff), shdrsize, fn) !=
 	    shdrsize)
 		goto bad;
-	if (xwriteatoff(fd, symtabp, xewtoh(symtabshdr->sh_offset),
+	if ((size_t)xwriteatoff(fd, symtabp, xewtoh(symtabshdr->sh_offset),
 	    xewtoh(symtabshdr->sh_size), fn) != xewtoh(symtabshdr->sh_size))
 		goto bad;
 	/* write new symbol table strings */
@@ -384,7 +384,7 @@ out:
 	if (symtabp != NULL)
 		free(symtabp);
 	if (strtabp != NULL)
-		free(strtabp);
+		free(nstrtabp);
 	return (rv);
 
 bad:

Modified: head/usr.sbin/crunch/examples/really-big.conf
==============================================================================
--- head/usr.sbin/crunch/examples/really-big.conf	Sat Feb  2 18:08:09 2013	(r246255)
+++ head/usr.sbin/crunch/examples/really-big.conf	Sat Feb  2 21:51:14 2013	(r246256)
@@ -72,7 +72,7 @@ progs dev_mkdb diskpart edquota flcopy g
 progs iostat iteconfig kvm_mkdb mtree named portmap pppd
 progs pstat pwd_mkdb quot quotaon rarpd rbootd repquota rmt rpc.bootparamd
 progs rwhod sa spray sysctl syslogd tcpdump
-progs traceroute trpt trsp update vipw vnconfig ypbind yppoll ypset
+progs traceroute trpt update vipw vnconfig ypbind yppoll ypset
 
 special amd srcdir /usr/src/usr.sbin/amd/amd
 special amd objs vers.amd.o afs_ops.o am_ops.o clock.o util.o xutil.o efs_ops.o mapc.o info_file.o info_hes.o info_ndbm.o info_passwd.o info_nis.o info_union.o map.o srvr_afs.o srvr_nfs.o mntfs.o misc_rpc.o mount_fs.o mtab.o mtab_bsd.o nfs_ops.o nfs_prot_svc.o nfs_start.o nfs_subr.o opts.o pfs_ops.o rpc_fwd.o sched.o sfs_ops.o amq_svc.o amq_subr.o umount_fs.o host_ops.o nfsx_ops.o ufs_ops.o ifs_ops.o amd.o get_args.o restart.o wire.o


More information about the svn-src-all mailing list