diff options
Diffstat (limited to 'clients/zaway/zaway.c')
-rw-r--r-- | clients/zaway/zaway.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/clients/zaway/zaway.c b/clients/zaway/zaway.c index 8da42c9..5dfdc8d 100644 --- a/clients/zaway/zaway.c +++ b/clients/zaway/zaway.c @@ -11,34 +11,23 @@ * "mit-copyright.h". */ +#include <sysdep.h> #include <zephyr/mit-copyright.h> - #include <zephyr/zephyr.h> - #include <pwd.h> -#include <string.h> -#include <signal.h> +#include <com_err.h> #ifndef lint -static char rcsid_zaway_c[] = "$Id$"; +static const char rcsid_zaway_c[] = "$Id$"; #endif #define MESSAGE_CLASS "MESSAGE" #define DEFAULT_MSG "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n" -#ifdef POSIX -#include <stdlib.h> -#define SIGNAL_RETURN_TYPE void -#else -extern char *getenv(), *malloc(), *realloc(); -extern uid_t getuid(); -#define SIGNAL_RETURN_TYPE int -#endif - -SIGNAL_RETURN_TYPE cleanup(); +RETSIGTYPE cleanup(); u_short port; -main(argc,argv) +int main(argc,argv) int argc; char *argv[]; { @@ -50,7 +39,7 @@ main(argc,argv) register char *ptr; char awayfile[BUFSIZ],*msg[2],*envptr; char *find_message(); -#ifdef POSIX +#ifdef _POSIX_VERSION struct sigaction sa; #endif @@ -89,7 +78,7 @@ main(argc,argv) fprintf(stderr,"File %s not found!\n",awayfile); exit(1); } -#ifdef POSIX +#ifdef _POSIX_VERSION (void) sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sa.sa_handler = cleanup; @@ -101,7 +90,7 @@ main(argc,argv) (void) signal(SIGTERM, cleanup); (void) signal(SIGHUP, cleanup); #endif - if ((retval = ZSubscribeTo(&sub,1,port)) != ZERR_NONE) { + if ((retval = ZSubscribeToSansDefaults(&sub,1,port)) != ZERR_NONE) { com_err(argv[0],retval,"while subscribing"); exit(1); } @@ -199,7 +188,7 @@ char *find_message(notice,fp) return (ptr); } -SIGNAL_RETURN_TYPE cleanup() +RETSIGTYPE cleanup() { ZCancelSubscriptions(port); exit(1); |