/*
- * $Id: main.c,v 1.9 2001-08-03 22:13:28 srittau Exp $
+ * $Id: main.c,v 1.14 2002-01-03 17:49:39 sibaz Exp $
*
* Copyright (c) 1990,1995 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#endif /* HAVE_CONFIG_H */
#include <sys/param.h>
-#include <sys/types.h>
#include <sys/time.h>
#include <sys/uio.h>
#if defined( sun ) && defined( __svr4__ )
#include <sys/file.h>
#endif /* sun && __svr4__ */
#include <sys/socket.h>
-#include <sys/syslog.h>
+#include <syslog.h>
+
+/* POSIX.1 sys/wait.h check */
+#include <sys/types.h>
+#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif /* HAVE_SYS_WAIT_H */
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif /* ! WEXITSTATUS */
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif /* ! WIFEXITED */
+
#include <errno.h>
+/* STDC check */
+#if STDC_HEADERS
#include <string.h>
+#else /* STDC_HEADERS */
+#ifndef HAVE_STRCHR
+#define strchr index
+#define strrchr index
+#endif /* HAVE_STRCHR */
+char *strchr (), *strrchr ();
+#ifndef HAVE_MEMCPY
+#define memcpy(d,s,n) bcopy ((s), (d), (n))
+#define memmove(d,s,n) bcopy ((s), (d), (n))
+#endif /* ! HAVE_MEMCPY */
+#endif /* STDC_HEADERS */
+
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
defprinter.p_pagecost_msg = NULL;
defprinter.p_lock = "lock";
- while (( c = getopt( ac, av, "adf:p:P:" )) != EOF ) {
+ while (( c = getopt( ac, av, "adf:p:P:v" )) != EOF ) {
switch ( c ) {
case 'a' : /* for compatibility with old papd */
break;
pidfile = optarg;
break;
+ case 'v' : /* version */
+ printf( "papd (version %s)\n", VERSION );
+ exit ( 1 );
+ break;
+
default :
fprintf( stderr,
"Usage:\t%s [ -d ] [ -f conffile ] [ -p printcap ]\n",