9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] rc error messages
@ 2008-10-21 17:04 erik quanstrom
  2008-10-22 10:06 ` Steve Simon
  2008-10-22 10:07 ` Steve Simon
  0 siblings, 2 replies; 3+ messages in thread
From: erik quanstrom @ 2008-10-21 17:04 UTC (permalink / raw)
  To: 9fans

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();




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] rc error messages
  2008-10-21 17:04 [9fans] rc error messages erik quanstrom
@ 2008-10-22 10:06 ` Steve Simon
  2008-10-22 10:07 ` Steve Simon
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Simon @ 2008-10-22 10:06 UTC (permalink / raw)
  To: 9fans

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] rc error messages
  2008-10-21 17:04 [9fans] rc error messages erik quanstrom
  2008-10-22 10:06 ` Steve Simon
@ 2008-10-22 10:07 ` Steve Simon
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Simon @ 2008-10-22 10:07 UTC (permalink / raw)
  To: 9fans

Hell,

sorry for the noise,
got caught replying to the list as usual.

-Steve



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-22 10:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-21 17:04 [9fans] rc error messages erik quanstrom
2008-10-22 10:06 ` Steve Simon
2008-10-22 10:07 ` Steve Simon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).