delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/29/13:15:05

To: dj AT ctron DOT com (DJ Delorie)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Utils in 1.12 broken??
Date: Mon, 29 Aug 94 17:19:43 +0200
From: eliz AT is DOT elta DOT co DOT il

DJ wrote:
>> 	1) STRINGS doesn't report anything when invoked on a
>> binary file (*.EXE) and exits almost immediately.  On text files
>> it works.  Could it be that it open()'s files not in O_BINARY mode?
>> (I didn't download bnuXXsr.zip yet.)
>
> strings reports the symbol table's strings.  If the binary is
> stripped, it won't report anything.  It's not the same as the unxi
> strings utility, and I almost didn't include it because of that.

Well, I finally got to check that.  It is NOT true.  There is a
single fopen() in strings.c which should be done in "rb" instead
of just "r".  After that, STRINGS happily prints all the strings,
especially if called with the -a switch.  Diffs are attached.

	Eli Zaretskii

- --------------- cut here ----------------------
*** orig/strings.c	Mon Feb  7 11:34:50 1994
- --- ./strings.c	Sun Aug 28 21:03:22 1994
*************** strings_file (file)
*** 300,306 ****
      {
        FILE *stream;
  
!       stream = fopen (file, "r");
        if (stream == NULL)
  	{
  	  fprintf (stderr, "%s: ", program_name);
- --- 300,306 ----
      {
        FILE *stream;
  
!       stream = fopen (file, "rb");
        if (stream == NULL)
  	{
  	  fprintf (stderr, "%s: ", program_name);

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019