2 * Copyright (c) 1990,1994 Regents of The University of Michigan.
3 * All Rights Reserved. See COPYRIGHT.
10 #include <sys/syslog.h>
11 #include <sys/param.h>
18 struct comstate *comstate;
20 char *comcont = "%%+";
27 comstate = cs->cs_prev;
32 struct papd_comment *comment;
36 if (( cs = (struct comstate *)malloc( sizeof( struct comstate ))) ==
38 syslog( LOG_ERR, "malloc: %m" );
42 cs->cs_comment = comment;
43 cs->cs_prev = comstate;
48 comswitch( comments, handler )
49 struct papd_comment *comments;
52 struct papd_comment *c, *comment = NULL;
54 for ( c = comments; c->c_begin; c++ ) {
55 if ( c->c_handler == handler ) {
59 if ( comment == NULL || comment->c_handler != handler ) {
60 syslog( LOG_ERR, "comswitch: can't find handler!" );
68 comcmp( start, stop, str, how )
69 char *start, *stop, *str;
77 if ( cc == len & strncmp( str, start, cc ) == 0 ) {
81 if ( cc <= len && strncmp( str, start, cc ) == 0 ) {
90 commatch( start, stop, comments )
92 struct papd_comment comments[];
94 struct papd_comment *comment;
96 for ( comment = comments; comment->c_begin; comment++ ) {
97 if ( comcmp( start, stop, comment->c_begin, comment->c_flags ) == 0 ) {
101 if ( comment->c_begin ) {
109 comtoken( start, stop, pos, delim )
110 char *start, *stop, *pos, *delim;
112 if ( pos < start || pos > stop ) {
116 for ( ; pos < stop; pos++ ) {
117 if ( index( delim, *pos )) {
121 if ( ++pos < stop ) {