|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 1490 (0x5d2)
Types: TextFile
Names: »schloader.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/gnu-31mar87/scheme/schloader.c«
#include <stdio.h>
#define SCHEME_VERSION "/u1/scheme/scheme_version"
#define OPEN_FOR_READING "r"
#define STRING_SIZE 255
#define output_string(string) \
{ putc(' ', stdout); \
fputs(string, stdout); \
}
int get_string(dest, max, file)
char *dest;
int max;
FILE *file;
{ char *sfree, c;
int limit = max-1;
int i = 0;
sfree = dest;
while((i < limit) && ((c = getc(file)) != EOF) && (c != '\n'))
{ *sfree++ = c;
i+=1;
}
while ((c != EOF) && (c != '\n')) c = getc(file);
*sfree = '\0';
return i;
}
main(argc, argv, envp)
int argc;
char *argv[], *envp[];
{ char microcode_name[STRING_SIZE], band_name[STRING_SIZE];
int i;
FILE *fopen(), *fp;
/* Find the name of the Scheme microcode */
fp = fopen(SCHEME_VERSION, OPEN_FOR_READING);
if (fp == NULL)
{ printf("Can not find the Scheme description file in %s\n", SCHEME_VERSION);
exit(1);
}
get_string(microcode_name, STRING_SIZE, fp);
get_string(band_name, STRING_SIZE, fp);
fclose(fp);
/* Print the command line and invoke Scheme */
fputs(microcode_name, stdout);
if (argc <= 1)
{ output_string(band_name);
putc('\n', stdout);
execle(microcode_name, microcode_name, band_name, 0, &envp[0]);
}
else
{ for(i = 1; i < argc; i++) output_string(argv[i]);
putc('\n', stdout);
execvp(microcode_name, &argv[0], &envp[0]);
}
/* We can only ge here if the exec call fails! */
printf("Can not invoke the Scheme microcode in %s\n", microcode_name);
exit(1);
}