Path: utzoo!censor!geac!jtsv16!uunet!cs.utexas.edu!usc!bloom-beacon!HELIOS.EE.LBL.GOV!jef From: jef@HELIOS.EE.LBL.GOV (Jef Poskanzer) Newsgroups: comp.windows.x Subject: Re: XReadBitmapFile Message-ID: <8908021859.AA08370@helios.ee.lbl.gov> Date: 2 Aug 89 18:59:50 GMT References: <8908021356.AA23833@expo.lcs.mit.edu> Reply-To: Jef Poskanzer Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal Lines: 39 In the referenced message, jim@EXPO.LCS.MIT.EDU (Jim Fulton) wrote: }It's fairly simple to hack lib/Xmu/RdBitF.c to have a routine like the }following and then make XmuReadBitmapDataFromFile call it: } int XmuReadBitmapData (fstream, width, height, datap, x_hot, y_hot) What's wrong with the following (with the analogous change made to lib/X/XRdBitF.c): *** /tmp/,RCSt1a08334 Wed Aug 2 11:55:29 1989 --- RdBitF.c Wed Aug 2 11:54:32 1989 *************** *** 135,146 **** /* first time initialization */ if (initialized == False) initHexTable(); ! if ((fstream = fopen(filename, "r")) == NULL) { ! return BitmapOpenFailed; ! } /* error cleanup and return macro */ ! #define RETURN(code) { if (data) free (data); fclose (fstream); return code; } while (fgets(line, MAX_SIZE, fstream)) { if (strlen(line) == MAX_SIZE-1) { --- 135,148 ---- /* first time initialization */ if (initialized == False) initHexTable(); ! if (!strcmp("-", filename)) ! fstream = stdin; ! else ! if ((fstream = fopen(filename, "r")) == NULL) ! return BitmapOpenFailed; /* error cleanup and return macro */ ! #define RETURN(code) { if (data) free (data); if (fstream != stdin) fclose (fstream); return code; } while (fgets(line, MAX_SIZE, fstream)) { if (strlen(line) == MAX_SIZE-1) {