home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume44 / toy_os / part04 / myenv.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-05  |  1.9 KB  |  69 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /*
  3.  ************************************************************************
  4.  *            Service C++ functions 
  5.  *         that support the standard environment for me
  6.  */
  7.  
  8. #pragma implementation
  9.  
  10. #include "myenv.h"
  11. #include <builtin.h>
  12. #include <stdarg.h>
  13.  
  14. /*
  15.  *-----------------------------------------------------------------------
  16.  *        Some global constant pertaining to input/output
  17.  */
  18.  
  19. const char _Minuses [] = "\
  20. -------------------------------------------------------------------------------";
  21.  
  22. const char _Asteriscs [] = "\
  23. *******************************************************************************";
  24.  
  25. const char _Equals [] = "\
  26. ===============================================================================";
  27.  
  28.  
  29. /*
  30.  *------------------------------------------------------------------------
  31.  *            Print an error message at stderr and abort
  32.  * Synopsis
  33.  *    volatile void _error(const char * message,... );
  34.  *    Message may contain format control sequences %x. Items to print 
  35.  *    with the control sequences are to be passed as additional arguments to
  36.  *    the function call.
  37.  */
  38.  
  39. volatile void _error(const char * message,...)
  40. {
  41.   va_list args;
  42.   va_start(args,message);        /* Init 'args' to the beginning of */
  43.                     /* the variable length list of args*/
  44.   fprintf(stderr,"\n_error:\n");     
  45.   vfprintf(stderr,message,args);
  46.   fputs("\n",stderr);
  47.   abort();
  48. }
  49.  
  50.  
  51. /*
  52.  *------------------------------------------------------------------------
  53.  *                    Print a message at stderr
  54.  * Synopsis
  55.  *    void message(const char * text,... );
  56.  *    Message may contain format control sequences %x. Items to print 
  57.  *    with the control sequences are to be passed as additional arguments to
  58.  *    the function call.
  59.  */
  60.  
  61. void message(const char * text,...)
  62. {
  63.   va_list args;
  64.   va_start(args,text);        /* Init 'args' to the beginning of */
  65.                     /* the variable length list of args*/
  66.   vfprintf(stderr,text,args);
  67. }
  68.  
  69.