home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume3 / awm2 / part10 / Error.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-21  |  3.0 KB  |  115 lines

  1.  
  2.  
  3.  
  4. #ifndef lint
  5. static char *rcsid_Error_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/Error.c,v 1.1 89/01/23 15:34:11 jkh Exp $";
  6. #endif    lint
  7.  
  8. #include <signal.h>
  9. #include "X11/copyright.h"
  10. /*
  11.  *
  12.  * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  13.  *
  14.  * Copyright 1987 by Jordan Hubbard.
  15.  *
  16.  *
  17.  *                         All Rights Reserved
  18.  *
  19.  * Permission to use, copy, modify, and distribute this software and its
  20.  * documentation for any purpose and without fee is hereby granted,
  21.  * provided that the above copyright notice appear in all copies and that
  22.  * both that copyright notice and this permission notice appear in
  23.  * supporting documentation, and that the name of Ardent Computer
  24.  * Corporation or Jordan Hubbard not be used in advertising or publicity
  25.  * pertaining to distribution of the software without specific, written
  26.  * prior permission.
  27.  *
  28.  */
  29.  
  30. /*
  31.  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  32.  *
  33.  *                         All Rights Reserved
  34.  *
  35.  * Permission to use, copy, modify, and distribute this software and its
  36.  * documentation for any purpose and without fee is hereby granted,
  37.  * provided that the above copyright notice appear in all copies and that
  38.  * both that copyright notice and this permission notice appear in
  39.  * supporting documentation, and that the name of Digital Equipment
  40.  * Corporation not be used in advertising or publicity pertaining to
  41.  * distribution of the software without specific, written prior permission.
  42.  *
  43.  *
  44.  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  45.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  46.  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  47.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  48.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  49.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  50.  * SOFTWARE.
  51.  */
  52.  
  53.  
  54.  
  55. /*
  56.  * MODIFICATION HISTORY
  57.  *
  58.  * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  59.  * 1.3 -- Cleanup. Fixed bug.
  60.  */
  61.  
  62. #ifndef lint
  63. static char *sccsid = "@(#)Error.c    3.8    1/24/86";
  64. #endif
  65.  
  66. #ifdef titan
  67. #include <unistd.h>
  68. #endif
  69.  
  70. #include "awm.h"
  71.  
  72. extern Boolean desktop_execd;
  73. extern char execfile[];
  74.  
  75. /*
  76.  * Default error reporting routine.  Called when a random awm error
  77.  * is encountered.
  78.  */
  79. Error(s)
  80. char *s;    /* Error description string */
  81. {
  82.     Entry("Error")
  83.  
  84.     fprintf(stderr, "awm: %s\n", s);
  85.     if (!desktop_execd) {
  86.      if (access(execfile, X_OK) == 0) {
  87.           if (fork() == 0) {
  88. #ifdef SYSV
  89.            setpgrp();
  90. #else
  91.            setpgrp(0, getpid());
  92. #endif
  93.            signal(SIGHUP, SIG_DFL);
  94.            signal(SIGQUIT, SIG_DFL);
  95.            signal(SIGINT, SIG_DFL);
  96.            execl("/bin/sh", "sh", "-c", execfile, 0);
  97.            _exit(127);
  98.           }
  99.           else
  100.            desktop_execd = TRUE;
  101.      }
  102.     }
  103.     Cleanup();
  104.     exit(1);
  105. }
  106.  
  107. void Warning(s)
  108. char *s;    /* Error description string */
  109. {
  110.     Entry("Warning")
  111.  
  112.     fprintf(stderr, "awm: warning: %s\n", s);
  113.     Leave_void
  114. }
  115.