apcupsd-ups: add NEWS and man page link
[networkupstools/kirr.git] / include / proto.h
blob9c691146abfc71ae13d98274908c6d78fb6177de
1 #ifndef PROTO_H
2 #define PROTO_H
4 #include "attribute.h"
6 #ifdef __cplusplus
7 /* *INDENT-OFF* */
8 extern "C" {
9 /* *INDENT-ON* */
10 #endif
12 #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
14 /* Define this as a fall through, HAVE_STDARG_H is probably already set */
16 #ifndef HAVE_VARARGS_H
17 #define HAVE_VARARGS_H
18 #endif
20 /* varargs declarations: */
22 #if defined(HAVE_STDARG_H)
23 # include <stdarg.h>
24 # define HAVE_STDARGS /* let's hope that works everywhere (mj) */
25 # define VA_LOCAL_DECL va_list ap
26 # define VA_START(f) va_start(ap, f)
27 # define VA_SHIFT(v,t) ; /* no-op for ANSI */
28 # define VA_END va_end(ap)
29 #else
30 # if defined(HAVE_VARARGS_H)
31 # include <varargs.h>
32 # undef HAVE_STDARGS
33 # define VA_LOCAL_DECL va_list ap
34 # define VA_START(f) va_start(ap) /* f is ignored! */
35 # define VA_SHIFT(v,t) v = va_arg(ap,t)
36 # define VA_END va_end(ap)
37 # else
38 /*XX ** NO VARARGS ** XX*/
39 # endif
40 #endif
42 #if !defined (HAVE_SNPRINTF) || defined (__Lynx__)
43 int snprintf (char *str, size_t count, const char *fmt, ...)
44 __attribute__ ((__format__ (__printf__, 3, 4)));
45 #endif
47 #if !defined (HAVE_VSNPRINTF)
48 int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
49 #endif
51 #endif
53 #ifndef HAVE_SETENV
54 int nut_setenv(const char *name, const char *value, int overwrite);
55 static inline int setenv(const char *name, const char *value, int overwrite) {
56 return nut_setenv(name, value, overwrite);
58 #endif
60 #ifdef __hpux
61 #ifdef HAVE_SYS_MODEM_H
62 #include <sys/modem.h>
63 #endif
64 /* See sys/termio.h and sys/modem.h
65 The following serial bits are not defined by HPUX.
66 The numbers are octal like I found in BSD.
67 TIOCM_ST is used in genericups.[ch] for the Powerware 3115.
68 These defines make it compile, but I have no idea if it works.
70 #define TIOCM_LE 0001 /* line enable */
71 #define TIOCM_ST 0010 /* secondary transmit */
72 #define TIOCM_SR 0020 /* secondary receive */
73 #endif
75 #ifdef HAVE_GETPASSPHRASE
76 #define GETPASS getpassphrase
77 #else
78 #define GETPASS getpass
79 #endif
81 #ifdef __Lynx__
82 /* Missing prototypes on LynxOS */
83 int seteuid(uid_t);
84 int vprintf(const char *, va_list);
85 int putenv(char *);
86 #endif
88 #ifdef __cplusplus
89 /* *INDENT-OFF* */
91 /* *INDENT-ON* */
92 #endif
94 #endif /* PROTO_H */