[comp.bugs.misc] shar2 on Ultrix

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (05/17/88)

I recently tried my "shar2" program on Ultrix and found a funny in the
code for fopen. The fopen on Ultrix rejects the ANSI "open for read
binary" ("rb") mode. All other BSD based compiler on which I tried it
either implemented it or ignored it, Convex, Alliant, Sun, and Encore.

Here than is the fix. It should work on ANSI compliant and Ultrix
compilers. My apologies to anyone who was bitten by this, I have access
to Ultrix, but considered that BSD was BSD the world over.

================ upgrade context diff, v1.22 to 1.23 ================

74c74
<              "@(#)cshar, sixhub version 1.22, last change 5/2/88";
---
>              "@(#)cshar, sixhub version 1.23, last change 5/16/88";
286c286
<     fprintf (outfile, "# %s:	Shell Archiver  (v1.22)\n", SHAR);
---
>     fprintf (outfile, "# %s:	Shell Archiver  (v1.23)\n", SHAR);
380a381,394
> 	    /*
> 	     *  This is for systems which don't have ANSI style fopen
> 	     *  in binary mode, and don't ignore the flag. The only one
> 	     *  I've seen is Ultrix
> 	     */
> 	    if (ioptr == NULL)
> 	    { /* retry the open, hope default is binary */
> 	        ioptr = fopen (file, "r");
> 		if (ioptr == NULL)
> 		{ /* some system problem */
> 		    fprintf (stderr, "Can't open file %s\n", file);
> 		    exit (1);
> 		}
> 	    }

-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me

news@oberon.USC.EDU (USENET News) (05/19/88)

From: tdiallo@sabik.usc.edu (Thiermo A. Diallo)
Path: sabik.usc.edu!tdiallo