]> arthur.barton.de Git - netatalk.git/blobdiff - etc/papd/comment.c
Remove bdb env on exit
[netatalk.git] / etc / papd / comment.c
index 71b6d58f68a856bafc1172dcb5978e983094ae0a..1a2964d6f6a7f86b03336d742d2476d5d30b896e 100644 (file)
@@ -1,17 +1,20 @@
 /*
+ * $Id: comment.c,v 1.10 2009-10-13 22:55:37 didg Exp $
+ *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
  */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
+#endif /* HAVE_CONFIG_H */
 
-#include <sys/syslog.h>
+#include <atalk/logger.h>
 #include <sys/param.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 #include "comment.h"
 
@@ -19,7 +22,7 @@ struct comstate       *comstate;
 
 char   *comcont = "%%+";
 
-compop()
+void compop( void )
 {
     struct comstate    *cs;
 
@@ -28,14 +31,13 @@ compop()
     free( cs );
 }
 
-compush( comment )
-    struct papd_comment        *comment;
+void compush(struct papd_comment *comment)
 {
     struct comstate    *cs;
 
     if (( cs = (struct comstate *)malloc( sizeof( struct comstate ))) ==
            NULL ) {
-       syslog( LOG_ERR, "malloc: %m" );
+       LOG(log_error, logtype_papd, "malloc: %s", strerror(errno) );
        exit( 1 );
     }
 
@@ -45,9 +47,7 @@ compush( comment )
     comstate = cs;
 }
 
-comswitch( comments, handler )
-    struct papd_comment        *comments;
-    int                        (*handler)();
+int comswitch(struct papd_comment *comments, int (*handler)())
 {
     struct papd_comment        *c, *comment = NULL;
 
@@ -57,7 +57,7 @@ comswitch( comments, handler )
        }
     }
     if ( comment == NULL || comment->c_handler != handler ) {
-       syslog( LOG_ERR, "comswitch: can't find handler!" );
+       LOG(log_error, logtype_papd, "comswitch: can't find handler!" );
        return( -1 );
     }
     compop();
@@ -65,20 +65,18 @@ comswitch( comments, handler )
     return( 0 );
 }
 
-comcmp( start, stop, str, how )
-    char       *start, *stop, *str;
-    int                how;
+int comcmp( char *start, char *stop, char *str,int how)
 {
     int                cc, len;
 
     len = stop - start;
     cc = strlen( str );
     if ( how & C_FULL ) {
-       if ( cc == len & strncmp( str, start, cc ) == 0 ) {
+       if ( (cc == len) && (strncmp( str, start, cc ) == 0) ) {
            return( 0 );
        }
     } else {
-       if ( cc <= len && strncmp( str, start, cc ) == 0 ) {
+       if ( (cc <= len) && (strncmp( str, start, cc ) == 0) ) {
            return( 0 );
        }
     }
@@ -86,10 +84,7 @@ comcmp( start, stop, str, how )
     return( 1 );
 }
 
-    struct papd_comment *
-commatch( start, stop, comments )
-    char               *start, *stop;
-    struct papd_comment        comments[];
+struct papd_comment *commatch( char *start, char *stop, struct papd_comment comments[])
 {
     struct papd_comment        *comment;
 
@@ -105,9 +100,7 @@ commatch( start, stop, comments )
     }
 }
 
-    char *
-comtoken( start, stop, pos, delim )
-    char       *start, *stop, *pos, *delim;
+char *comtoken( char *start, char *stop, char *pos, char *delim)
 {
     if ( pos < start || pos > stop ) {
        abort();