]> arthur.barton.de Git - netatalk.git/blob - etc/papd/headers.c
implemented config.h
[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
17 ch_title( in, out )
18     struct papfile      *in, *out;
19 {
20     char                *start, *stop, *p, *q, c;
21     int                 linelength, crlflength;
22     struct comment      *comment = compeek();
23
24     switch ( markline( in, &start, &linelength, &crlflength )) {
25     case 0 :
26         return( 0 );
27
28     case -1 :
29         return( CH_MORE );
30     }
31
32     stop = start + linelength;
33     for ( p = start; p < stop; p++ ) {
34         if ( *p == ':' ) {
35             break;
36         }
37     }
38
39     for ( ; p < stop; p++ ) {
40         if ( *p == '(' ) {
41             break;
42         }
43     }
44
45     for ( q = p; q < stop; q++ ) {
46         if ( *q == ')' ) {
47             break;
48         }
49     }
50
51     if ( q < stop && p < stop ) {
52         p++;
53         c = *q;
54         *q = '\0';
55         lp_job( p );
56         *q = c;
57     }
58
59     lp_write( start, linelength + crlflength );
60     compop();
61     CONSUME( in, linelength + crlflength );
62     return( CH_DONE );
63 }
64
65 /*
66  * "Header" comments.
67  */
68 struct comment  headers[] = {
69     { "%%Title:",                       0,              ch_title,       0 },
70     { 0 },
71 };