IMD 1.17: 19/01/2010 21:08:11 ham stuff for 4400 5-29-87 Ham stuff for 4400 ,(UniFLEX BackupperLocal: local.r $(HAM) errors.r support.r pegExtra.r $(FILES) cc local.r $(HAM) errors.r support.r pegExtra.r \ $(FILES) +o=hyperLocal +l=netlib +x=b=8M hyperLocal.nonet: $(HAM) errors.r $(FILES) local.nonet.r support.nonet.r \ pegExtra.nonet.r cc local.nonet.r $(HAM) errors.r support.nonet.r pegExtra.nonet.r \ $(FILES) +o=hyperLocal.nonet +x=b=8M hyperRemote: remote.r $(SUPPORT) cc remote.r $(SUPPORT) +o=hyperRemote +l=netlib hyperDS: ham_main.r $(HAM) $(SUPPORT) $(FILES) cc ham_main.r $(H jTektronix 44002  !"#$%&'()*+,-./01234('&%$#"! AM) $(SUPPORT) \ $(FILES) +o=hyperDS +l=netlib +x=b=8M mhtoh: hlex.r $(HAM) errors.r support.nonet.r pegExtra.nonet.r \ lexExtra.r $(FILES) cc hlex.r $(HAM) errors.r support.nonet.r \ $(FILES) pegExtra.nonet.r lexExtra.r +o=mhtoh +x=b=8M mhtoh2: hyper.r $(HAM) errors.r support.nonet.r pegExtra.nonet.r $(FILES) cc hyper.r $(HAM) errors.r support.nonet.r \ $(FILES) pegExtra.nonet.r +o=mhtoh2 +x=b=8M mstomh: mslex.r lexExtra.r cc mslex.r lexExtra.r +o=mstomh hyperMove: hyperMove.r cc hyperMove.r ' ( .Makefile.ʌ(SҔ$ Ҩ$Ұ-z $ՀR>LHam stuff fo$BX+o=hyperMove +l=netlib pegExtra.nonet.c: pegExtra.c copy pegExtra.c pegExtra.nonet.c support.nonet.c: support.c copy support.c support.nonet.c local.nonet.c: local.c copy local.c local.nonet.c pegExtra.nonet.r: pegExtra.nonet.c cc +Dnonet pegExtra.nonet.c +r support.nonet.r: support.nonet.c cc +Dnonet support.nonet.c +r local.nonet.r: local.nonet.c cc +Dnonet local.nonet.c +r VERSION = "CASE Installation Sequence Number 1" PRODUCT = ": X00.01-00" version.r: version.c vdate.h cc +DVERSION='$(VERSIOHAM = graph.r strings.r node0.r node1.r link0.r link1.r \ direct.r attribute0.r attribute1.r attributeN.r attributeL.r \ attributeC.r filterN.r filterC.r linear.r search.r dispatch.r \ buffer.r hunt.r reSearch.r context.r bitMap.r archive.r lcs.r version.r SUPPORT = socket.r support.r errors.r pegExtra.r FILES = f_attValue.r f_entAtt.r f_attHist.r f_attDef.r f_linkHist.r f_links.r \ log.r f_nodes.r f_context.r f_strings.r f_mapping.r \ f_nodeFile.r fileMan.r .SUFFIXES: .c .r .c.r: cc $*.c +r hyN)' +DPRODUCT='$(PRODUCT)' version.c +r i j "pegExtra.c.ʌ(SҔ$ Ҩ$Ұ-z-z $ՀR>LHam stuff fo$BXl[ m $6local.c.ʌ(SҔ$ Ҩ$Ұ-z-z $ՀR>LHam stuff fo$BX6#include #include #include #ifndef nonet #include #include #endif /* * flock -- fake lock command to correspond to the 4.2BSD flock(). * Doesn't know how to handle shared locking, fakes blocked locking * by spinning with a sleep(). */ extern errno; flock(fd, op) int fd, op; { if (op & LOCK_UN) { /* unlock fd */ if (urec(fd) < 0) perror("un-flock"); } else { /* really lock */ if (op & LOCK_NB) { /* don't block */ if (l/* local.c is the driver program for a version of the hypertext system that uses pipes to communicate with a user interface subsystem. It serves as an interface between the hypertext user interface subsystem and the hypertext directory and node servers. */ #include "machine.h" #include #include #include #include #ifdef mag #include #include #include #include #else #ifndef nonet #include rec (fd, 1) < 0) { #ifndef nonet if (errno == ELOCK) errno = EWOULDBLOCK; #endif return (-1); } else return (0); } else { /* fake blocking with sleep() */ while (lrec (fd, 1) < 0) { if (errno != ELOCK) return (-1); else sleep (2); } return (0); } } } bcopy(a, b, size) register char a[], b[]; register int size; { register int i; for (i = 0; i < size; i++) b[i] = a[i]; } bcmp(a, b, l) char *a; char *b; int l; { int i; for (i = 0; i < l; i++) {#include #endif #endif #include #include #include "directory.h" #include "actions.h" #include "errors.h" int debugflag = 0; int authorStringIndex; char *authorName; FILE *trace; static int commandFile, responseFile; int thisHostId; struct graphContext project, context; makeBooleanResponse(c) char c; { returnByteResponse(responseFile, c); sflush(responseFile); } processLocalCommand(command) int command; { struct hostent *h; char result, name[100]; struct pa if (a[i] != b[i]) return 1; } return 0; } fsync(i) int i; { } getdtablesize() { return _NFILE; } egExtra.nonet.r \ lexExtra.r $(FILES) cc hlex.r $(HAM) errors.r support.nonet.r \ $(FILES) pegExtra.nonet.r lexExtra.r +o=mhtoh +x=b=8M mhtoh2: hyper.r $(HAM) errors.r support.nonet.r pegExtra.nonet.r $(FILES) cc hyper.r $(HAM) errors.r support.nonet.r \ $(FILES) pegExtra.nonet.r +o=mhtoh2 +x=b=8M mstomh: mslex.r lexExtra.r cc mslex.r lexExtra.r +o=mstomh hyperMove: hyperMove.r cc hyperMove.r sswd *p; char outFile[20], inFile[20], hostId[20]; switch (command) { case SETHOSTMACHINE: getStringArg(commandFile, name); #ifdef nonet project.dirHost = 1234; project.dirSocketId = -1; returnByteResponse(responseFile, 1); break; #else #ifdef mag h = gethostbyname(name); #else h = gethostbyname(name, AF_INET); #endif result = 1; if (h != 0) { bcopy(h->h_addr, &project.dirHost, 4); if (project.dirHost != thisHostId) { /* need to start up server that talks to remote machines */ sprintf(inFile, "%d", commandFile); sprintf(outFile, "%d", responseFile); sprintf(hostId, "%d", project.dirHost); #if DEBUGTRACE != 0 fclose(trace); #endif finalizeDirectories(); #ifdef mag execl("/usr/local/hyperRemote", "hyperRemote", #else execl("/usr/neptune/hyperRemote", "hyperRemote", #endif inFile, outFile, hostId, 0); setError(E_cannot_connect_to_host, name, 0); result = 0; } } else { result = 0; setError(E_unknown_host, name, 0); } proj thisHostId = getThisHostAddress(); setUserId(); if (argc == 4) { /* we were exec'ed after pipes established */ commandFile = atol(argv[1]); responseFile = atol(argv[2]); project.dirHost = atol(argv[3]); #if DEBUGTRACE != 0 #ifdef mag trace = fopen("/usr/tmp/uiLog", "a"); #else trace = fopen("/tmp/uiLog", "a"); #endif fprintf(trace, "switched to local server\n"); #endif makeBooleanResponse(1); } else { #if DEBUGTRACE != 0 #ifdef mag traect.dirSocketId = -1; returnByteResponse(responseFile, result); #endif break; case GETUSERNAME: p = getpwuid(getuid()); putByteArg(responseFile, 1); putSize(responseFile, sizeOfStringArg(p->pw_name)); putStringArg(responseFile, p->pw_name); break; default: setError(E_invalid_command, "", 0); returnByteResponse(responseFile, 0); break; } sflush(responseFile); } putSize(f, i) int f,i; { } processCommand(size, command) int size, command; { int i; if (project.dice = fopen("uiLog", "w"); #else trace = fopen("/tmp/uiLog", "w"); #endif #endif fclose(stdin); fclose(stdout); #ifdef mag /* use unix-domain sockets for communication with smalltalk */ unlink(COMMANDFILE); f = socket(AF_UNIX, SOCK_STREAM, 0); if (f < 0) {perror("bad socket"); exit(1); } sun.sun_family = AF_UNIX; strcpy(sun.sun_path, COMMANDFILE); i = bind(f, &sun, strlen(COMMANDFILE) + 2); if (i < 0) {perror("bad bind"); exit(1); } i = listen(f, 2); if (i < 0) {perror("bad listen"); exitrHost == 0) { /* eat up command */ for (i = 0; i < size; i++) getByteArg(commandFile); setError(E_graph_not_open, "", 0); makeBooleanResponse(0); } else { dispatch(command, commandFile, responseFile); } } mainCommandLoop() { int f, size, n; int command; char c; struct stat statBuf; command = NOOP; while (command != QUIT) { clearError(); c = getCommand(commandFile); command = c & 0xff; #if DEBUGTRACE != 0 fprintf(trace, "command: %d at %d...\n", command, now()); #endif siz(1); } commandFile = accept(f, 0, 0); if (commandFile < 0) {perror("bad accept"); exit(1); } close(f); sleep(1); /* give smalltalk time to listen for responseFile */ responseFile = socket(AF_UNIX, SOCK_STREAM, 0); if (responseFile < 0) {perror("bad socket"); exit(1); } sun.sun_family = AF_UNIX; strcpy(sun.sun_path, RESPONSEFILE); i = connect(responseFile, &sun, strlen(RESPONSEFILE) + 2); if (i < 0) {perror("bad connect"); exit(1); } #else /* use pipes for communication with smalltalk */ e = getIntegerArg(commandFile); /* size param */ if (command > LOCALCOMMAND) processLocalCommand(command); else processCommand(size, command); #if DEBUGTRACE != 0 fprintf(trace, " done command: %d at %d...\n", command, now()); #endif } } main(argc, argv) int argc; char *argv[]; { int f, i; #ifdef mag struct sockaddr_un sun; #endif project.hostMachine = 0; /* signal that no graph is opened */ project.dirHost = 0; project.dirSocketId = -1; project.contextId = -1; initHypertextMachine();  sscanf(argv[1], "%d", &commandFile); sscanf(argv[2], "%d", &responseFile); sscanf(argv[3], "%d", &f); close(f); /* close parent's input end of pipe */ sscanf(argv[4], "%d", &f); close(f); /* close parent's output end of pipe */ #endif } mainCommandLoop(); abortTransaction(); #if DEBUGTRACE != 0 fclose(trace); #endif close(commandFile); close(responseFile); #ifdef mag unlink(COMMANDFILE); unlink(RESPONSEFILE); #endif } setUserId() { struct passwd *p; p = getpwuid(getuid()); authorName = (char *) malloc(strlen(p->pw_name) + 1); strcpy(authorName, p->pw_name); } "%d", project.dirHost); #if DEBUGTRACE != 0 fclose(trace); #endif finalizeDirectories(); #ifdef mag execl("/usr/local/hyperRemote", "hyperRemote", #else execl("/usr/neptune/hyperRemote", "hyperRemote", #endif inFile, outFile, hostId, 0); setError(E_cannot_connect_to_host, name, 0); result = 0; } } else { result = 0; setError(E_unknown_host, name, 0); } proj char c; { if (!makingResponse) { returnByteResponse(responseFile, c); sflush(responseFile); } else exit(1); } getResponse(s) int s; { int i, size, f; FILE *stream; char c; size = getIntegerArg(s); #if DEBUGTRACE != 0 fprintf(trace, " receiving response of size: %d\n", size); #endif i = size; makingResponse = 1; while (i > BUFSIZE) { getDataStructArg(s, buf, BUFSIZE); write(responseFile, buf, BUFSIZE); i -= BUFSIZE; } getDataStructArg(s, buf, i); write(respZ  %remote.c.ʌ(SҔ$ Ҩ$Ұ-z-z $ՀR>LHam stuff fo$BXonseFile, buf, i); makingResponse = 0; } processLocalCommand(command, size) int command, size; { struct hostent *h; struct passwd *p; char result, name[100]; char outFile[20], inFile[20], hostId[20]; int oldHost; switch (command) { case SETHOSTMACHINE: result = 1; getStringArg(commandFile, name); #ifdef mag h = gethostbyname(name); #else h = gethostbyname(name, AF_INET); #endif if (h != 0) { oldHost = project.dirHost; bcopy(h->h_addr, &project.dirHost/* remote.c is the driver program for a version of the hypertext system that uses pipes to communicate with a user interface subsystem and sockets to communicate with remote hypertext abstract machine servers. It serves as an interface between the hypertext user interface subsystem and the hypertext abstract machine servers. */ #include "machine.h" #include #include #include #ifdef mag #include #include #include #include, 4); if (oldHost != project.dirHost) project.dirSocketId = -1; if (project.dirHost == thisHostId) { /* need to start up server that talks to local machine */ sprintf(inFile, "%d", commandFile); sprintf(outFile, "%d", responseFile); sprintf(hostId, "%d", project.dirHost); #if DEBUGTRACE != 0 fclose(trace); #endif CloseSockets(); #ifdef mag  #else #include #include #endif #include #include #include #include "directory.h" #include "actions.h" #include "errors.h" int debugflag = 0; int authorStringIndex; char *authorName; #define PORT HIDSPORT /* #define PORT HIDSPORTEXP */ FILE *trace; #define BUFSIZE 1024 char buf[BUFSIZE]; int commandFile, responseFile; static int thisHostId; struct graphContext project; static int makingResponse = 0; makeBooleanResponse(c)  execl("/usr/local/hyperLocal", "hyperLocal", #else execl("/normd/proto/hyperLocal", "hyperLocal", #endif inFile, outFile, hostId, 0); setError(E_cannot_connect_to_host, name, 0); result = 0; } else if (getDirectoryServerSocket(PORT) < 0) { project.dirHost = 0; project.dirSocketId = -1; result = 0; } } else { result = 0; setError(E_unknown_host, name, 0); } returnByteResponse(responseFile, result); break; case GETUSERNAME: p = getpwuid(getuid()); putByteArg(responseFile, 1); putSize(responseFile, sizeOfStringArg(p->pw_name)); putStringArg(responseFile, p->pw_name); break; default: setError(E_invalid_command, "", 0); returnByteResponse(responseFile, 0); break; } sflush(responseFile); } putSize(f, i) int f,i; { } processCommand(command, size)ruct sockaddr_un sun; #endif thisHostId = getThisHostAddress(); initSockets(HYPERTEXTINTERFACE); project.dirHost = 0; project.dirSocketId = -1; if (argc == 4) { /* we were exec'ed after pipes established */ commandFile = atol(argv[1]); responseFile = atol(argv[2]); project.dirHost = atol(argv[3]); #if DEBUGTRACE != 0 #ifdef mag trace = fopen("/usr/tmp/uiLog", "a"); #else trace = fopen("/tmp/uiLog", "a"); #endif fprintf(trace, "switched to remote server\n"); #endif makeBooleanResponse(getDire int command, size; { int f, i, s, s1, m; char c; if (project.dirHost == 0) { /* eat up rest of command */ for (i = 0; i < size; i++) getByteArg(commandFile); setError(E_unknown_host, "", 0); makeBooleanResponse(0); } else { s = getDirectoryServerSocket(PORT); if (s < 0) { /* eat up rest of command */ for (i = 0; i < size; i++) getByteArg(commandFile); makeBooleanResponse(0); } else { putByteArg(s, command); i = size; while (i > BUFSIZE) { getDataStructArg(ctoryServerSocket(PORT) >= 0); } else { #if DEBUGTRACE != 0 #ifdef mag trace = fopen("/usr/tmp/uiLog", "w"); #else trace = fopen("/tmp/uiLog", "w"); #endif #endif #ifdef mag /* use unix-domain sockets for communication with smalltalk */ unlink(COMMANDFILE); f = socket(AF_UNIX, SOCK_STREAM, 0); if (f < 0) {perror("bad socket"); exit(1); } sun.sun_family = AF_UNIX; strcpy(sun.sun_path, COMMANDFILE); i = bind(f, &sun, strlen(COMMANDFILE) + 2); if (i commandFile, buf, BUFSIZE); putDataStructArg(s, buf, BUFSIZE); i -= BUFSIZE; } getDataStructArg(commandFile, buf, i); putDataStructArg(s, buf, i); sflush(s); getResponse(s); } } } mainCommandLoop() { int f, size, n; int command; char c, error; error = 0; clearError(); setjmp(errorEnv); if (error == 1) { /* if we get here via long jum */ makeBooleanResponse(0); error = 0; } command = NOOP; while (command != QUIT) { clearError(); c = getCommand< 0) {perror("bad bind"); exit(1); } i = listen(f, 2); if (i < 0) {perror("bad listen"); exit(1); } commandFile = accept(f, 0, 0); if (commandFile < 0) {perror("bad accept"); exit(1); } close(f); sleep(1); /* give smalltalk time to listen for responseFile */ responseFile = socket(AF_UNIX, SOCK_STREAM, 0); if (responseFile < 0) {perror("bad socket"); exit(1); } sun.sun_family = AF_UNIX; strcpy(sun.sun_path, RESPONSEFILE); (commandFile); command = 0xff & c; size = getIntegerArg(commandFile); /* get size param */ #if DEBUGTRACE != 0 fprintf(trace, "command: %d of %d, at %d...\n", command, size, now()); #endif if (command > LOCALCOMMAND) processLocalCommand(command, size); else processCommand(command, size); sflush(responseFile); #if DEBUGTRACE != 0 fprintf(trace, " done command: %d at %d...\n", command, now()); #endif } } main(argc, argv) int argc; char *argv[]; { int f, i; #ifdef mag st i = connect(responseFile, &sun, strlen(RESPONSEFILE) + 2); if (i < 0) {perror("bad connect"); exit(1); } #else /* use pipes for communication with smalltalk */ sscanf(argv[1], "%d", &commandFile); sscanf(argv[2], "%d", &responseFile); sscanf(argv[3], "%d", &f); close(f); /* close parent's input end of pipe */ sscanf(argv[4], "%d", &f); close(f); /* close parent's output end of pipe */ #endif } mainCommandLoop(); CloseSockets(); #if DEBUGTRACE != 0 fclose(trace); #endif close(commandFile); close(responseFile); #ifdef mag unlink(COMMANDFILE); unlink(RESPONSEFILE); #endif } /* dummy routines */ initialize_string_cache_table() { } initTransactionLog() { } initBuffers() { } initDirectories() { } doReorganizeTransaction() {} abortTransaction() {} testRehashFlag() {} clearRehashFlag() {} int readOnlyDirAccess; ); break; } sflush(responseFile); } putSize(f, i) int f,i; { } processCommand(command, size)$#F"4$XbeR  Z  %remote.c.mote.cremote.c          TSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!      ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVU       !!~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! ""##$$%%&&''