This patch introduces a couple of usability improvements to acid. First, prompts are no longer lexically significant. This means users can now send full lines without having to remove the prompt. Second, if -r is passsed in, the text for the remote process is used rather than /mips/9ch. Reference: /n/sources/patch/maybe/acid-fixup Date: Thu Jul 4 12:15:23 CES 2013 Signed-off-by: sstallion@gmail.com --- /sys/src/cmd/acid/acid.h Thu Jul 4 12:13:38 2013 +++ /sys/src/cmd/acid/acid.h Thu Jul 4 12:13:36 2013 @@ -54,9 +54,10 @@ Extern int initialising; Extern int quiet; +extern char prompt[]; extern void (*expop[])(Node*, Node*); #define expr(n, r) (r)->comt=0; (*expop[(n)->op])(n, r); -extern int fmtsize(Value *v) ; +extern int fmtsize(Value *v); enum { --- /sys/src/cmd/acid/dbg.y Thu Jul 4 12:13:42 2013 +++ /sys/src/cmd/acid/dbg.y Thu Jul 4 12:13:39 2013 @@ -40,7 +40,7 @@ %token Tfconst %token Tstring %token Tif Tdo Tthen Telse Twhile Tloop Thead Ttail Tappend Tfn Tret Tlocal -%token Tcomplex Twhat Tdelete Teval Tbuiltin +%token Tcomplex Twhat Tdelete Teval Tbuiltin Tskip %% @@ -56,7 +56,7 @@ mkvar("_thiscmd")->proc = nil; gc(); if(interactive) - Bprint(bout, "acid: "); + Bprint(bout, prompt); } | Tfn Tid '(' args ')' zsemi '{' slist '}' { --- /sys/src/cmd/acid/lex.c Thu Jul 4 12:13:46 2013 +++ /sys/src/cmd/acid/lex.c Thu Jul 4 12:13:44 2013 @@ -7,6 +7,8 @@ #include "acid.h" #include "y.tab.h" +char prompt[] = "acid: "; + struct keywd { char *name; @@ -305,7 +307,7 @@ int yylex(void) { - int c; + int c, n; extern char vfmt[]; loop: @@ -316,7 +318,7 @@ if(gotint) { gotint = 0; stacked = 0; - Bprint(bout, "\nacid: "); + Bprint(bout, "\n%s", prompt); goto loop; } return Eof; @@ -464,7 +466,10 @@ return '-'; default: - return numsym(c); + n = numsym(c); + if(n == Tskip) + goto loop; + return n; } } @@ -529,13 +534,17 @@ c = lexc(); if(c < 0) error("%d eating symbols", line); + *p++ = c; if(c == '\n') line++; if(c != '_' && c != '$' && c <= '~' && !isalnum(c)) { /* checking against ~ lets UTF names through */ + if(c == ':') + if(strncmp(prompt, symbol, p-symbol) == 0) + return Tskip; unlexc(c); + p--; break; } - *p++ = c; } *p = '\0'; --- /sys/src/cmd/acid/main.c Thu Jul 4 12:13:50 2013 +++ /sys/src/cmd/acid/main.c Thu Jul 4 12:13:48 2013 @@ -90,8 +90,10 @@ aout = argv[0]; } } else - if(remote) - aout = "/mips/9ch"; + if(remote) { + snprint(prog, sizeof(prog), "/proc/%d/text", pid); + aout = prog; + } fmtinstall('x', xfmt); fmtinstall('L', Lfmt); @@ -147,7 +149,7 @@ } stacked = 0; - Bprint(bout, "acid: "); + Bprint(bout, prompt); if(yyparse() != 1) die();