|
|
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 x
Length: 1736 (0x6c8)
Types: TextFile
Names: »xinit.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦526ad3590⟧ »EUUGD11/gnu-31mar87/X.V10.R4.tar.Z«
└─⟦2109abc41⟧
└─⟦this⟧ »./X.V10R4/xinit/xinit.c«
#ifndef lint
static char *rcsid_xinit_c = "$Header: xinit.c,v 10.3 86/02/01 16:24:54 tony Rel $";
#endif lint
#include <X/mit-copyright.h>
/* Copyright Massachusetts Institute of Technology 1986 */
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#define default_server "X"
#define default_display "0"
char *default_client[] = {"xterm", "=+1+1", "-n", "login",
#ifdef sun
"-C",
#endif
"unix:0", NULL};
char *server[100];
char *client[100];
main(argc, argv)
int argc;
register char **argv;
{
register char **sptr = server;
register char **cptr = client;
register char **ptr;
int serverpid, clientpid, pid;
argv++;
argc--;
if (argc == 0 || (**argv != '/' && !isalpha(**argv)))
for (ptr = default_client; *ptr; )
*cptr++ = *ptr++;
while (argc && strcmp(*argv, "--")) {
*cptr++ = *argv++;
argc--;
}
*cptr = NULL;
if (argc) {
argv++;
argc--;
}
if (argc == 0 || (**argv != '/' && !isalpha(**argv))) {
*sptr++ = default_server;
if (argc == 0 || !isdigit(**argv))
*sptr++ = default_display;
}
while (--argc >= 0)
*sptr++ = *argv++;
*sptr++ = "0";
*sptr = NULL;
if ((serverpid = fork()) == 0) {
close(0);
close(1);
execvp(server[0], server);
perror(server[0]);
exit(1);
}
if (serverpid < 0) {
perror(server[0]);
exit(1);
}
sleep(5);
if ((clientpid = fork()) == 0) {
execvp(client[0], client);
perror(client[0]);
exit(1);
}
if (clientpid < 0) {
kill(serverpid, SIGKILL);
perror(client[0]);
exit(1);
}
while (((pid = wait(NULL)) != clientpid) && (pid != serverpid)) ;
kill(clientpid, SIGKILL);
if (!kill(serverpid, SIGHUP)) {
sleep(1);
kill(serverpid, SIGKILL);
}
}