]> arthur.barton.de Git - netatalk.git/blobdiff - etc/papd/file.c
merge papd changes from HEAD
[netatalk.git] / etc / papd / file.c
index 50a6986168ad6a57177b29138d0efb7776644dd6..1517c0c380c1b2ba46c363473b6a2e1331957103 100644 (file)
@@ -1,13 +1,15 @@
 /*
+ * $Id: file.c,v 1.9.12.1 2009-02-03 08:25:00 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>
@@ -15,7 +17,9 @@
 
 #include "file.h"
 
-markline( pf, start, linelength, crlflength )
+/* 
+*/
+int markline( pf, start, linelength, crlflength )
     char               **start;
     int                        *linelength, *crlflength;
     struct papfile     *pf;
@@ -51,13 +55,20 @@ markline( pf, start, linelength, crlflength )
     (p[*crlflength]=='\r' || p[*crlflength]=='\n')) {
        (*crlflength)++;
     }
+    
+    if (!*crlflength) {
+        /* line is way too long, something fishy is going on, give up */
+        LOG(log_error, logtype_papd, "markline: no crlf in comment, give up" );
+        return( -2 );
+    }
 
-    return *linelength;
+    /* success, return 1 */
+    return( 1 );
 }
 
-morespace( pf, data, len )
+void morespace( pf, data, len )
     struct papfile     *pf;
-    char               *data;
+    const char         *data;
     int                        len;
 {
     char               *nbuf;
@@ -90,22 +101,22 @@ morespace( pf, data, len )
 }
 
 
-append(pf, data, len)
+void append(pf, data, len)
     struct papfile     *pf;
-    char               *data;
+    const char         *data;
     int                        len;
 {
     if ((pf->pf_data + pf->pf_datalen + len) >
        (pf->pf_buf + pf->pf_bufsize)) {
                morespace(pf, data, len);
     } else {
-       bcopy(data, pf->pf_data + pf->pf_datalen, len);
+       memcpy(pf->pf_data + pf->pf_datalen, data, len);
        pf->pf_datalen += len;
     }
 }
 
 
-spoolerror( out, str )
+void spoolerror( out, str )
     struct papfile     *out;
     char               *str;
 {