home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / sup / quit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  1.9 KB  |  65 lines

  1. /*
  2.  * Copyright (c) 1991 Carnegie Mellon University
  3.  * All Rights Reserved.
  4.  * 
  5.  * Permission to use, copy, modify and distribute this software and its
  6.  * documentation is hereby granted, provided that both the copyright
  7.  * notice and this permission notice appear in all copies of the
  8.  * software, derivative works or modified versions, and any portions
  9.  * thereof, and that both notices appear in supporting documentation.
  10.  *
  11.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  12.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  13.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  14.  *
  15.  * Carnegie Mellon requests users of this software to return to
  16.  *
  17.  *  Software Distribution Coordinator   or   Software.Distribution@CS.CMU.EDU
  18.  *  School of Computer Science
  19.  *  Carnegie Mellon University
  20.  *  Pittsburgh PA 15213-3890
  21.  *
  22.  * any improvements or extensions that they make and grant Carnegie the rights
  23.  * to redistribute these changes.
  24.  */
  25. /*
  26.  *  quit  --  print message and exit
  27.  *
  28.  *  Usage:  quit (status,format [,arg]...);
  29.  *    int status;
  30.  *    (... format and arg[s] make up a printf-arglist)
  31.  *
  32.  *  Quit is a way to easily print an arbitrary message and exit.
  33.  *  It is most useful for error exits from a program:
  34.  *    if (open (...) < 0) then quit (1,"Can't open...",file);
  35.  *
  36.  **********************************************************************
  37.  * HISTORY
  38.  * $Log: quit.c,v $
  39.  * Revision 1.1.1.1  1993/05/21  14:52:17  cgd
  40.  * initial import of CMU's SUP to NetBSD
  41.  *
  42.  * Revision 1.2  88/12/13  13:52:41  gm0w
  43.  *     Rewritten to use varargs.
  44.  *     [88/12/13            gm0w]
  45.  * 
  46.  **********************************************************************
  47.  */
  48.  
  49. #include <stdio.h>
  50. #include <varargs.h>
  51.  
  52. quit (status, fmt, va_alist)
  53. int status;
  54. char *fmt;
  55. va_dcl
  56. {
  57.     va_list args;
  58.  
  59.     fflush(stdout);
  60.     va_start(args);
  61.     (void) vfprintf(stderr, fmt, args);
  62.     va_end(args);
  63.     exit(status);
  64. }
  65.