runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

strerr.h (2770B)


      1 /* Public domain. */
      2 
      3 #ifndef STRERR_H
      4 #define STRERR_H
      5 
      6 struct strerr {
      7   struct strerr *who;
      8   const char *x;
      9   const char *y;
     10   const char *z;
     11 } ;
     12 
     13 extern struct strerr strerr_sys;
     14 extern void strerr_sysinit(void);
     15 
     16 extern const char *strerr(const struct strerr *);
     17 extern void strerr_warn(const char *,const char *,const char *,const char *,const char *,const char *,const struct strerr *);
     18 extern void strerr_die(int,const char *,const char *,const char *,const char *,const char *,const char *,const struct strerr *);
     19 
     20 #define STRERR(r,se,a) \
     21 { se.who = 0; se.x = a; se.y = 0; se.z = 0; return r; }
     22 
     23 #define STRERR_SYS(r,se,a) \
     24 { se.who = &strerr_sys; se.x = a; se.y = 0; se.z = 0; return r; }
     25 #define STRERR_SYS3(r,se,a,b,c) \
     26 { se.who = &strerr_sys; se.x = a; se.y = b; se.z = c; return r; }
     27 
     28 #define strerr_warn6(x1,x2,x3,x4,x5,x6,se) \
     29 strerr_warn((x1),(x2),(x3),(x4),(x5),(x6),(se))
     30 #define strerr_warn5(x1,x2,x3,x4,x5,se) \
     31 strerr_warn((x1),(x2),(x3),(x4),(x5),0,(se))
     32 #define strerr_warn4(x1,x2,x3,x4,se) \
     33 strerr_warn((x1),(x2),(x3),(x4),0,0,(se))
     34 #define strerr_warn3(x1,x2,x3,se) \
     35 strerr_warn((x1),(x2),(x3),0,0,0,(se))
     36 #define strerr_warn2(x1,x2,se) \
     37 strerr_warn((x1),(x2),0,0,0,0,(se))
     38 #define strerr_warn1(x1,se) \
     39 strerr_warn((x1),0,0,0,0,0,(se))
     40 
     41 #define strerr_die6(e,x1,x2,x3,x4,x5,x6,se) \
     42 strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),(se))
     43 #define strerr_die5(e,x1,x2,x3,x4,x5,se) \
     44 strerr_die((e),(x1),(x2),(x3),(x4),(x5),0,(se))
     45 #define strerr_die4(e,x1,x2,x3,x4,se) \
     46 strerr_die((e),(x1),(x2),(x3),(x4),0,0,(se))
     47 #define strerr_die3(e,x1,x2,x3,se) \
     48 strerr_die((e),(x1),(x2),(x3),0,0,0,(se))
     49 #define strerr_die2(e,x1,x2,se) \
     50 strerr_die((e),(x1),(x2),0,0,0,0,(se))
     51 #define strerr_die1(e,x1,se) \
     52 strerr_die((e),(x1),0,0,0,0,0,(se))
     53 
     54 #define strerr_die6sys(e,x1,x2,x3,x4,x5,x6) \
     55 strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),&strerr_sys)
     56 #define strerr_die5sys(e,x1,x2,x3,x4,x5) \
     57 strerr_die((e),(x1),(x2),(x3),(x4),(x5),0,&strerr_sys)
     58 #define strerr_die4sys(e,x1,x2,x3,x4) \
     59 strerr_die((e),(x1),(x2),(x3),(x4),0,0,&strerr_sys)
     60 #define strerr_die3sys(e,x1,x2,x3) \
     61 strerr_die((e),(x1),(x2),(x3),0,0,0,&strerr_sys)
     62 #define strerr_die2sys(e,x1,x2) \
     63 strerr_die((e),(x1),(x2),0,0,0,0,&strerr_sys)
     64 #define strerr_die1sys(e,x1) \
     65 strerr_die((e),(x1),0,0,0,0,0,&strerr_sys)
     66 
     67 #define strerr_die6x(e,x1,x2,x3,x4,x5,x6) \
     68 strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),0)
     69 #define strerr_die5x(e,x1,x2,x3,x4,x5) \
     70 strerr_die((e),(x1),(x2),(x3),(x4),(x5),0,0)
     71 #define strerr_die4x(e,x1,x2,x3,x4) \
     72 strerr_die((e),(x1),(x2),(x3),(x4),0,0,0)
     73 #define strerr_die3x(e,x1,x2,x3) \
     74 strerr_die((e),(x1),(x2),(x3),0,0,0,0)
     75 #define strerr_die2x(e,x1,x2) \
     76 strerr_die((e),(x1),(x2),0,0,0,0,0)
     77 #define strerr_die1x(e,x1) \
     78 strerr_die((e),(x1),0,0,0,0,0,0)
     79 
     80 #endif