150488Speter/* $FreeBSD$ 232672Sache * 332672Sache * $Log: util.h,v $ 432672Sache * Revision 2.0 86/09/17 15:40:06 lwall 532672Sache * Baseline for netwide release. 632672Sache * 732672Sache */ 832672Sache 932672Sache/* and for those machine that can't handle a variable argument list */ 1032672Sache 1132672Sache#ifdef CANVARARG 1232672Sache 1332672Sache#define say1 say 1432672Sache#define say2 say 1532672Sache#define say3 say 1632672Sache#define say4 say 1732672Sache#define ask1 ask 1832672Sache#define ask2 ask 1932672Sache#define ask3 ask 2032672Sache#define ask4 ask 2132672Sache#define fatal1 fatal 2232672Sache#define fatal2 fatal 2332672Sache#define fatal3 fatal 2432672Sache#define fatal4 fatal 2532672Sache#define pfatal1 pfatal 2632672Sache#define pfatal2 pfatal 2732672Sache#define pfatal3 pfatal 2832672Sache#define pfatal4 pfatal 2932672Sache 3032672Sache#else /* hope they allow multi-line macro actual arguments */ 3132672Sache 3232672Sache#ifdef lint 3332672Sache 3432672Sache#define say1(a) say(a, 0, 0, 0) 3532672Sache#define say2(a,b) say(a, (b)==(b), 0, 0) 3632672Sache#define say3(a,b,c) say(a, (b)==(b), (c)==(c), 0) 3732672Sache#define say4(a,b,c,d) say(a, (b)==(b), (c)==(c), (d)==(d)) 3832672Sache#define ask1(a) ask(a, 0, 0, 0) 3932672Sache#define ask2(a,b) ask(a, (b)==(b), 0, 0) 4032672Sache#define ask3(a,b,c) ask(a, (b)==(b), (c)==(c), 0) 4132672Sache#define ask4(a,b,c,d) ask(a, (b)==(b), (c)==(c), (d)==(d)) 4232672Sache#define fatal1(a) fatal(a, 0, 0, 0) 4332672Sache#define fatal2(a,b) fatal(a, (b)==(b), 0, 0) 4432672Sache#define fatal3(a,b,c) fatal(a, (b)==(b), (c)==(c), 0) 4532672Sache#define fatal4(a,b,c,d) fatal(a, (b)==(b), (c)==(c), (d)==(d)) 4632672Sache#define pfatal1(a) pfatal(a, 0, 0, 0) 4732672Sache#define pfatal2(a,b) pfatal(a, (b)==(b), 0, 0) 4832672Sache#define pfatal3(a,b,c) pfatal(a, (b)==(b), (c)==(c), 0) 4932672Sache#define pfatal4(a,b,c,d) pfatal(a, (b)==(b), (c)==(c), (d)==(d)) 5032672Sache 5132672Sache#else /* lint */ 5232672Sache /* if this doesn't work, try defining CANVARARG above */ 5332672Sache#define say1(a) say(a, Nullch, Nullch, Nullch) 5432672Sache#define say2(a,b) say(a, b, Nullch, Nullch) 5532672Sache#define say3(a,b,c) say(a, b, c, Nullch) 5632672Sache#define say4 say 5732672Sache#define ask1(a) ask(a, Nullch, Nullch, Nullch) 5832672Sache#define ask2(a,b) ask(a, b, Nullch, Nullch) 5932672Sache#define ask3(a,b,c) ask(a, b, c, Nullch) 6032672Sache#define ask4 ask 6132672Sache#define fatal1(a) fatal(a, Nullch, Nullch, Nullch) 6232672Sache#define fatal2(a,b) fatal(a, b, Nullch, Nullch) 6332672Sache#define fatal3(a,b,c) fatal(a, b, c, Nullch) 6432672Sache#define fatal4 fatal 6532672Sache#define pfatal1(a) pfatal(a, Nullch, Nullch, Nullch) 6632672Sache#define pfatal2(a,b) pfatal(a, b, Nullch, Nullch) 6732672Sache#define pfatal3(a,b,c) pfatal(a, b, c, Nullch) 6832672Sache#define pfatal4 pfatal 6932672Sache 7032672Sache#endif /* lint */ 7132672Sache 7232672Sache/* if neither of the above work, join all multi-line macro calls. */ 7332672Sache#endif 7432672Sache 7532672SacheEXT char serrbuf[BUFSIZ]; /* buffer for stderr */ 7632672Sache 7795601Sgadchar *fetchname(char *_at, int _strip_leading, int _assume_exists); 7895601Sgadint move_file(char *_from, char *_to); 7995601Sgadvoid copy_file(char *_from, char *_to); 8095601Sgadvoid say(/*const char *pat, long _arg1, long _arg2, long _arg3*/); 8195601Sgadvoid fatal(); 8295601Sgadvoid pfatal(); 8395601Sgadint ask(/*const char *pat, long _arg1, long _arg2, long _arg3*/); 8495601Sgadchar *savestr(char *_s); 8595601Sgadvoid set_signals(int _reset); 8695601Sgadvoid ignore_signals(void); 8795601Sgadvoid makedirs(/*char *_filename, bool _striplast*/); 8895601Sgadchar *basename(); 89