home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / condor40.zip / CONDOR / src / condor_shadow / perm_err.c < prev    next >
C/C++ Source or Header  |  1989-09-02  |  2KB  |  86 lines

  1. /* 
  2. ** Copyright 1986, 1987, 1988, 1989 University of Wisconsin
  3. ** 
  4. ** Permission to use, copy, modify, and distribute this software and its
  5. ** documentation for any purpose and without fee is hereby granted,
  6. ** provided that the above copyright notice appear in all copies and that
  7. ** both that copyright notice and this permission notice appear in
  8. ** supporting documentation, and that the name of the University of
  9. ** Wisconsin not be used in advertising or publicity pertaining to
  10. ** distribution of the software without specific, written prior
  11. ** permission.  The University of Wisconsin makes no representations about
  12. ** the suitability of this software for any purpose.  It is provided "as
  13. ** is" without express or implied warranty.
  14. ** 
  15. ** THE UNIVERSITY OF WISCONSIN DISCLAIMS ALL WARRANTIES WITH REGARD TO
  16. ** THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17. ** FITNESS. IN NO EVENT SHALL THE UNIVERSITY OF WISCONSIN  BE LIABLE FOR
  18. ** ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  19. ** WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  20. ** ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  21. ** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22. ** 
  23. ** Authors:  Allan Bricker and Michael J. Litzkow,
  24. **              University of Wisconsin, Computer Sciences Dept.
  25. ** 
  26. */ 
  27.  
  28.  
  29. #include <stdio.h>
  30. #include <varargs.h>
  31. #include <time.h>
  32. #include "condor_sys.h"
  33. #include "exit.h"
  34. #include "debug.h"
  35.  
  36.  
  37. extern int    errno;
  38. extern int    sys_nerr;
  39. extern char    *sys_errlist[];
  40.  
  41. #ifdef LINT
  42.  
  43. /* VARARGS1 */
  44. PERM_ERR(foo)
  45. char    *foo;
  46. { printf( foo ); }
  47. #else LINT
  48.  
  49. PERM_ERR(va_alist)
  50. va_dcl
  51. {
  52.     va_list pvar;
  53.     char *fmt;
  54.     char buf[ BUFSIZ ];
  55.  
  56.     (void)SetSyscalls( SYS_LOCAL | SYS_UNRECORDED );
  57.     va_start(pvar);
  58.  
  59.     fmt = va_arg(pvar, char *);
  60.  
  61. #if vax || i386 || bobcat || ibm032
  62.     {
  63.         FILE _strbuf;
  64.         int *argaddr = &va_arg(pvar, int);
  65.  
  66.         _strbuf._flag = _IOWRT+_IOSTRG;
  67.         _strbuf._ptr  = buf;
  68.         _strbuf._cnt  = BUFSIZ;
  69.         _doprnt( fmt, argaddr, &_strbuf );
  70.         putc('\0', &_strbuf);
  71.     }
  72. #else vax || i386 || bobcat || ibm032
  73.     vsprintf( buf, fmt, pvar );
  74. #endif vax || i386 || bobcat || ibm032
  75.  
  76.     if( errno ) {
  77.         dprintf( D_ALWAYS|D_NOHEADER, "ERROR: %s: %s\n",
  78.             buf, (errno<sys_nerr) ? sys_errlist[errno] : "Unknown error" );
  79.     } else {
  80.         dprintf( D_ALWAYS|D_NOHEADER, "ERROR: %s\n", buf );
  81.     }
  82.  
  83.     va_end(pvar);
  84. }
  85. #endif LINT
  86.