Improve exit status display. New interface from `doto' project.
authormdw <mdw>
Fri, 16 Jul 1999 12:50:24 +0000 (12:50 +0000)
committermdw <mdw>
Fri, 16 Jul 1999 12:50:24 +0000 (12:50 +0000)
src/pres_curses.c
src/pres_curses.h
src/pres_plain.c
src/pres_plain.h
src/sw_build.c
src/sw_build.h

index 0901df5..44770c6 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: pres_curses.c,v 1.2 1999/06/24 15:51:16 mdw Exp $
+ * $Id: pres_curses.c,v 1.3 1999/07/16 12:49:58 mdw Exp $
  *
  * Curses-based output presentation
  *
@@ -29,6 +29,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pres_curses.c,v $
+ * Revision 1.3  1999/07/16 12:49:58  mdw
+ * Improve exit status display.  New interface from `doto' project.
+ *
  * Revision 1.2  1999/06/24 15:51:16  mdw
  * Fix signal handlers so they don't corrupt `errno'.
  *
@@ -230,7 +233,7 @@ int curses_init(archcons *a)
     leaveok(c->s, TRUE);
     wbkgdset(c->s, A_STANDOUT);
     werase(c->s);
-    mvwprintw(c->s, 0, 0, "  %s  [running]\n", c->e->arch);
+    mvwprintw(c->s, 0, 0, "  %s [running]\n", c->e->arch);
     wnoutrefresh(c->w);
     wnoutrefresh(c->s);
   }
@@ -275,10 +278,10 @@ void curses_output(archent *e, const char *p, size_t sz)
 
 /* --- @curses_close@ --- */
 
-void curses_close(archent *e, int ok)
+void curses_close(archent *e, int ok, const char *summ)
 {
   cwin *c = e->pres;
-  mvwprintw(c->s, 0, 0, "  %s [%s]\n", e->arch, ok ? "finished" : "failed");
+  mvwprintw(c->s, 0, 0, "  %s [%s]\n", e->arch, summ);
   wrefresh(c->s);
 }
 
index 0f13762..fcea5d6 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: pres_curses.h,v 1.1 1999/06/02 16:53:36 mdw Exp $
+ * $Id: pres_curses.h,v 1.2 1999/07/16 12:49:58 mdw Exp $
  *
  * Curses-based output presentation
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pres_curses.h,v $
- * Revision 1.1  1999/06/02 16:53:36  mdw
- * Initial revision
+ * Revision 1.2  1999/07/16 12:49:58  mdw
+ * Improve exit status display.  New interface from `doto' project.
+ *
+ * Revision 1.1.1.1  1999/06/02 16:53:36  mdw
+ * Initial import.
  *
  */
 
@@ -58,7 +61,7 @@
 extern int curses_ok(void);
 extern int curses_init(archcons */*a*/);
 extern void curses_output(archent */*e*/, const char */*p*/, size_t /*sz*/);
-extern void curses_close(archent */*e*/, int /*ok*/);
+extern void curses_close(archent */*e*/, int /*ok*/, const char */*summ*/);
 extern void curses_done(archcons */*a*/);
 extern void curses_abort(archcons */*a*/);
 
index 3ee170c..60a0793 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: pres_plain.c,v 1.1 1999/06/02 16:53:35 mdw Exp $
+ * $Id: pres_plain.c,v 1.2 1999/07/16 12:49:59 mdw Exp $
  *
  * Plain output style for remote builds
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pres_plain.c,v $
- * Revision 1.1  1999/06/02 16:53:35  mdw
- * Initial revision
+ * Revision 1.2  1999/07/16 12:49:59  mdw
+ * Improve exit status display.  New interface from `doto' project.
+ *
+ * Revision 1.1.1.1  1999/06/02 16:53:35  mdw
+ * Initial import.
  *
  */
 
@@ -84,9 +87,11 @@ void plain_output(archent *e, const char *p, size_t sz)
 
 /* --- @plain_close@ --- */
 
-void plain_close(archent *e, int ok)
+void plain_close(archent *e, int ok, const char *summ)
 {
   lbuf_close(e->pres);
+  if (!ok)
+    printf("%s: %s\n", e->arch, summ);
 }
 
 /* --- @plain_done@ --- */
