Added option for temporary directory

This commit is contained in:
ceriel 1988-06-16 09:57:59 +00:00
parent dea600f9bf
commit 8f1cac51c8
2 changed files with 16 additions and 6 deletions
mach/proto/as

View file

@ -67,6 +67,13 @@ char **argv;
fatal("-o needs filename"); fatal("-o needs filename");
aoutpath = argv[i]; aoutpath = argv[i];
break; break;
case 'T':
if (*p != NULL) {
extern char *tmp_dir;
tmp_dir = p;
}
break;
case 'd': case 'd':
#ifdef LISTING #ifdef LISTING
dflag = 0; dflag = 0;

View file

@ -159,8 +159,10 @@ listline(textline)
putchar(c); putchar(c);
} while ((c = getc(listfile)) != '\n'); } while ((c = getc(listfile)) != '\n');
} }
if (listflag & 7) if (listflag & 7) {
putchar('\n'); putchar('\n');
fflush(stdout);
}
listeoln = 1; listeoln = 1;
listcolm = 0; listcolm = 0;
listflag = listtemp; listflag = listtemp;
@ -314,6 +316,11 @@ char *s;
return(f); return(f);
} }
#ifndef TMPDIR
#define TMPDIR "/tmp"
#endif
char *tmp_dir = TMPDIR;
FILE * FILE *
fftemp(path, tail) fftemp(path, tail)
char *path, *tail; char *path, *tail;
@ -321,11 +328,7 @@ char *path, *tail;
register char *dir; register char *dir;
if ((dir = getenv("TMPDIR")) == NULL) if ((dir = getenv("TMPDIR")) == NULL)
#ifdef TMPDIR dir = tmp_dir;
dir = TMPDIR;
#else
dir = "/tmp";
#endif
sprintf(path, "%s/%s", dir, tail); sprintf(path, "%s/%s", dir, tail);
return(ffcreat(mktemp(path))); return(ffcreat(mktemp(path)));
} }