]> arthur.barton.de Git - netatalk.git/blob - etc/papd/headers.c
prototyping to allow the compiler to do some real argument checking
[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     struct papd_comment *comment = compeek();
26
27     switch ( markline( in, &start, &linelength, &crlflength )) {
28     case 0 :
29         return( 0 );
30
31     case -1 :
32         return( CH_MORE );
33     }
34
35     stop = start + linelength;
36     for ( p = start; p < stop; p++ ) {
37         if ( *p == ':' ) {
38             break;
39         }
40     }
41
42     for ( ; p < stop; p++ ) {
43         if ( *p == '(' ) {
44             break;
45         }
46     }
47
48     for ( q = p; q < stop; q++ ) {
49         if ( *q == ')' ) {
50             break;
51         }
52     }
53
54     if ( q < stop && p < stop ) {
55         p++;
56         c = *q;
57         *q = '\0';
58         lp_job( p );
59         *q = c;
60     }
61
62     lp_write( start, linelength + crlflength );
63     compop();
64     CONSUME( in, linelength + crlflength );
65     return( CH_DONE );
66 }
67
68 /*
69  * "Header" comments.
70  */
71 struct papd_comment     headers[] = {
72     { "%%Title:",                       0,              ch_title,       0 },
73     { 0 },
74 };