~ubuntu-branches/ubuntu/precise/netatalk/precise

« back to all changes in this revision

Viewing changes to etc/papd/headers.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Rittau
  • Date: 2004-01-19 12:43:49 UTC
  • Revision ID: james.westby@ubuntu.com-20040119124349-es563jbp0hk0ae51
Tags: upstream-1.6.4
ImportĀ upstreamĀ versionĀ 1.6.4

Show diffs side-by-side

added added

removed removed

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