summaryrefslogtreecommitdiff
path: root/src/icont/tunix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/icont/tunix.c')
-rw-r--r--src/icont/tunix.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/icont/tunix.c b/src/icont/tunix.c
index 9478403..e0388c1 100644
--- a/src/icont/tunix.c
+++ b/src/icont/tunix.c
@@ -103,20 +103,14 @@ int main(int argc, char *argv[]) {
iconxloc = "";
break;
case 'V': /* -V: print version information */
- fprintf(stderr, "%s (%s, %s)\n", Version, Config, __DATE__);
+ fprintf(stderr, "%s (%s %d/%d, %s)\n",
+ Version, Config, IntBits, WordBits, __DATE__);
if (optind == argc)
exit(0);
break;
case 'X': /* -X srcfile: execute single srcfile */
txrun(copyfile, optarg, &argv[optind]);
break; /*NOTREACHED*/
-
- #ifdef DeBugLinker
- case 'L': /* -L: enable linker debugging */
- Dflag = 1;
- break;
- #endif /* DeBugLinker */
-
default:
case 'x': /* -x illegal until after file list */
usage();
@@ -249,8 +243,10 @@ static void execute(char *ofile, char *efile, char *args[]) {
*/
if (efile != NULL) {
close(fileno(stderr));
- if (strcmp(efile, "-") == 0)
- dup(fileno(stdout));
+ if (strcmp(efile, "-") == 0) {
+ if (dup(fileno(stdout)) < 0)
+ quit("could not merge standard output with standard error\n");
+ }
else if (freopen(efile, "w", stderr) == NULL)
quitf("could not redirect stderr to %s\n", efile);
}
@@ -293,11 +289,7 @@ static char *libpath(char *prog, char *envname) {
s = getenv(envname);
if (s != NULL)
- #if CYGWIN
- cygwin_win32_to_posix_path_list(s, buf);
- #else /* CYGWIN */
- strcpy(buf, s);
- #endif /* CYGWIN */
+ strcpy(buf, s);
else
strcpy(buf, ".");
strcat(buf, ":");
@@ -323,21 +315,15 @@ static void txrun(char *(*func)(FILE*, char*), char *source, char *args[]) {
omask = umask(0077); /* remember umask; keep /tmp files private */
/*
- * Invent a file named /tmp/innnnnxx.icn.
+ * Create a temporary file named /tmp/innnnnxx.icn.
*/
srand(time(NULL));
c1 = abet[rand() % (sizeof(abet) - 1)];
c2 = abet[rand() % (sizeof(abet) - 1)];
sprintf(srcfile, "/tmp/i%d%c%c.icn", getpid(), c1, c2);
-
- /*
- * Copy the source code to the temporary file.
- */
f = fopen(srcfile, "w");
if (f == NULL)
quitf("cannot open for writing: %s", srcfile);
- progname = func(f, source);
- fclose(f);
/*
* Derive other names and arrange for cleanup on exit.
@@ -351,8 +337,10 @@ static void txrun(char *(*func)(FILE*, char*), char *source, char *args[]) {
atexit(cleanup);
/*
- * Translate to produce .u1 and .u2 files.
+ * Copy the source file, then translate to produce .u1 and .u2 files.
*/
+ progname = func(f, source);
+ fclose(f);
flist[0] = srcfile;
flist[1] = NULL;
if (trans(flist, SourceDir) > 0)