X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/7cddb6ac8aff7c95df09f5d0baee6444cc26d829..4b9ccde74dc34e450ed96bcd3d044f78cf393d8d:/usr/src/cmd/strings.c diff --git a/usr/src/cmd/strings.c b/usr/src/cmd/strings.c index 9bb8c26188..a3f494487b 100644 --- a/usr/src/cmd/strings.c +++ b/usr/src/cmd/strings.c @@ -1,3 +1,4 @@ +static char *sccsid = "@(#)strings.c 4.1 (Berkeley) 10/1/80"; #include #include #include @@ -5,15 +6,7 @@ long ftell(); /* - * Strings - extract strings from an object file for whatever - * - * Bill Joy UCB - * April 22, 1978 - * - * The algorithm is to look for sequences of "non-junk" characters - * The variable "minlen" is the minimum length string printed. - * This helps get rid of garbage. - * Default minimum string length is 4 characters. + * strings */ struct exec header; @@ -46,7 +39,7 @@ main(argc, argv) default: if (!isdigit(argv[0][i])) { - fprintf(stderr, "Usage: strings [ - ] [ -o ] [ -# ] [ file ... ]\n"); + fprintf(stderr, "Usage: strings [ -a ] [ -o ] [ -# ] [ file ... ]\n"); exit(1); } minlength = argv[0][i] - '0'; @@ -69,12 +62,12 @@ main(argc, argv) fseek(stdin, (long) 0, 0); if (asdata || fread((char *)&header, sizeof header, 1, stdin) != 1 || - !ismagic(header.a_magic)) { + N_BADMAG(header)) { fseek(stdin, (long) 0, 0); find((long) 100000000L); continue; } - fseek(stdin, (long) header.a_text, 1); + fseek(stdin, (long) N_TXTOFF(header)+header.a_text, 1); find((long) header.a_data); } while (argc > 0); } @@ -126,18 +119,3 @@ dirt(c) return (c > 0200 || c < ' '); } } - -ismagic(a) - int a; -{ - - switch (a) { - - case A_MAGIC1: - case A_MAGIC2: - case A_MAGIC3: - case A_MAGIC4: - return (1); - } - return (0); -}