2 * Copyright (c) 1990,1994 Regents of The University of Michigan.
3 * All Rights Reserved. See COPYRIGHT.
6 #include <sys/syslog.h>
14 struct comstate *comstate;
16 char *comcont = "%%+";
23 comstate = cs->cs_prev;
28 struct comment *comment;
32 if (( cs = (struct comstate *)malloc( sizeof( struct comstate ))) ==
34 syslog( LOG_ERR, "malloc: %m" );
38 cs->cs_comment = comment;
39 cs->cs_prev = comstate;
44 comswitch( comments, handler )
45 struct comment *comments;
48 struct comment *c, *comment = NULL;
50 for ( c = comments; c->c_begin; c++ ) {
51 if ( c->c_handler == handler ) {
55 if ( comment == NULL || comment->c_handler != handler ) {
56 syslog( LOG_ERR, "comswitch: can't find handler!" );
64 comcmp( start, stop, str, how )
65 char *start, *stop, *str;
73 if ( cc == len & strncmp( str, start, cc ) == 0 ) {
77 if ( cc <= len && strncmp( str, start, cc ) == 0 ) {
86 commatch( start, stop, comments )
88 struct comment comments[];
90 struct comment *comment;
92 for ( comment = comments; comment->c_begin; comment++ ) {
93 if ( comcmp( start, stop, comment->c_begin, comment->c_flags ) == 0 ) {
97 if ( comment->c_begin ) {
105 comtoken( start, stop, pos, delim )
106 char *start, *stop, *pos, *delim;
108 if ( pos < start || pos > stop ) {
112 for ( ; pos < stop; pos++ ) {
113 if ( index( delim, *pos )) {
117 if ( ++pos < stop ) {