index ab83e06..df78955 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: pres_plain.h,v 1.1 1999/06/02 16:53:35 mdw Exp $
+ * $Id: pres_plain.h,v 1.2 1999/07/16 12:49:59 mdw Exp $
  *
  * Plain output style for remote builds
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pres_plain.h,v $
- * Revision 1.1  1999/06/02 16:53:35  mdw
- * Initial revision
+ * Revision 1.2  1999/07/16 12:49:59  mdw
+ * Improve exit status display.  New interface from `doto' project.
+ *
+ * Revision 1.1.1.1  1999/06/02 16:53:35  mdw
+ * Initial import.
  *
  */
 
@@ -51,7 +54,7 @@
 
 extern int plain_init(archcons */*a*/);
 extern void plain_output(archent */*e*/, const char */*p*/, size_t /*sz*/);
-extern void plain_close(archent */*e*/, int /*ok*/);
+extern void plain_close(archent */*e*/, int /*ok*/, const char */*summ*/);
 extern void plain_done(archcons */*a*/);
 
 #ifdef PRES_LINK
index 3e8476a..cfa765b 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: sw_build.c,v 1.1 1999/06/02 16:53:34 mdw Exp $
+ * $Id: sw_build.c,v 1.2 1999/07/16 12:50:24 mdw Exp $
  *
  * Management of build processes
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: sw_build.c,v $
- * Revision 1.1  1999/06/02 16:53:34  mdw
- * Initial revision
+ * Revision 1.2  1999/07/16 12:50:24  mdw
+ * Improve exit status display.  New interface from `doto' project.
+ *
+ * Revision 1.1.1.1  1999/06/02 16:53:34  mdw
+ * Initial import.
  *
  */
 
@@ -288,31 +291,29 @@ int sw_run(int argc, char *argv[])
            int ok = 1;
            if (r->sz != 1) {
              r->buf[r->sz] = 0;
-             dstr_putf(&d, "\nTerminated by signal: %s.\n", r->buf);
+             dstr_putf(&d, "failed (%s)", r->buf);
              ok = 0;
              rc = 1;
            } else if (r->buf[0]) {
-             dstr_putf(&d, "\nExited with status %u.\n",
-                       (unsigned char)r->buf[0]);
+             dstr_putf(&d, "failed (status %u)", (unsigned char)r->buf[0]);
              ok = 0;
              rc = 1;
-           } else if (opt_flags & optFlag_install)
-             e->flags |= archFlag_built;
-           if (d.len)
-             p->output(e, d.buf, d.len);
-           dstr_destroy(&d);
+           } else {
+             dstr_puts(&d, "finished");
+             if (opt_flags & optFlag_install)
+               e->flags |= archFlag_built;
+           }
            if (p->close)
-             p->close(e, ok);
+             p->close(e, ok, d.buf);
+           dstr_destroy(&d);
            FD_CLR(r->fdin, &fdin);
            close(r->fdin);
            active--;
          } break;
 
          case PKTYPE_EOF: {
-           const static char msg[] = "\nUnexpected exit.\n";
-           p->output(e, msg, sizeof(msg) - 1);
            if (p->close)
-             p->close(e, 0);
+             p->close(e, 0, "unexpected exit");
            rc = 1;
            FD_CLR(r->fdin, &fdin);
            close(r->fdin);
@@ -339,7 +340,7 @@ int sw_run(int argc, char *argv[])
       p->abort(a);
     switch (exc_type) {
       case EXC_ERRNO:
-       die(1, "unexpected error: %s", exc_i);
+       die(1, "unexpected error: %s", strerror(exc_i));
        break;
       default:
        RETHROW;
index f61b460..e83e97e 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: sw_build.h,v 1.1 1999/06/02 16:53:35 mdw Exp $
+ * $Id: sw_build.h,v 1.2 1999/07/16 12:50:24 mdw Exp $
  *
  * Management of build processes
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: sw_build.h,v $
- * Revision 1.1  1999/06/02 16:53:35  mdw
- * Initial revision
+ * Revision 1.2  1999/07/16 12:50:24  mdw
+ * Improve exit status display.  New interface from `doto' project.
+ *
+ * Revision 1.1.1.1  1999/06/02 16:53:35  mdw
+ * Initial import.
  *
  */
 
  *    otherwise.  (A message describing the failure will have been
  *    synthetically output before this point, so only a small visual cue is
  *    needed here.)  A zero value means this handler is not interested in
- *    close events.
+ *    close events.  The argument @summ@ is a quick summary of the exit
+ *    status.
  *
  *  * @done@ informs the handler that all builds have completed.  The handler
  *    should make sure that the display will remain as long as is needed, and
@@ -128,7 +132,7 @@ typedef struct pres {
   int (*ok)(void);
   int (*init)(archcons */*a*/);
   void (*output)(archent */*e*/, const char */*p*/, size_t /*sz*/);
-  void (*close)(archent */*e*/, int /*ok*/);
+  void (*close)(archent */*e*/, int /*ok*/, const char */*summ*/);
   void (*done)(archcons */*a*/);
   void (*abort)(archcons */*a*/);
 } pres;