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;
31 void compush( comment )
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 int 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 int 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) ) {
89 struct papd_comment *commatch( start, stop, comments )
91 struct papd_comment comments[];
93 struct papd_comment *comment;
95 for ( comment = comments; comment->c_begin; comment++ ) {
96 if ( comcmp( start, stop, comment->c_begin, comment->c_flags ) == 0 ) {
100 if ( comment->c_begin ) {
107 char *comtoken( start, stop, pos, delim )
108 char *start, *stop, *pos, *delim;
110 if ( pos < start || pos > stop ) {
114 for ( ; pos < stop; pos++ ) {
115 if ( index( delim, *pos )) {
119 if ( ++pos < stop ) {