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