From db5c83c918c7dfd4c02b474749e4c879c5f93250 Mon Sep 17 00:00:00 2001 From: Arun Thomas Date: Thu, 21 Jul 2011 19:06:06 +0200 Subject: [PATCH] Remove strings(1) --- commands/Makefile | 2 +- commands/strings/Makefile | 4 -- commands/strings/strings.c | 139 ------------------------------------- man/man1/Makefile | 2 +- man/man1/strings.1 | 29 -------- 5 files changed, 2 insertions(+), 174 deletions(-) delete mode 100644 commands/strings/Makefile delete mode 100644 commands/strings/strings.c delete mode 100644 man/man1/strings.1 diff --git a/commands/Makefile b/commands/Makefile index 77616bf2a..72c92362e 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -25,7 +25,7 @@ SUBDIR= aal add_route adduser advent arp ash at autil awk \ ramdisk rarpd rawspeed rcp rdate readall readclock \ readfs reboot remsync rev rget rlogin rlogind rmdir \ rotate rsh rshd sed service setup shar acksize \ - sleep slip sort spell split srccrc strings ackstrip \ + sleep slip sort spell split srccrc ackstrip \ stty su sum svclog swapfs swifi sync synctree sysenv \ syslogd tail talk talkd tar tcpd tcpdp tcpstat tee telnet \ telnetd term termcap tget time tinyhalt top touch tr \ diff --git a/commands/strings/Makefile b/commands/strings/Makefile deleted file mode 100644 index 76ea92830..000000000 --- a/commands/strings/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -PROG= strings -MAN= - -.include diff --git a/commands/strings/strings.c b/commands/strings/strings.c deleted file mode 100644 index cf8a60af5..000000000 --- a/commands/strings/strings.c +++ /dev/null @@ -1,139 +0,0 @@ -/* strings - print ASCII strings in a file Author: Peter S. Housel */ - -/* - This is a version of the BSD "strings" program for Minix. It is used - to search a file for printable strings. To install, - - cc -o strings strings.c - chmem =8000 strings - -Command: strings - search file for printable strings -Syntax: strings [-] [-o] [-len] file ... -Flags: - Search the entire file. If this option is not given, only - the initialized data segment of files that appear to be - "a.out" format is searched. - -o Print the offset (in octal) with each string. - -len Use "len" as the minimum string length. The default is 4. - -Examples: strings core - strings -o a.out > str - -Strings searches the specified file(s) for printable ASCII strings (four -or more printable characters followed by a newline or a null) and writes -them to the standard output. This can be used to find out, for example, to -find out what program a "core" file came from, what kinds of error messages -are in an executable, or to see ASCII data hidden in a "binary" data file. - -P.S. The program doesn't use the "a.out.h" file posted last week by -Dick van Veen, both because it was written before then, and because -not everybody has a.out.h yet. Future revisions probably ought to, though. - -*/ - - - -#include -#include -#include -#include - -/* Minix (8086 version) dependant definitions */ -#define SMALLMAGIC 0x04100301L /* small model a.out magic number */ -#define SEPARATEMAGIC 0x04200301L /* separate instruction/data a.out */ - -#define HDR_MAGIC 0 /* 0'th long magic number */ -#define HDR_HSIZE 1 /* 1'st long size of header */ -#define HDR_TSIZE 2 /* 2'nd long size of text */ -#define HDR_DSIZE 3 /* 3'rd long size of init'ed data */ -#define HDR_BSIZE 4 /* 4'th long size of bss */ -#define HDR_TOTMEM 6 /* 6'th long total memory */ - -#define HDR_LEN 8 /* total length of header */ - -/* Miscellaneous definitions */ -#define STRLEN 4 /* default minimum string length */ -#define STRBUF 512 /* buffer length for strings */ - -_PROTOTYPE(int main, (int argc, char **argv)); -_PROTOTYPE(void strings, (char *filename)); -_PROTOTYPE(void usage, (void)); - -int strmin = STRLEN; /* minimum string length */ -int printoff = 0; /* print octal offset of each str */ -int objall = 0; /* search entire a.out file, not */ - -/* Just initialized data segment */ - -int main(argc, argv) -int argc; -char *argv[]; -{ - while ((++argv, --argc) && '-' == (*argv)[0]) { - if (!strcmp(*argv, "-")) - ++objall; - else if (!strcmp(*argv, "-o")) - ++printoff; - else if (isdigit((*argv)[1])) - strmin = atoi(&(*argv)[1]); - else - usage(); - } - - if (0 == argc) usage(); - while (argc--) strings(*argv++); - return(0); -} - -void strings(filename) -char *filename; -{ - char buf[STRBUF]; /* the strings buffer */ - char *bufptr; /* pointer into the strings buffer */ - FILE *input; /* input file */ - long header[HDR_LEN]; /* buffer for reading the header */ - long offset; /* file offset */ - long limit; /* limit, if doing data segment only */ - int c; /* input character */ - - if (NULL == (input = fopen(filename, "r"))) { - fprintf(stderr, "strings: "); - perror(filename); - exit(1); - } - if (HDR_LEN == fread(header, sizeof(long), (size_t)HDR_LEN, input) - && (SMALLMAGIC == header[HDR_MAGIC] - ||SEPARATEMAGIC == header[HDR_MAGIC]) && !objall) { - offset = header[HDR_HSIZE] + header[HDR_TSIZE]; /* object file */ - limit = offset + header[HDR_DSIZE]; - } else { - offset = 0L; - limit = 0L; - } - - fseek(input, offset, 0); - bufptr = buf; - - while (!limit || offset < limit) { - if (EOF == (c = getc(input))) break; - if ((('\0' == c || '\n' == c) && bufptr - buf >= strmin) - || (bufptr - buf == STRBUF - 1)) { - *bufptr = '\0'; - if (printoff) printf("%lo:", offset - (bufptr - buf)); - puts(buf); - bufptr = buf; - } else if ((' ' <= c && c < 0177) || '\t' == c) - *bufptr++ = c; - else - bufptr = buf; - - ++offset; - } - - fclose(input); -} - -void usage() -{ - fprintf(stderr, "usage: strings [-] [-o] [-num] file ...\n"); - exit(1); -} diff --git a/man/man1/Makefile b/man/man1/Makefile index 3a31e8e52..c2c8bfabd 100644 --- a/man/man1/Makefile +++ b/man/man1/Makefile @@ -18,7 +18,7 @@ MAN= acd.1 anm.1 ar.1 ash.1 asize.1 at.1 banner.1 basename.1 \ profile.1 ps.1 pwd.1 rcp.1 readall.1 readfs.1 recwave.1 \ ref.1 remsync.1 rget.1 rlogin.1 rmdir.1 rsh.1 rz.1 \ shar.1 acksize.1 sleep.1 sort.1 soundoff.1 soundon.1 spell.1 \ - split.1 strings.1 strip.1 stty.1 su.1 sum.1 svc.1 \ + split.1 strip.1 stty.1 su.1 sum.1 svc.1 \ synctree.1 sysenv.1 sz.1 tail.1 tee.1 telnet.1 template.1 \ term.1 termcap.1 tget.1 time.1 top.1 tr.1 true.1 \ truncate.1 tsort.1 tty.1 umount.1 uname.1 unexpand.1 uniq.1 \ diff --git a/man/man1/strings.1 b/man/man1/strings.1 deleted file mode 100644 index c972dffe3..000000000 --- a/man/man1/strings.1 +++ /dev/null @@ -1,29 +0,0 @@ -.TH STRINGS 1 -.SH NAME -strings \- print all the strings in a binary file -.SH SYNOPSIS -\fBstrings\fR [\fB\-\fR] [\fB\-o\fR]\fR [\fB\-\fIn\fR] \fIfile ...\fR -.br -.de FL -.TP -\\fB\\$1\\fR -\\$2 -.. -.de EX -.TP 20 -\\fB\\$1\\fR -# \\$2 -.. -.SH OPTIONS -.FL "\-" "search whole file, not just data seg" -.FL "\-o" "Print octal offset of each string" -.FL "\-\fIn" "\fIn\fR is minimum length string (default = 4)" -.SH EXAMPLES -.EX "strings \-5 a.out" "Print the strings > 4 chars in \fIa.out\fR" -.EX "strings \- /bin/sh" "Search entire shell file (text and data)" -.SH DESCRIPTION -.PP -\fIStrings\fR looks for sequences of ASCII characters followed by a zero -byte. -These are usually strings. This program is typically used to help identify -unknown binary programs -- 2.44.0