Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site voder.UUCP
Path: utzoo!watmath!clyde!bonnie!akgua!sdcsvax!sdcrdcf!trwrb!scgvaxd!wlbr!voder!jeff
From: jeff@voder.UUCP (Jeff Gilliam)
Newsgroups: net.bugs.4bsd
Subject: minor bug in strings
Message-ID: <473@voder.UUCP>
Date: Thu, 18-Oct-84 19:49:55 EDT
Article-I.D.: voder.473
Posted: Thu Oct 18 19:49:55 1984
Date-Received: Sun, 21-Oct-84 14:19:30 EDT
Distribution: net
Organization: National Semiconductor, Santa Clara
Lines: 54

Subject: minor bug in strings
Index: 	ucb/strings.c 4.[12]BSD	Fix

Description:
	Strings has a minor bug which causes it to ignore the first 32
	bytes of the data segment when run on and executable file and
	*not* given the '-' flag.

Repeat-By:
	Try 'strings /usr/ucb/strings'.  You'll see output beginning
	with:

	>>>	eley) 3/30/83
		Usage: strings [ -a ] [ -o ] [ -# ] [ file ... ]
		%7D 
		.
		.
		.

	Pretty clearly it is missing something at the very beginning.
Fix:
	The fix is trivial; an fseek incorrectly seeks from the current
	position when it *should* seek from the beginning of the file.
	Contextual diffs follow:

	RCS file: /usr/src/ucb/RCS/strings.c,v
	retrieving revision 1.1
	retrieving revision 1.2
	diff -c -r1.1 -r1.2
	*** /tmp/,RCSt1023819	Thu Oct 11 21:59:20 1984
	--- /tmp/,RCSt2023819	Thu Oct 11 21:59:21 1984
	***************
	*** 67,73
				find((long) 100000000L);
				continue;
			}
	! 		fseek(stdin, (long) N_TXTOFF(header)+header.a_text, 1);
			find((long) header.a_data);
		} while (argc > 0);
	  }

	--- 67,73 -----
				find((long) 100000000L);
				continue;
			}
	! 		fseek(stdin, (long) N_TXTOFF(header)+header.a_text, 0);
			find((long) header.a_data);
		} while (argc > 0);
	  }


-- 

Jeff Gilliam	{ucbvax,ihnp4!nsc}!voder!jeff