Print this page
make: unifdef for other OSes (undefined)


  34  *              Property handling
  35  *              Error message handling
  36  *              Make internal state dumping
  37  *              main routine support
  38  */
  39 
  40 /*
  41  * Included files
  42  */
  43 #include <bsd/bsd.h>              /* bsd_signal() */
  44 #include <mksh/i18n.h>            /* get_char_semantics_value() */
  45 #include <mksh/misc.h>
  46 #include <mksdmsi18n/mksdmsi18n.h>
  47 #include <stdarg.h>               /* va_list, va_start(), va_end() */
  48 #include <stdlib.h>               /* mbstowcs() */
  49 #include <sys/signal.h>           /* SIG_DFL */
  50 #include <sys/wait.h>             /* wait() */
  51 
  52 #include <string.h>               /* strerror() */
  53 
  54 #if defined (HP_UX) || defined (linux)
  55 #include <unistd.h>
  56 #endif
  57 
  58 /*
  59  * Defined macros
  60  */
  61 
  62 /*
  63  * typedefs & structs
  64  */
  65 
  66 /*
  67  * Static variables
  68  */
  69 extern "C" {
  70         void            (*sigivalue)(int) = SIG_DFL;
  71         void            (*sigqvalue)(int) = SIG_DFL;
  72         void            (*sigtvalue)(int) = SIG_DFL;
  73         void            (*sighvalue)(int) = SIG_DFL;
  74 }
  75 
  76 long    getname_bytes_count = 0;


 332 }
 333 
 334 /*
 335  *      errmsg(errnum)
 336  *
 337  *      Return the error message for a system call error
 338  *
 339  *      Return value:
 340  *                              An error message string
 341  *
 342  *      Parameters:
 343  *              errnum          The number of the error we want to describe
 344  *
 345  *      Global variables used:
 346  *              sys_errlist     A vector of error messages
 347  *              sys_nerr        The size of sys_errlist
 348  */
 349 char *
 350 errmsg(int errnum)
 351 {
 352 #ifdef linux
 353         return strerror(errnum);
 354 #else // linux
 355 
 356         extern int              sys_nerr;
 357 #ifdef SUN4_x
 358         extern char             *sys_errlist[];
 359 #endif
 360         char                    *errbuf;
 361 
 362         if ((errnum < 0) || (errnum > sys_nerr)) {
 363                 errbuf = getmem(6+1+11+1);
 364                 (void) sprintf(errbuf, catgets(libmksdmsi18n_catd, 1, 127, "Error %d"), errnum);
 365                 return errbuf;
 366         } else {
 367 #ifdef SUN4_x
 368                 return(sys_errlist[errnum]);
 369 #endif
 370                 return strerror(errnum);
 371 
 372         }
 373 #endif // linux
 374 }
 375 
 376 static char static_buf[MAXPATHLEN*3];
 377 
 378 /*
 379  *      fatal_mksh(format, args...)
 380  *
 381  *      Print a message and die
 382  *
 383  *      Parameters:
 384  *              format          printf type format string
 385  *              args            Arguments to match the format
 386  */
 387 /*VARARGS*/
 388 void
 389 fatal_mksh(const char *message, ...)
 390 {
 391         va_list args;
 392         char    *buf = static_buf;
 393         char    *mksh_fat_err = catgets(libmksdmsi18n_catd, 1, 128, "mksh: Fatal error: ");




  34  *              Property handling
  35  *              Error message handling
  36  *              Make internal state dumping
  37  *              main routine support
  38  */
  39 
  40 /*
  41  * Included files
  42  */
  43 #include <bsd/bsd.h>              /* bsd_signal() */
  44 #include <mksh/i18n.h>            /* get_char_semantics_value() */
  45 #include <mksh/misc.h>
  46 #include <mksdmsi18n/mksdmsi18n.h>
  47 #include <stdarg.h>               /* va_list, va_start(), va_end() */
  48 #include <stdlib.h>               /* mbstowcs() */
  49 #include <sys/signal.h>           /* SIG_DFL */
  50 #include <sys/wait.h>             /* wait() */
  51 
  52 #include <string.h>               /* strerror() */
  53 



  54 
  55 /*
  56  * Defined macros
  57  */
  58 
  59 /*
  60  * typedefs & structs
  61  */
  62 
  63 /*
  64  * Static variables
  65  */
  66 extern "C" {
  67         void            (*sigivalue)(int) = SIG_DFL;
  68         void            (*sigqvalue)(int) = SIG_DFL;
  69         void            (*sigtvalue)(int) = SIG_DFL;
  70         void            (*sighvalue)(int) = SIG_DFL;
  71 }
  72 
  73 long    getname_bytes_count = 0;


 329 }
 330 
 331 /*
 332  *      errmsg(errnum)
 333  *
 334  *      Return the error message for a system call error
 335  *
 336  *      Return value:
 337  *                              An error message string
 338  *
 339  *      Parameters:
 340  *              errnum          The number of the error we want to describe
 341  *
 342  *      Global variables used:
 343  *              sys_errlist     A vector of error messages
 344  *              sys_nerr        The size of sys_errlist
 345  */
 346 char *
 347 errmsg(int errnum)
 348 {



 349 
 350         extern int              sys_nerr;



 351         char                    *errbuf;
 352 
 353         if ((errnum < 0) || (errnum > sys_nerr)) {
 354                 errbuf = getmem(6+1+11+1);
 355                 (void) sprintf(errbuf, catgets(libmksdmsi18n_catd, 1, 127, "Error %d"), errnum);
 356                 return errbuf;
 357         } else {



 358                 return strerror(errnum);
 359 
 360         }

 361 }
 362 
 363 static char static_buf[MAXPATHLEN*3];
 364 
 365 /*
 366  *      fatal_mksh(format, args...)
 367  *
 368  *      Print a message and die
 369  *
 370  *      Parameters:
 371  *              format          printf type format string
 372  *              args            Arguments to match the format
 373  */
 374 /*VARARGS*/
 375 void
 376 fatal_mksh(const char *message, ...)
 377 {
 378         va_list args;
 379         char    *buf = static_buf;
 380         char    *mksh_fat_err = catgets(libmksdmsi18n_catd, 1, 128, "mksh: Fatal error: ");