This is kcl.c in view mode; [Download] [Up]
#define KCL_SELF "/usr2/kcl/attport/saved_kcl"
#define SYSTEM_DIRECTORY "/usr2/kcl/attport/"
#include <stdio.h>
#include <signal.h>
#define COMSIZ 1024
main()
{
int in[2];
int out[2];
char command[COMSIZ];
char buf[4];
pipe(in);
pipe(out);
if (in[1] != 4 || out[0] != 5) {
fprintf(stderr, "Can't get a pipe.\n");
exit(1);
}
fflush(stdout);
if (fork() != 0) {
close(in[0]);
close(out[1]);
if (execl(KCL_SELF, KCL_SELF, SYSTEM_DIRECTORY, 0) < 0) {
fprintf(stderr, "Can't exec KCL.\n");
exit(1);
}
}
signal(SIGINT, SIG_IGN);
close(in[1]);
close(out[0]);
for (;;) {
if (read(in[0], command, COMSIZ) <= 0)
exit(0);
buf[0] = system(command);
write(out[1], buf, 1);
}
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.