[9fans] rc error messages - Plan9

This is a discussion on [9fans] rc error messages - Plan9 ; steve mentioned that rc is not very forthcoming with information on where runtime errors occur. here's a little patch that makes rc a little bit more forthcoming. but it's still pretty useless in the face of functions. - erik ; ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: [9fans] rc error messages

  1. [9fans] rc error messages

    steve mentioned that rc is not very forthcoming with information on
    where runtime errors occur.

    here's a little patch that makes rc a little bit more forthcoming.
    but it's still pretty useless in the face of functions.

    - erik

    ; diff -c exec.c /n/dump/2008/1021/sys/src/cmd/rc/exec.c
    exec.c:887,916 - /n/dump/2008/1021/sys/src/cmd/rc/exec.c:887,898
    }

    void
    - hisfault(char *buf, int n)
    - {
    - struct thread *t;
    -
    - for(t = runq; !t->cmdfile; t = t->ret){
    - if(t->ret == 0)
    - break;
    - }
    - if(t->cmdfile && !t->iflag)
    - snprint(buf, n, "%s:%d ", t->cmdfile, t->lineno);
    - else
    - snprint(buf, n, "");
    - }
    -
    - void
    Xerror(char *s)
    {
    - char buf[1024];
    -
    - hisfault(buf, sizeof buf);
    if(strcmp(argv0, "rc")==0 || strcmp(argv0, "/bin/rc")==0)
    - pfmt(err, "rc: %s%s: %r\n", buf, s);
    + pfmt(err, "rc: %s: %r\n", s);
    else
    - pfmt(err, "rc (%s): %s%s: %r\n", argv0, buf, s);
    + pfmt(err, "rc (%s): %s: %r\n", argv0, s);
    flush(err);
    setstatus("error");
    while(!runq->iflag) Xreturn();
    exec.c:919,931 - /n/dump/2008/1021/sys/src/cmd/rc/exec.c:901,910
    void
    Xerror1(char *s)
    {
    - char buf[1024];
    -
    - hisfault(buf, sizeof buf);
    if(strcmp(argv0, "rc")==0 || strcmp(argv0, "/bin/rc")==0)
    - pfmt(err, "rc: %s%s\n", buf, s);
    + pfmt(err, "rc: %s\n", s);
    else
    - pfmt(err, "rc (%s): %s%s\n", argv0, buf, s);
    + pfmt(err, "rc (%s): %s\n", argv0, s);
    flush(err);
    setstatus("error");
    while(!runq->iflag) Xreturn();



  2. Re: [9fans] rc error messages

    Thanks for that erik, I have been meaning to sort that out for years,
    and then when I tried I drew a blank. I really should learn the internals
    of rc one day.

    See you next week in Volos.

    -Steve


+ Reply to Thread