]> arthur.barton.de Git - netatalk.git/blobdiff - etc/papd/lp.c
Fix all remaining warnings from gcc -Wall that can be fixed
[netatalk.git] / etc / papd / lp.c
index 772250b25ae609c462ad2244394de97984355f94..3b817b9f4d3c7d1cdca4d496ad517b9dafcdf377 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: lp.c,v 1.27 2009-07-20 09:06:03 franklahm Exp $
+ * $Id: lp.c,v 1.31 2009-10-22 13:40:11 franklahm Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -92,11 +92,11 @@ int lp_disconn_inet( int );
 int lp_conn_unix();
 int lp_disconn_unix( int );
 
-char   hostname[ MAXHOSTNAMELEN ];
+static char hostname[ MAXHOSTNAMELEN ];
 
 extern struct sockaddr_at *sat;
 
-struct lp {
+static struct lp {
     int                        lp_flags;
     FILE               *lp_stream;
     int                        lp_seq;
@@ -127,7 +127,7 @@ static void convert_octal (char *string, charset_t dest)
     char temp[4];
     long int ch;
 
-    q=p=string;
+    q=p=(unsigned char *)string;
     while ( *p != '\0' ) {
         ch = 0;
         if ( *p == '\\' ) {
@@ -208,6 +208,8 @@ static void lp_setup_comments (charset_t dest)
 
 #define is_var(a, b) (strncmp((a), (b), 2) == 0)
 
+#if 0
+/* removed, it's not used and a pain to get it right from a security POV */
 static size_t quote(char *dest, char *src, const size_t bsize, size_t len)
 {
 size_t used = 0;
@@ -234,7 +236,6 @@ size_t used = 0;
     return used;
 }
 
-
 static char* pipexlate(char *src)
 {
     char *p, *q, *dest; 
@@ -302,10 +303,9 @@ static char* pipexlate(char *src)
     }
     return destbuf;
 }
+#endif
 
-
-void lp_person( person )
-    char       *person;
+void lp_person(char *person)
 {
     if ( lp.lp_person != NULL ) {
        free( lp.lp_person );
@@ -318,7 +318,7 @@ void lp_person( person )
 }
 
 #ifdef ABS_PRINT
-int lp_pagecost()
+int lp_pagecost(void)
 {
     char       cost[ 22 ];
     char       balance[ 22 ];
@@ -335,8 +335,7 @@ int lp_pagecost()
 }
 #endif /* ABS_PRINT */
 
-void lp_host( host )
-    char       *host;
+void lp_host( char *host)
 {
     if ( lp.lp_host != NULL ) {
        free( lp.lp_host );
@@ -354,8 +353,7 @@ void lp_host( host )
  * This should be added.
  */
 
-void lp_job( job )
-    char       *job;
+void lp_job(char *job)
 {
     if ( lp.lp_job != NULL ) {
        free( lp.lp_job );
@@ -368,8 +366,7 @@ void lp_job( job )
     
 }
 
-void lp_for ( lpfor )
-       char    *lpfor;
+void lp_for (char *lpfor)
 {
     if ( lp.lp_created_for != NULL ) {
        free( lp.lp_created_for );
@@ -379,9 +376,7 @@ void lp_for ( lpfor )
 }
 
 
-static int lp_init( out, sat )
-    struct papfile     *out;
-    struct sockaddr_at *sat;
+static int lp_init(struct papfile *out, struct sockaddr_at *sat)
 {
     int                authenticated = 0;
 #ifndef HAVE_CUPS
@@ -544,9 +539,7 @@ static int lp_init( out, sat )
     return( 0 );
 }
 
-int lp_open( out, sat )
-    struct papfile     *out;
-    struct sockaddr_at *sat;
+int lp_open(struct papfile *out, struct sockaddr_at *sat)
 {
     char       name[ MAXPATHLEN ];
     int                fd;
@@ -646,7 +639,7 @@ int lp_open( out, sat )
     return( 0 );
 }
 
-int lp_close()
+int lp_close(void)
 {
     if (( lp.lp_flags & LP_INIT ) == 0 || ( lp.lp_flags & LP_OPEN ) == 0 ) {
        return 0;
@@ -660,10 +653,7 @@ int lp_close()
 
 
 
-int lp_write(in, buf, len )
-    struct papfile *in;
-    char       *buf;
-    size_t     len;
+int lp_write(struct papfile *in, char *buf, size_t len)
 {
 #define BUFSIZE 32768
     static char tempbuf[BUFSIZE];
@@ -746,7 +736,7 @@ int lp_write(in, buf, len )
     return( 0 );
 }
 
-int lp_cancel()
+int lp_cancel(void)
 {
     char       name[ MAXPATHLEN ];
     char       letter;
@@ -775,7 +765,7 @@ int lp_cancel()
  *
  * XXX piped?
  */
-int lp_print()
+int lp_print(void)
 {
 #ifndef HAVE_CUPS
     char               buf[ MAXPATHLEN ];
@@ -899,7 +889,7 @@ int lp_disconn_unix( int fd )
     return( close( fd ));
 }
 
-int lp_conn_unix()
+int lp_conn_unix(void)
 {
     int                        s;
     struct sockaddr_un saun;
@@ -926,7 +916,7 @@ int lp_disconn_inet( int fd )
     return( close( fd ));
 }
 
-int lp_conn_inet()
+int lp_conn_inet(void)
 {
     int                        privfd, port = IPPORT_RESERVED - 1;
     struct sockaddr_in sin;
@@ -970,8 +960,7 @@ int lp_conn_inet()
     return( privfd );
 }
 
-int lp_rmjob( job )
-    int                job;
+int lp_rmjob( int job)
 {
     char       buf[ 1024 ];
     int                n, s;
@@ -1010,8 +999,7 @@ char       *tag_files = "files: ";
 char   *tag_size = "size: ";
 char   *tag_status = "status: ";
 
-int lp_queue( out )
-    struct papfile     *out;
+int lp_queue( struct papfile *out)
 {
     char                       buf[ 1024 ], *start, *stop, *p, *q;
     int                                linelength, crlflength;