Several fixes; ported to Solaris 2

This commit is contained in:
ceriel 1993-10-06 11:45:13 +00:00
parent 4092904071
commit 2233b6973b
3 changed files with 9 additions and 10 deletions

View file

@ -110,7 +110,7 @@ argument(arg) char *arg; {
return;
}
curfile = arg; /* for error messages etc. */
if ((ifile = fopen(arg,"r")) == NULL) {
if ((ifile = fopen(arg,"r")) == 0) {
error("can't open %s",arg);
return;
}

View file

@ -74,9 +74,9 @@ FILE *frewind(f) FILE *f ; {
/* Rewind a file open for writing and open it for reading */
/* Assumption, file descriptor is r/w */
register FILE *tmp ;
rewind(f);
tmp=fdopen(dup(fileno(f)),"r");
fclose(f);
rewind(tmp);
return tmp ;
}
#endif
@ -377,7 +377,7 @@ setmode(mode) {
#ifndef CPM
int tmpfil() {
register char *fname, *cpname ;
char *sfname;
static char sfname[] = "tmp.00000";
register fildes,pid;
static char name[80] = TMP_DIR ;
int count;
@ -387,10 +387,9 @@ int tmpfil() {
* After closing the tmpfil-descriptor the file is lost
* Calling this routine frees the program from generating uniqe names.
*/
sfname = fname = "tmp.00000";
fname = sfname+4;
count = 10;
pid = getpid();
fname += 4;
while (pid!=0) {
*fname++ = (pid&07) + '0';
pid >>= 3;

View file

@ -116,11 +116,11 @@ copyout() {
remtext = textbytes%wordsize ;
if ( remtext != 0 ) remtext = wordsize-remtext ;
if ((ifile = fopen(eout,"w")) == NULL )
if ((ifile = fopen(eout,"w")) == 0 )
fatal("can't create e.out");
#ifdef CPM
fclose(tfile); tfile=fopen("TFILE.$$$, "r");
fclose(dfile); dfile=fopen("DFILE.$$$, "r");
fclose(tfile); tfile=fopen("TFILE.$$$", "r");
fclose(dfile); dfile=fopen("DFILE.$$$", "r");
#else
tfile=frewind(tfile);
dfile=frewind(dfile);
@ -160,7 +160,7 @@ dataprocess(f1,f2) FILE *f1,*f2; {
register ieof ;
#ifdef CPM
fclose(rdfile); rdfile=fopen("RDFILE.$$$, "r");
fclose(rdfile); rdfile=fopen("RDFILE.$$$", "r");
#else
rdfile=frewind(rdfile) ;
#endif
@ -210,7 +210,7 @@ textprocess(f1,f2) FILE *f1,*f2; {
register FOFFSET keep ;
#ifdef CPM
fclose(rtfile); rtfile=fopen("RTFILE.$$$, "r");
fclose(rtfile); rtfile=fopen("RTFILE.$$$", "r");
#else
rtfile=frewind(rtfile) ;
#endif