diff options
-rw-r--r-- | distrib/crunch/Makefile | 4 | ||||
-rw-r--r-- | distrib/crunch/Makefile.inc | 5 | ||||
-rw-r--r-- | distrib/crunch/crunchgen/Makefile | 12 | ||||
-rw-r--r-- | distrib/crunch/crunchide/Makefile | 6 | ||||
-rw-r--r-- | usr.sbin/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/crunchgen/Makefile | 15 | ||||
-rw-r--r-- | usr.sbin/crunchgen/README (renamed from distrib/crunch/README) | 0 | ||||
-rw-r--r-- | usr.sbin/crunchgen/crunched_main.c (renamed from distrib/crunch/crunchgen/crunched_main.c) | 2 | ||||
-rw-r--r-- | usr.sbin/crunchgen/crunchgen.1 (renamed from distrib/crunch/crunchgen/crunchgen.1) | 4 | ||||
-rw-r--r-- | usr.sbin/crunchgen/crunchgen.c (renamed from distrib/crunch/crunchgen/crunchgen.c) | 16 | ||||
-rw-r--r-- | usr.sbin/crunchgen/crunchide.1 (renamed from distrib/crunch/crunchide/crunchide.1) | 4 | ||||
-rw-r--r-- | usr.sbin/crunchgen/crunchide.c (renamed from distrib/crunch/crunchide/crunchide.c) | 34 | ||||
-rw-r--r-- | usr.sbin/crunchgen/ecoff_hide.c (renamed from distrib/crunch/crunchide/ecoff_hide.c) | 2 | ||||
-rw-r--r-- | usr.sbin/crunchgen/elf_hide.c (renamed from distrib/crunch/crunchide/elf_hide.c) | 13 | ||||
-rw-r--r-- | usr.sbin/crunchgen/mkskel.sh (renamed from distrib/crunch/crunchgen/mkskel.sh) | 2 |
15 files changed, 60 insertions, 63 deletions
diff --git a/distrib/crunch/Makefile b/distrib/crunch/Makefile index 587c9f117dd..d10d0e0cecb 100644 --- a/distrib/crunch/Makefile +++ b/distrib/crunch/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.3 2003/03/02 12:32:08 deraadt Exp $ +# $OpenBSD: Makefile,v 1.4 2008/08/22 15:18:55 deraadt Exp $ -SUBDIR=crunchgen crunchide ../sparc64/mksuncd +SUBDIR= ../sparc64/mksuncd .include <bsd.subdir.mk> diff --git a/distrib/crunch/Makefile.inc b/distrib/crunch/Makefile.inc deleted file mode 100644 index aaa06e1075f..00000000000 --- a/distrib/crunch/Makefile.inc +++ /dev/null @@ -1,5 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.3 2001/01/29 01:19:21 deraadt Exp $ - -# modify to taste -DESTDIR= -BINDIR?= /usr/bin diff --git a/distrib/crunch/crunchgen/Makefile b/distrib/crunch/crunchgen/Makefile deleted file mode 100644 index 23625f09b60..00000000000 --- a/distrib/crunch/crunchgen/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $OpenBSD: Makefile,v 1.2 1996/09/25 06:40:52 etheisen Exp $ - -PROG= crunchgen -SRCS= crunchgen.c crunched_skel.c -CFLAGS+= -g -Wall -CPPFLAGS+= -DMF_NAMES='"Makefile.bsd-wrapper","Makefile"' -CLEANFILES+= crunched_skel.c - -crunched_skel.c: crunched_main.c - sh ${.CURDIR}/mkskel.sh ${.CURDIR}/crunched_main.c > crunched_skel.c - -.include <bsd.prog.mk> diff --git a/distrib/crunch/crunchide/Makefile b/distrib/crunch/crunchide/Makefile deleted file mode 100644 index 430fee355f3..00000000000 --- a/distrib/crunch/crunchide/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# $OpenBSD: Makefile,v 1.4 2000/03/01 22:10:03 todd Exp $ - -PROG= crunchide -SRCS= crunchide.c elf_hide.c ecoff_hide.c - -.include <bsd.prog.mk> diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index a1113306f4a..af9a155f31b 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.142 2008/06/15 04:44:30 sturm Exp $ +# $OpenBSD: Makefile,v 1.143 2008/08/22 15:18:54 deraadt Exp $ .include <bsd.own.mk> SUBDIR= ac accton acpidump adduser amd apm apmd arp \ - authpf bgpctl bgpd bind chroot config cron dev_mkdb \ + authpf bgpctl bgpd bind chroot config cron crunchgen dev_mkdb \ dhcpd dhcrelay dvmrpctl dvmrpd edquota eeprom faithd fdformat \ ftp-proxy gpioctl hostapd hotplugd httpd ifstated inetd iostat \ kgmon kvm_mkdb lpr mailwrapper map-mbone memconfig mopd mrinfo \ diff --git a/usr.sbin/crunchgen/Makefile b/usr.sbin/crunchgen/Makefile new file mode 100644 index 00000000000..314174f33ba --- /dev/null +++ b/usr.sbin/crunchgen/Makefile @@ -0,0 +1,15 @@ +# $OpenBSD: Makefile,v 1.1 2008/08/22 15:18:55 deraadt Exp $ + +PROG= crunchgen +MAN= crunchgen.1 crunchide.1 +SRCS= crunchgen.c crunched_skel.c \ + crunchide.c elf_hide.c ecoff_hide.c +CFLAGS+= -g -Wall +CLEANFILES+= crunched_skel.c + +crunched_skel.c: crunched_main.c + sh ${.CURDIR}/mkskel.sh ${.CURDIR}/crunched_main.c > crunched_skel.c + +LINKS= ${BINDIR}/crunchgen ${BINDIR}/crunchide + +.include <bsd.prog.mk> diff --git a/distrib/crunch/README b/usr.sbin/crunchgen/README index 6b150b57225..6b150b57225 100644 --- a/distrib/crunch/README +++ b/usr.sbin/crunchgen/README diff --git a/distrib/crunch/crunchgen/crunched_main.c b/usr.sbin/crunchgen/crunched_main.c index 315a44d5065..c0a7827f66f 100644 --- a/distrib/crunch/crunchgen/crunched_main.c +++ b/usr.sbin/crunchgen/crunched_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crunched_main.c,v 1.5 2003/01/27 19:41:30 deraadt Exp $ */ +/* $OpenBSD: crunched_main.c,v 1.1 2008/08/22 15:18:55 deraadt Exp $ */ /* * Copyright (c) 1994 University of Maryland diff --git a/distrib/crunch/crunchgen/crunchgen.1 b/usr.sbin/crunchgen/crunchgen.1 index 8c23ee1a1fd..11237841ffc 100644 --- a/distrib/crunch/crunchgen/crunchgen.1 +++ b/usr.sbin/crunchgen/crunchgen.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: crunchgen.1,v 1.21 2007/05/31 19:19:15 jmc Exp $ +.\" $OpenBSD: crunchgen.1,v 1.1 2008/08/22 15:18:55 deraadt Exp $ .\" .\" .\" Copyright (c) 1994 University of Maryland @@ -25,7 +25,7 @@ .\" Computer Science Department .\" University of Maryland at College Park .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: August 22 2008 $ .Dt CRUNCHGEN 1 .Os .Sh NAME diff --git a/distrib/crunch/crunchgen/crunchgen.c b/usr.sbin/crunchgen/crunchgen.c index 7829fdd0228..7a4c6983b21 100644 --- a/distrib/crunch/crunchgen/crunchgen.c +++ b/usr.sbin/crunchgen/crunchgen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crunchgen.c,v 1.28 2006/12/26 10:20:11 deraadt Exp $ */ +/* $OpenBSD: crunchgen.c,v 1.1 2008/08/22 15:18:55 deraadt Exp $ */ /* * Copyright (c) 1994 University of Maryland @@ -53,12 +53,9 @@ * name on any given platform. Make sure * default name is last though. */ -char *mf_name[] = { -#if defined(MF_NAMES) - MF_NAMES, -#else +char *mf_name[] = { + "Makefile.bsd-wrapper", "Makefile", -#endif NULL }; @@ -111,13 +108,15 @@ void usage(void); void parse_conf_file(void); void gen_outputs(void); +extern int crunchide_main(int, char *[]); + int main(int argc, char *argv[]) { char *p; int optc; extern int optind; - extern char *optarg; + extern char *optarg, *__progname; verbose = 1; readcache = 1; @@ -126,6 +125,9 @@ main(int argc, char *argv[]) if (argc > 0) progname = argv[0]; + if (strcmp(__progname, "crunchide") == 0) + return (crunchide_main(argc, argv)); + while ((optc = getopt(argc, argv, "m:c:e:fqD:EL:O:")) != -1) { switch (optc) { case 'f': diff --git a/distrib/crunch/crunchide/crunchide.1 b/usr.sbin/crunchgen/crunchide.1 index 6d4af9b14cb..2f9b4082dc7 100644 --- a/distrib/crunch/crunchide/crunchide.1 +++ b/usr.sbin/crunchgen/crunchide.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: crunchide.1,v 1.9 2007/05/31 19:19:16 jmc Exp $ +.\" $OpenBSD: crunchide.1,v 1.1 2008/08/22 15:18:55 deraadt Exp $ .\" .\" .\" Copyright (c) 1994 University of Maryland @@ -25,7 +25,7 @@ .\" Computer Science Department .\" University of Maryland at College Park .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: August 22 2008 $ .Dt CRUNCHIDE 1 .Os .Sh NAME diff --git a/distrib/crunch/crunchide/crunchide.c b/usr.sbin/crunchgen/crunchide.c index a8fd55be1cd..3c74a0da7bb 100644 --- a/distrib/crunch/crunchide/crunchide.c +++ b/usr.sbin/crunchgen/crunchide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crunchide.c,v 1.22 2007/02/18 23:50:46 ray Exp $ */ +/* $OpenBSD: crunchide.c,v 1.1 2008/08/22 15:18:55 deraadt Exp $ */ /* * Copyright (c) 1994 University of Maryland @@ -79,9 +79,7 @@ #define DO_AOUT #endif -char *pname = "crunchide"; - -void usage(void); +void crunchide_usage(void); void add_to_keep_list(char *); void add_file_to_keep_list(char *); @@ -94,14 +92,13 @@ void ecoff_hide(int, char *); void elf_hide(int, char *); #endif +extern char *__progname; + int -main(int argc, char *argv[]) +crunchide_main(int argc, char *argv[]) { int ch; - if (argc > 0) - pname = argv[0]; - while ((ch = getopt(argc, argv, "k:f:")) != -1) switch (ch) { case 'k': @@ -111,14 +108,14 @@ main(int argc, char *argv[]) add_file_to_keep_list(optarg); break; default: - usage(); + crunchide_usage(); } argc -= optind; argv += optind; if (argc == 0) - usage(); + crunchide_usage(); while (argc) { hide_syms(*argv); @@ -130,11 +127,10 @@ main(int argc, char *argv[]) } void -usage(void) +crunchide_usage(void) { fprintf(stderr, - "usage: %s [-f keep-list-file] [-k keep-symbol] object-file ...\n", - pname); + "usage: crunchide [-f keep-list-file] [-k keep-symbol] object-file ...\n"); exit(1); } @@ -160,7 +156,7 @@ add_to_keep_list(char *symbol) if (newp) newp->sym = strdup(symbol); if (newp == NULL || newp->sym == NULL) { - fprintf(stderr, "%s: out of memory for keep list\n", pname); + fprintf(stderr, "%s: out of memory for keep list\n", __progname); exit(1); } newp->next = curp; @@ -174,7 +170,7 @@ int in_keep_list(char *symbol) { struct keep *curp; - int cmp; + int cmp = 0; for (curp = keep_list; curp; curp = curp->next) if ((cmp = strcmp(symbol, curp->sym)) <= 0) @@ -192,7 +188,7 @@ add_file_to_keep_list(char *filename) if ((keepf = fopen(filename, "r")) == NULL) { perror(filename); - usage(); + crunchide_usage(); } while (fgets(symbol, sizeof(symbol), keepf)) { len = strlen(symbol); @@ -235,12 +231,14 @@ void check_reloc(char *filename, struct relocation_info * relp); void hide_syms(char *filename) { - int inf, outf, rc; + int inf; struct stat infstat; +#ifdef DO_AOUT struct relocation_info *relp; struct nlist *symp; - char *buf; u_char zero = 0; +#endif + char *buf; /* * Open the file and do some error checking. diff --git a/distrib/crunch/crunchide/ecoff_hide.c b/usr.sbin/crunchgen/ecoff_hide.c index c3b7c1fbc1f..e21383cf9e8 100644 --- a/distrib/crunch/crunchide/ecoff_hide.c +++ b/usr.sbin/crunchgen/ecoff_hide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecoff_hide.c,v 1.3 2003/06/03 21:08:59 deraadt Exp $ */ +/* $OpenBSD: ecoff_hide.c,v 1.1 2008/08/22 15:18:55 deraadt Exp $ */ /*- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. diff --git a/distrib/crunch/crunchide/elf_hide.c b/usr.sbin/crunchgen/elf_hide.c index a63702bd13a..b52a7757b07 100644 --- a/distrib/crunch/crunchide/elf_hide.c +++ b/usr.sbin/crunchgen/elf_hide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elf_hide.c,v 1.12 2007/08/14 20:43:10 miod Exp $ */ +/* $OpenBSD: elf_hide.c,v 1.1 2008/08/22 15:18:55 deraadt Exp $ */ /* * Copyright (c) 1997 Dale Rahn. @@ -64,10 +64,12 @@ char *pexe; void elf_hide(int pfile, char *p) { - int i; Elf_Ehdr *pehdr; +#ifdef DEBUG Elf_Shdr *pshdr; Elf_Phdr *pphdr; + int i; +#endif struct stat sb; pexe = p; @@ -179,9 +181,11 @@ load_symtab(Elf_Ehdr * pehdr, char *pexe) Elf_Sym *symtab; Elf_Shdr *symsect; int symtabsize; - Elf_Shdr *pshdr; Elf_Shdr *psymshdr; + Elf_Shdr *pshdr; +#ifdef DEBUG char *shname; +#endif int i; symtab = NULL; @@ -235,7 +239,7 @@ int strtabsize; void load_strtab(Elf_Ehdr * pehdr, char *pexe) { - Elf_Shdr *pshdr; + Elf_Shdr *pshdr = NULL; char *shname; int i; strtab = NULL; @@ -280,6 +284,7 @@ dump_strtab() } +void fprint_str(FILE * channel, int indx) { if (strtab != NULL) diff --git a/distrib/crunch/crunchgen/mkskel.sh b/usr.sbin/crunchgen/mkskel.sh index 676705bbb79..9faa6e9acc9 100644 --- a/distrib/crunch/crunchgen/mkskel.sh +++ b/usr.sbin/crunchgen/mkskel.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $OpenBSD: mkskel.sh,v 1.2 2000/03/01 22:10:03 todd Exp $ +# $OpenBSD: mkskel.sh,v 1.1 2008/08/22 15:18:55 deraadt Exp $ # idea and sed lines taken straight from flex |