2 * $Id: comment.c,v 1.8.10.1 2008-11-14 10:04:52 didg 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>
21 struct comstate *comstate;
23 char *comcont = "%%+";
30 comstate = cs->cs_prev;
34 void compush( comment )
35 struct papd_comment *comment;
39 if (( cs = (struct comstate *)malloc( sizeof( struct comstate ))) ==
41 LOG(log_error, logtype_papd, "malloc: %s", strerror(errno) );
45 cs->cs_comment = comment;
46 cs->cs_prev = comstate;
51 int comswitch( comments, handler )
52 struct papd_comment *comments;
55 struct papd_comment *c, *comment = NULL;
57 for ( c = comments; c->c_begin; c++ ) {
58 if ( c->c_handler == handler ) {
62 if ( comment == NULL || comment->c_handler != handler ) {
63 LOG(log_error, logtype_papd, "comswitch: can't find handler!" );
71 int comcmp( start, stop, str, how )
72 char *start, *stop, *str;
80 if ( (cc == len) && (strncmp( str, start, cc ) == 0) ) {
84 if ( (cc <= len) && (strncmp( str, start, cc ) == 0) ) {
92 struct papd_comment *commatch( start, stop, comments )
94 struct papd_comment comments[];
96 struct papd_comment *comment;
98 for ( comment = comments; comment->c_begin; comment++ ) {
99 if ( comcmp( start, stop, comment->c_begin, comment->c_flags ) == 0 ) {
103 if ( comment->c_begin ) {
110 char *comtoken( start, stop, pos, delim )
111 char *start, *stop, *pos, *delim;
113 if ( pos < start || pos > stop ) {
117 for ( ; pos < stop; pos++ ) {
118 if ( index( delim, *pos )) {
122 if ( ++pos < stop ) {