]> arthur.barton.de Git - netatalk.git/blobdiff - etc/papd/comment.c
replace remaining %m printf glibc extension with %s strerror(errno)
[netatalk.git] / etc / papd / comment.c
index db89202dcce3d67780319202adb6421ec6da88e5..869c028e69c6b7419487e8c0ca9b1f5c797f1fef 100644 (file)
@@ -1,13 +1,20 @@
 /*
+ * $Id: comment.c,v 1.8.10.1 2008-11-14 10:04:52 didg Exp $
+ *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
  */
 
-#include <sys/syslog.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <atalk/logger.h>
 #include <sys/param.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 #include "comment.h"
 
@@ -15,7 +22,7 @@ struct comstate       *comstate;
 
 char   *comcont = "%%+";
 
-compop()
+void compop( void )
 {
     struct comstate    *cs;
 
@@ -24,14 +31,14 @@ compop()
     free( cs );
 }
 
-compush( comment )
-    struct comment     *comment;
+void compush( comment )
+    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 );
     }
 
@@ -41,11 +48,11 @@ compush( comment )
     comstate = cs;
 }
 
-comswitch( comments, handler )
-    struct comment     *comments;
+int comswitch( comments, handler )
+    struct papd_comment        *comments;
     int                        (*handler)();
 {
-    struct comment     *c, *comment = NULL;
+    struct papd_comment        *c, *comment = NULL;
 
     for ( c = comments; c->c_begin; c++ ) {
        if ( c->c_handler == handler ) {
@@ -53,7 +60,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();
@@ -61,7 +68,7 @@ comswitch( comments, handler )
     return( 0 );
 }
 
-comcmp( start, stop, str, how )
+int comcmp( start, stop, str, how )
     char       *start, *stop, *str;
     int                how;
 {
@@ -70,11 +77,11 @@ comcmp( start, stop, str, how )
     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 );
        }
     }
@@ -82,12 +89,11 @@ comcmp( start, stop, str, how )
     return( 1 );
 }
 
-    struct comment *
-commatch( start, stop, comments )
+struct papd_comment *commatch( start, stop, comments )
     char               *start, *stop;
-    struct comment     comments[];
+    struct papd_comment        comments[];
 {
-    struct comment     *comment;
+    struct papd_comment        *comment;
 
     for ( comment = comments; comment->c_begin; comment++ ) {
        if ( comcmp( start, stop, comment->c_begin, comment->c_flags ) == 0 ) {
@@ -101,8 +107,7 @@ commatch( start, stop, comments )
     }
 }
 
-    char *
-comtoken( start, stop, pos, delim )
+char *comtoken( start, stop, pos, delim )
     char       *start, *stop, *pos, *delim;
 {
     if ( pos < start || pos > stop ) {