]> arthur.barton.de Git - netatalk.git/blob - etc/papd/headers.c
Warning fixes.
[netatalk.git] / etc / papd / headers.c
1 /*
2  * Copyright (c) 1990,1994 Regents of The University of Michigan.
3  * All Rights Reserved.  See COPYRIGHT.
4  */
5
6 #ifdef HAVE_CONFIG_H
7 #include "config.h" 
8 #endif
9
10 #include <sys/syslog.h>
11 #include <sys/param.h>
12 #include <stdio.h>
13
14 #include "file.h"
15 #include "comment.h"
16 #include "lp.h"
17
18 int ch_title( struct papfile *, struct papfile * );
19
20 int ch_title( in, out )
21     struct papfile      *in, *out;
22 {
23     char                *start, *stop, *p, *q, c;
24     int                 linelength, crlflength;
25
26     switch ( markline( in, &start, &linelength, &crlflength )) {
27     case 0 :
28         return( 0 );
29
30     case -1 :
31         return( CH_MORE );
32     }
33
34     stop = start + linelength;
35     for ( p = start; p < stop; p++ ) {
36         if ( *p == ':' ) {
37             break;
38         }
39     }
40
41     for ( ; p < stop; p++ ) {
42         if ( *p == '(' ) {
43             break;
44         }
45     }
46
47     for ( q = p; q < stop; q++ ) {
48         if ( *q == ')' ) {
49             break;
50         }
51     }
52
53     if ( q < stop && p < stop ) {
54         p++;
55         c = *q;
56         *q = '\0';
57         lp_job( p );
58         *q = c;
59     }
60
61     lp_write( start, linelength + crlflength );
62     compop();
63     CONSUME( in, linelength + crlflength );
64     return( CH_DONE );
65 }
66
67 /*
68  * "Header" comments.
69  */
70 struct papd_comment     headers[] = {
71     { "%%Title:",                       0,              ch_title,       0 },
72     { 0 },
73 };