]> arthur.barton.de Git - netatalk.git/blobdiff - etc/papd/main.c
sys/syslog.h -> syslog.h
[netatalk.git] / etc / papd / main.c
index be4d84f674472b014a801f4501f46c8cb2544ea1..5ef7e65b32b0107d81a570bf90cc69a80fac3784 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.c,v 1.7 2001-06-25 20:13:45 rufustfirefly Exp $
+ * $Id: main.c,v 1.13.2.1 2002-03-12 15:44:38 srittau Exp $
  *
  * Copyright (c) 1990,1995 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -10,7 +10,6 @@
 #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>
@@ -140,7 +165,6 @@ int main( ac, av )
     char       **av;
 {
     extern char         *optarg;
-    extern int          optind;
 
     ATP                        atp;
     struct atp_block   atpb;
@@ -187,7 +211,7 @@ int main( ac, av )
     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;
@@ -208,6 +232,11 @@ int main( ac, av )
            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",
@@ -314,7 +343,7 @@ int main( ac, av )
            if ( FD_ISSET( atp_fileno( pr->p_atp ), &fdset )) {
                int             err = 0;
 
-               bzero( &sat, sizeof( struct sockaddr_at ));
+               memset( &sat, 0, sizeof( struct sockaddr_at ));
 #ifdef BSD4_4
                sat.sat_len = sizeof( struct sockaddr_at );
 #endif /* BSD4_4 */
@@ -532,7 +561,7 @@ void getprinters( cf )
            perror( "malloc" );
            exit( 1 );
        }
-       bzero( pr, sizeof( struct printer ));
+       memset( pr, 0, sizeof( struct printer ));
 
        name = defprinter.p_name;
        type = defprinter.p_type;