Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!hp4nl!utrcu1!mi.eltn.utwente.nl!klamer From: klamer@mi.eltn.utwente.nl (Klamer Schutte -- Universiteit Twente) Newsgroups: comp.os.minix Subject: enhancement of mdb Message-ID: Date: 26 Feb 91 08:25:37 GMT Sender: news@utrcu1.UUCP Organization: University of Twente, BSC-El Lines: 76 I enhanced mdb to support big command lines with lots of args (Essential to debug programs which need a lot of arguments in argv[]) Now you can have upto 256 chars/line && 50 arguments. (easily changeable). Also you can type long lines using a \ escape (since tty doesn't fold, this is necessary) Klamer (.signature at end) OOPS: i didn't use the variable char *s -- but i hate to send untested code *** mdb.c.org Sun Feb 24 17:25:42 1991 --- mdb.c Sun Feb 24 18:22:08 1991 *************** *** 29,41 **** struct proc *prc; ! #define MAXLINE 120 #define PC ((long)&((struct proc *)0)->p_reg.pc) #define MAXB 10 #define MAXP 3 ! #define MAXARG 20 #define SIZ (1 + sizeof(struct proc)/sizeof(long)) - #define MAXLINE 120 long myptrace(), strtol(), reg_addr(), lbuf[SIZ], saddr, eaddr, dasm(); int curpid, cursig; --- 29,40 ---- struct proc *prc; ! #define MAXLINE 256 #define PC ((long)&((struct proc *)0)->p_reg.pc) #define MAXB 10 #define MAXP 3 ! #define MAXARG 50 #define SIZ (1 + sizeof(struct proc)/sizeof(long)) long myptrace(), strtol(), reg_addr(), lbuf[SIZ], saddr, eaddr, dasm(); int curpid, cursig; *************** *** 728,733 **** --- 727,733 ---- char *argv[]; { int i; + char *s; prc = (struct proc *)lbuf; ioctl(0, TIOCGETP, &in_gttyb); *************** *** 753,762 **** --- 753,770 ---- while ((printf("* "), fflush(stdout), fgets(cbuf, sizeof(cbuf), stdin)) != NULL) { + start_loop: if (strlen(cbuf) == sizeof(cbuf)-1) { printf("Command line too long.\n"); continue; + } + if (cbuf[strlen(cbuf)-2] == '\\') + { + printf("> "), fflush(stdout); + fgets(cbuf+strlen(cbuf)-2,sizeof(cbuf)-strlen(cbuf)-2, + stdin); + goto start_loop; } cmd = cbuf; command(); -- Klamer Schutte Faculty of electrical engineering -- University of Twente, The Netherlands klamer@mi.eltn.utwente.nl {backbone}!mcsun!mi.eltn.utwente.nl!klamer Brought to you by Super Global Mega Corp .com