summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorcsgr <csgr@FreeBSD.org>1994-09-03 12:58:05 +0000
committercsgr <csgr@FreeBSD.org>1994-09-03 12:58:05 +0000
commit32502c48aad8341b13992889ed583c961971d8df (patch)
treeb638720b37859f97d4f9c1a5075ba748059a918c /usr.bin
parent2e1d38a646c7164135183d8142b880bd62d7946e (diff)
downloadFreeBSD-src-32502c48aad8341b13992889ed583c961971d8df.zip
FreeBSD-src-32502c48aad8341b13992889ed583c961971d8df.tar.gz
- Bring in -x option changes from 1.x
- eval -> err_val : slightly more meaningful (eval is what you do in Linda ;-)) Submitted by: Geoff.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/strip/strip.13
-rw-r--r--usr.bin/strip/strip.1aout3
-rw-r--r--usr.bin/strip/strip.c25
3 files changed, 25 insertions, 6 deletions
diff --git a/usr.bin/strip/strip.1 b/usr.bin/strip/strip.1
index b131004..f7af486 100644
--- a/usr.bin/strip/strip.1
+++ b/usr.bin/strip/strip.1
@@ -40,6 +40,7 @@
.Sh SYNOPSIS
.Nm strip
.Op Fl d
+.Op Fl x
.Ar file ...
.Sh DESCRIPTION
The
@@ -54,6 +55,8 @@ The options are as follows:
.Bl -tag -width Ds
.It Fl d
Delete only debugging and empty symbols.
+.It Fl x
+Delete only debugging, compiler identification, and local symbols.
.El
.Pp
.Nm Strip
diff --git a/usr.bin/strip/strip.1aout b/usr.bin/strip/strip.1aout
index b131004..f7af486 100644
--- a/usr.bin/strip/strip.1aout
+++ b/usr.bin/strip/strip.1aout
@@ -40,6 +40,7 @@
.Sh SYNOPSIS
.Nm strip
.Op Fl d
+.Op Fl x
.Ar file ...
.Sh DESCRIPTION
The
@@ -54,6 +55,8 @@ The options are as follows:
.Bl -tag -width Ds
.It Fl d
Delete only debugging and empty symbols.
+.It Fl x
+Delete only debugging, compiler identification, and local symbols.
.El
.Pp
.Nm Strip
diff --git a/usr.bin/strip/strip.c b/usr.bin/strip/strip.c
index 9de05f7..06b0134 100644
--- a/usr.bin/strip/strip.c
+++ b/usr.bin/strip/strip.c
@@ -38,7 +38,8 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)strip.c 8.1 (Berkeley) 6/6/93";
+/*static char sccsid[] = "@(#)strip.c 8.1 (Berkeley) 6/6/93";*/
+static char RCSid[] = "$Id$";
#endif /* not lint */
#include <sys/types.h>
@@ -64,7 +65,8 @@ void s_stab __P((const char *, int, EXEC *));
void s_sym __P((const char *, int, EXEC *));
void usage __P((void));
-int eval;
+int xflag = 0;
+int err_val = 0;
int
main(argc, argv)
@@ -78,8 +80,11 @@ main(argc, argv)
char *fn;
sfcn = s_sym;
- while ((ch = getopt(argc, argv, "d")) != EOF)
+ while ((ch = getopt(argc, argv, "dx")) != EOF)
switch(ch) {
+ case 'x':
+ xflag = 1;
+ /*FALLTHROUGH*/
case 'd':
sfcn = s_stab;
break;
@@ -90,7 +95,7 @@ main(argc, argv)
argc -= optind;
argv += optind;
- while (fn = *argv++) {
+ while ((fn = *argv++)) {
if ((fd = open(fn, O_RDWR)) < 0 ||
(nb = read(fd, &head, sizeof(EXEC))) == -1) {
err(0, "%s: %s", fn, strerror(errno));
@@ -104,7 +109,7 @@ main(argc, argv)
if (close(fd))
err(0, "%s: %s", fn, strerror(errno));
}
- exit(eval);
+ exit(err_val);
}
void
@@ -196,6 +201,14 @@ s_stab(fn, fd, ep)
*nsym = *sym;
nsym->strx = nstr - nstrbase;
p = strbase + sym->strx;
+ if(xflag &&
+ (!(sym->n_type & N_EXT) ||
+ (sym->n_type & ~N_EXT) == N_FN ||
+ strcmp(p, "gcc_compiled.") == 0 ||
+ strcmp(p, "gcc2_compiled.") == 0 ||
+ strcmp(p, "___gnu_compiled_c") == 0)) {
+ continue;
+ }
len = strlen(p) + 1;
bcopy(p, nstr, len);
nstr += len;
@@ -255,5 +268,5 @@ err(fatal, fmt, va_alist)
(void)fprintf(stderr, "\n");
if (fatal)
exit(1);
- eval = 1;
+ err_val = 1;
}
OpenPOWER on IntegriCloud