|
|
1.1 ! root 1: /* ! 2: * init routines -- dummy version ! 3: */ ! 4: #include "defs.h" ! 5: #include "space.h" ! 6: #include "map.h" ! 7: ! 8: char *symfil = "a.out"; ! 9: char *corfil = "core"; ! 10: ! 11: MAP symmap[NMAP]; ! 12: MAP cormap[NMAP]; ! 13: ! 14: int fsym, fcor; ! 15: ! 16: setsym() ! 17: { ! 18: ! 19: fsym = getfile(symfil, 1); ! 20: dumbmap(symmap); ! 21: } ! 22: ! 23: setcor() ! 24: { ! 25: ! 26: fcor = getfile(corfil, 2); ! 27: dumbmap(cormap); ! 28: } ! 29: ! 30: static ! 31: dumbmap(mp) ! 32: register MAP *mp; ! 33: { ! 34: ! 35: mp->b = mp->f = 0; ! 36: mp->e = HUGE; ! 37: mp->sp = DATASP; ! 38: mp->flag = MPINUSE; ! 39: mp++; ! 40: mp->flag = 0; ! 41: } ! 42: ! 43: cmdmap(itype, star) ! 44: register int star, itype; ! 45: { ! 46: register MAP *mp; ! 47: extern char lastc; ! 48: ! 49: if (itype & SYMF) ! 50: mp = symmap; ! 51: else ! 52: mp = cormap; ! 53: if (star) /* UGH */ ! 54: mp++; ! 55: if (expr(0)) ! 56: mp->b = expv; ! 57: if (expr(0)) ! 58: mp->e = expv; ! 59: if (expr(0)) ! 60: mp->f = expv; ! 61: mp->flag |= MPINUSE; ! 62: if (rdc()=='?' && (itype&SYMF) == 0) { ! 63: if (fcor) ! 64: close(fcor); ! 65: fcor=fsym; ! 66: corfil=symfil; ! 67: } else if (lastc == '/' && itype&SYMF) { ! 68: if (fsym) ! 69: close(fsym); ! 70: fsym=fcor; ! 71: symfil=corfil; ! 72: } else ! 73: reread(); ! 74: } ! 75: ! 76: create(f) ! 77: char *f; ! 78: { ! 79: register int fd; ! 80: ! 81: fd = creat(f, 0666); ! 82: if (fd < 0) ! 83: return (-1); ! 84: close(fd); ! 85: return (open(f, wtflag)); ! 86: } ! 87: ! 88: getfile(filnam, cnt) ! 89: char *filnam; ! 90: { ! 91: register int fsym; ! 92: ! 93: if (strcmp(filnam, "-") == 0) ! 94: return (-1); ! 95: fsym = open(filnam, wtflag); ! 96: if (fsym < 0 && xargc > cnt) { ! 97: if (wtflag) ! 98: fsym = create(filnam); ! 99: if (fsym < 0) ! 100: printf("cannot open `%s'\n", filnam); ! 101: } ! 102: return (fsym); ! 103: } ! 104: ! 105: setvar() ! 106: { ! 107: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.