|
|
1.1 ! root 1: # ! 2: ! 3: #define ERROR 0 ! 4: #include "udemon.h" ! 5: #include <stdio.h> ! 6: #include "udemon.e" ! 7: ! 8: ! 9: extern int parent; ! 10: char *info "/usr/tom/info"; ! 11: /* tprint -- print file store message in intelligable form */ ! 12: ! 13: ! 14: char *opname[OPNUM] { ! 15: "OK", ! 16: "DEFINE", ! 17: "REDEFINE", ! 18: "DELETE", ! 19: "?", ! 20: "EOM", ! 21: "?", ! 22: "XMT", ! 23: "EVAL", ! 24: "POP", ! 25: "CDIR", ! 26: "?", ! 27: "OPEN", ! 28: "CLOSE", ! 29: "SEEK", ! 30: "READ", ! 31: "WRITE", ! 32: "TRUNCATE", ! 33: "LOGIN", ! 34: "QUIT", ! 35: "LIST", ! 36: "STATUS", ! 37: "TIME", ! 38: "UNIQUE", ! 39: "APPEND", ! 40: "?", ! 41: "ASSIGN", ! 42: "FCREATE", ! 43: "IF", ! 44: "FI", ! 45: "SKIP", ! 46: "DCREATE", ! 47: "?", ! 48: "UNLESS" ! 49: }; ! 50: ! 51: char *tname[MAXTYPE] { ! 52: "\"", ! 53: "W ", ! 54: "??? ", ! 55: "ERROR ", ! 56: "FREF ", ! 57: "X ", ! 58: "STATUS ", ! 59: "DIR ", ! 60: "FILE ", ! 61: "INT ", ! 62: "", ! 63: "??? ", ! 64: "??? ", ! 65: "L", ! 66: "ACC" ! 67: }; ! 68: ! 69: char tsize[MAXTYPE] { ! 70: -1,2,0,4,2,4,69,0,4,4,2,0,0,1,0}; ! 71: ! 72: ! 73: tprint(msg,num) ! 74: char *msg; ! 75: int num; ! 76: { ! 77: char w, *p; ! 78: int c, d; ! 79: int ibuf[2]; ! 80: ! 81: if (trace == 0) ! 82: return; ! 83: for (p=msg; p<(msg+num);){ ! 84: w = *p++; ! 85: if (w<0){ ! 86: w =& 0177; ! 87: if (w >= OPNUM) { ! 88: printf("illegal op %d",w); ! 89: break; ! 90: } ! 91: printf("%s ",opname[w]); ! 92: if (w == (EOM - 128)) ! 93: break; ! 94: } ! 95: else ! 96: if (w == IITYPE){ ! 97: p =+ copy(ibuf,p,4); ! 98: printf("INT %s ",locv(ibuf[0],ibuf[1])); ! 99: } ! 100: else ! 101: if (w > 0){ ! 102: if ((w >= '!') && (w <= '~')){ ! 103: msg[num] = '\0'; ! 104: printf("cmd = %s",msg); ! 105: break; ! 106: } ! 107: if (w>MAXTYPE) { ! 108: printf("illegal type = %d",w); ! 109: break; ! 110: } ! 111: printf("%s",tname[w-1]); ! 112: if (w==STYPE) ! 113: printf("%d:",*p++); ! 114: c = tsize[w-1]; ! 115: if (c < 0) { ! 116: printf("%s\" ",p); ! 117: while (*p++ != 0); ! 118: } ! 119: else ! 120: if (c == 1) printf("%d ",*p++); ! 121: else ! 122: for (; c>0;c =- 2){ ! 123: p =+ copy(&d,p,2); ! 124: printf("0%o",d); ! 125: if (c>2) ! 126: printf(","); ! 127: else ! 128: printf(" "); ! 129: } ! 130: } ! 131: } ! 132: printf("\n"); ! 133: } ! 134: ! 135: ! 136: prt(a, b, c, d, e, f){ ! 137: if (trace == 0) return; ! 138: printf(a, b, c, d, e, f); ! 139: } ! 140: ! 141: error(n,m) ! 142: int n,m; ! 143: { ! 144: extern int errno; ! 145: extern int sys_nerr; ! 146: extern char *sys_errlist[]; ! 147: int i, err; ! 148: ! 149: i = (lp == mlink) ? (mp - mbuf) : (mlink[1].l_mp - mbuf); ! 150: err = (n==0) ? errno : n; ! 151: *rp++ = ETYPE; ! 152: rp =+ copy(rp,&i,2); ! 153: *rp++ = err; ! 154: *rp++ = m; ! 155: if (trace){ ! 156: printf("error(%d,%d) at %d - ",err,m,i); ! 157: if (n==0) ! 158: printf("%s\n", ! 159: errno>sys_nerr?"unknown error":sys_errlist[errno]); ! 160: else ! 161: printf("%s\n",emess[n-100]); ! 162: } ! 163: respond(0); ! 164: reset(); ! 165: } ! 166: ! 167: mesg(s) ! 168: char *s; ! 169: { ! 170: FILE *fo; ! 171: int ttime[2],save; ! 172: ! 173: if((fo = fopen(info,"w")) == NULL) ! 174: return; ! 175: lseek(fo,0L,2); ! 176: fprintf(fo,"%s:\n%s\n%s\n",tiu,ctime(ttime),s); ! 177: fflush(fo); ! 178: close(fo); ! 179: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.