On Sat, Oct 01, 2011 at 11:10:35PM -0300, Christiano F. Haesbaert wrote: > > Makes sense to me, ok. > > Later we should fix the include orderning and change the warning > printfs to stderr.
Yes. Well, here is the first phase. * As haesbaert suggests, correctly order include files. * Found some old style function defs. Updated. * Found a prototype inside a function. Moved. OK? Index: cmd.c =================================================================== RCS file: /cvs/src/usr.sbin/config/cmd.c,v retrieving revision 1.18 diff -u -r1.18 cmd.c --- cmd.c 10 Dec 2009 22:07:19 -0000 1.18 +++ cmd.c 2 Oct 2011 14:32:27 -0000 @@ -27,11 +27,13 @@ #include <sys/types.h> #include <sys/device.h> #include <sys/time.h> + #include <ctype.h> -#include <stdio.h> #include <limits.h> #include <nlist.h> +#include <stdio.h> #include <string.h> + #include "misc.h" #define CMD_NOEXTERN #include "cmd.h" Index: exec.c =================================================================== RCS file: /cvs/src/usr.sbin/config/exec.c,v retrieving revision 1.8 diff -u -r1.8 exec.c --- exec.c 2 Oct 2011 10:10:30 -0000 1.8 +++ exec.c 2 Oct 2011 14:32:27 -0000 @@ -24,9 +24,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <err.h> #include <sys/types.h> #include <sys/stat.h> + +#include <err.h> #include <fcntl.h> #include <stdio.h> Index: exec_aout.c =================================================================== RCS file: /cvs/src/usr.sbin/config/exec_aout.c,v retrieving revision 1.10 diff -u -r1.10 exec_aout.c --- exec_aout.c 27 Oct 2009 23:59:51 -0000 1.10 +++ exec_aout.c 2 Oct 2011 14:32:27 -0000 @@ -24,15 +24,16 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/types.h> +#include <sys/exec.h> + #include <err.h> #include <errno.h> #include <fcntl.h> #include <nlist.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> -#include <sys/exec.h> -#include <sys/types.h> #include "config.h" #include "ukc.h" @@ -80,8 +81,7 @@ /* in-memory address -> ``kernel'' vaddr */ caddr_t -aout_readjust(x) - caddr_t x; +aout_readjust(caddr_t x) { caddr_t y; @@ -99,8 +99,7 @@ } int -aout_check(file) - char *file; +aout_check(char *file) { int fd, ret = 1; Index: exec_ecoff.c =================================================================== RCS file: /cvs/src/usr.sbin/config/exec_ecoff.c,v retrieving revision 1.10 diff -u -r1.10 exec_ecoff.c --- exec_ecoff.c 27 Oct 2009 23:59:51 -0000 1.10 +++ exec_ecoff.c 2 Oct 2011 14:32:27 -0000 @@ -24,16 +24,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/types.h> +#include <sys/exec.h> +#include <sys/exec_ecoff.h> + #include <err.h> #include <errno.h> #include <fcntl.h> #include <nlist.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> -#include <sys/exec.h> -#include <sys/exec_ecoff.h> -#include <sys/types.h> #include "config.h" #include "ukc.h" Index: exec_elf.c =================================================================== RCS file: /cvs/src/usr.sbin/config/exec_elf.c,v retrieving revision 1.12 diff -u -r1.12 exec_elf.c --- exec_elf.c 27 Oct 2009 23:59:51 -0000 1.12 +++ exec_elf.c 2 Oct 2011 14:32:27 -0000 @@ -24,16 +24,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/types.h> +#include <sys/exec.h> +#include <sys/exec_elf.h> + #include <err.h> #include <errno.h> #include <fcntl.h> #include <nlist.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> -#include <sys/exec.h> -#include <sys/exec_elf.h> -#include <sys/types.h> #include "ukc.h" #include "config.h" Index: files.c =================================================================== RCS file: /cvs/src/usr.sbin/config/files.c,v retrieving revision 1.17 diff -u -r1.17 files.c --- files.c 2 Jun 2010 20:42:17 -0000 1.17 +++ files.c 2 Oct 2011 14:32:27 -0000 @@ -42,10 +42,12 @@ */ #include <sys/param.h> + #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + #include "config.h" extern const char *yyfile; @@ -72,6 +74,10 @@ int (*)(const char *, void *), void *); static void expr_free(struct nvlist *); +#ifdef DEBUG +static void pr0(); +#endif + void initfiles(void) { @@ -453,8 +459,6 @@ void prexpr(struct nvlist *expr) { - static void pr0(); - printf("expr ="); pr0(expr); printf("\n"); Index: hash.c =================================================================== RCS file: /cvs/src/usr.sbin/config/hash.c,v retrieving revision 1.14 diff -u -r1.14 hash.c --- hash.c 4 Jan 2004 18:30:05 -0000 1.14 +++ hash.c 2 Oct 2011 14:32:27 -0000 @@ -42,8 +42,10 @@ */ #include <sys/param.h> + #include <stdlib.h> #include <string.h> + #include "config.h" /* Index: main.c =================================================================== RCS file: /cvs/src/usr.sbin/config/main.c,v retrieving revision 1.42 diff -u -r1.42 main.c --- main.c 15 Apr 2011 02:48:14 -0000 1.42 +++ main.c 2 Oct 2011 14:32:27 -0000 @@ -44,13 +44,15 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/param.h> + #include <ctype.h> +#include <err.h> #include <errno.h> #include <stdio.h> -#include <err.h> #include <stdlib.h> #include <string.h> #include <unistd.h> + #include "config.h" int firstfile(const char *); Index: misc.c =================================================================== RCS file: /cvs/src/usr.sbin/config/misc.c,v retrieving revision 1.8 diff -u -r1.8 misc.c --- misc.c 27 Oct 2009 23:59:51 -0000 1.8 +++ misc.c 2 Oct 2011 14:32:27 -0000 @@ -26,9 +26,10 @@ */ #include <sys/types.h> + +#include <ctype.h> #include <err.h> #include <stdio.h> -#include <ctype.h> #include <stdlib.h> #include <string.h> Index: mkheaders.c =================================================================== RCS file: /cvs/src/usr.sbin/config/mkheaders.c,v retrieving revision 1.18 diff -u -r1.18 mkheaders.c --- mkheaders.c 28 Jun 2003 04:55:07 -0000 1.18 +++ mkheaders.c 2 Oct 2011 14:32:27 -0000 @@ -42,11 +42,13 @@ */ #include <sys/param.h> + #include <ctype.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + #include "config.h" static int emitcnt(struct nvlist *); Index: mkioconf.c =================================================================== RCS file: /cvs/src/usr.sbin/config/mkioconf.c,v retrieving revision 1.30 diff -u -r1.30 mkioconf.c --- mkioconf.c 16 Jul 2011 11:34:43 -0000 1.30 +++ mkioconf.c 2 Oct 2011 14:32:27 -0000 @@ -42,10 +42,12 @@ */ #include <sys/param.h> + #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + #include "config.h" /* Index: mkmakefile.c =================================================================== RCS file: /cvs/src/usr.sbin/config/mkmakefile.c,v retrieving revision 1.35 diff -u -r1.35 mkmakefile.c --- mkmakefile.c 2 Jun 2010 20:42:17 -0000 1.35 +++ mkmakefile.c 2 Oct 2011 14:32:27 -0000 @@ -42,12 +42,14 @@ */ #include <sys/param.h> + #include <ctype.h> #include <err.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + #include "config.h" #include "sem.h" Index: mkswap.c =================================================================== RCS file: /cvs/src/usr.sbin/config/mkswap.c,v retrieving revision 1.12 diff -u -r1.12 mkswap.c --- mkswap.c 28 Jun 2003 04:55:07 -0000 1.12 +++ mkswap.c 2 Oct 2011 14:32:29 -0000 @@ -42,10 +42,12 @@ */ #include <sys/param.h> + #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + #include "config.h" #include "sem.h" Index: pack.c =================================================================== RCS file: /cvs/src/usr.sbin/config/pack.c,v retrieving revision 1.15 diff -u -r1.15 pack.c --- pack.c 4 Jan 2004 00:47:01 -0000 1.15 +++ pack.c 2 Oct 2011 14:32:29 -0000 @@ -42,8 +42,10 @@ */ #include <sys/param.h> + #include <stdlib.h> #include <string.h> + #include "config.h" /* Index: sem.c =================================================================== RCS file: /cvs/src/usr.sbin/config/sem.c,v retrieving revision 1.31 diff -u -r1.31 sem.c --- sem.c 24 Mar 2008 21:35:03 -0000 1.31 +++ sem.c 2 Oct 2011 14:32:29 -0000 @@ -42,11 +42,13 @@ */ #include <sys/param.h> + #include <ctype.h> +#include <err.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <err.h> + #include "config.h" #include "sem.h" Index: ukc.c =================================================================== RCS file: /cvs/src/usr.sbin/config/ukc.c,v retrieving revision 1.17 diff -u -r1.17 ukc.c --- ukc.c 2 Oct 2011 10:10:30 -0000 1.17 +++ ukc.c 2 Oct 2011 14:32:29 -0000 @@ -29,8 +29,8 @@ #include <sys/ioctl.h> #include <err.h> -#include <kvm.h> #include <fcntl.h> +#include <kvm.h> #include <limits.h> #include <nlist.h> #include <stdio.h> Index: ukcutil.c =================================================================== RCS file: /cvs/src/usr.sbin/config/ukcutil.c,v retrieving revision 1.19 diff -u -r1.19 ukcutil.c --- ukcutil.c 6 Apr 2011 11:36:26 -0000 1.19 +++ ukcutil.c 2 Oct 2011 14:32:29 -0000 @@ -27,6 +27,7 @@ #include <sys/types.h> #include <sys/time.h> #include <sys/device.h> + #include <limits.h> #include <nlist.h> #include <stdio.h> Index: util.c =================================================================== RCS file: /cvs/src/usr.sbin/config/util.c,v retrieving revision 1.12 diff -u -r1.12 util.c --- util.c 28 Jun 2003 04:55:07 -0000 1.12 +++ util.c 2 Oct 2011 14:32:29 -0000 @@ -42,11 +42,13 @@ */ #include <sys/types.h> + #include <ctype.h> +#include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <stdarg.h> + #include "config.h" static void nomem(void); -- Best Regards Edd Barrett http://www.theunixzoo.co.uk