2 * $Id: comment.c,v 1.8 2002-09-29 23:29:13 sibaz Exp $
4 * Copyright (c) 1990,1994 Regents of The University of Michigan.
5 * All Rights Reserved. See COPYRIGHT.
10 #endif /* HAVE_CONFIG_H */
12 #include <atalk/logger.h>
13 #include <sys/param.h>
20 struct comstate *comstate;
22 char *comcont = "%%+";
29 comstate = cs->cs_prev;
33 void compush( comment )
34 struct papd_comment *comment;
38 if (( cs = (struct comstate *)malloc( sizeof( struct comstate ))) ==
40 LOG(log_error, logtype_papd, "malloc: %m" );
44 cs->cs_comment = comment;
45 cs->cs_prev = comstate;
50 int comswitch( comments, handler )
51 struct papd_comment *comments;
54 struct papd_comment *c, *comment = NULL;
56 for ( c = comments; c->c_begin; c++ ) {
57 if ( c->c_handler == handler ) {
61 if ( comment == NULL || comment->c_handler != handler ) {
62 LOG(log_error, logtype_papd, "comswitch: can't find handler!" );
70 int comcmp( start, stop, str, how )
71 char *start, *stop, *str;
79 if ( (cc == len) && (strncmp( str, start, cc ) == 0) ) {
83 if ( (cc <= len) && (strncmp( str, start, cc ) == 0) ) {
91 struct papd_comment *commatch( start, stop, comments )
93 struct papd_comment comments[];
95 struct papd_comment *comment;
97 for ( comment = comments; comment->c_begin; comment++ ) {
98 if ( comcmp( start, stop, comment->c_begin, comment->c_flags ) == 0 ) {
102 if ( comment->c_begin ) {
109 char *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 ) {