関数 | |
static dbg_Token | modechange (dbg_Token newmode, dbg_Token mode) |
static void | newblock (dbg_Token old, dbg_Token newtok) |
static void | charprint (dbg_Token tok, int c) |
int | main (int argc, char *argv[]) |
debug2html.c の 72 行で定義されています。
参照先 dbg_ignore・dbg_message・dbg_null・printf().
参照元 main().
00076 : new - The token value of the current token. This indicates 00077 * the lexical item currently being recognized. 00078 * mode - The current mode. This is either dbg_null or 00079 * dbg_message. It could really be any toggle 00080 * (true/false, etc.) 00081 * 00082 * Output: The new mode. This will be the same as the input mode unless 00083 * there was a transition in or out of message processing. 00084 * 00085 * Notes: The purpose of the mode value is to mark the beginning and end 00086 * of the message text block. In order to show the text in its 00087 * correct format, it must be included within a <PRE></PRE> block. 00088 * 00089 * ------------------------------------------------------------------------ ** 00090 */ 00091 { 00092 switch( newmode ) 00093 { 00094 case dbg_null: 00095 case dbg_ignore: 00096 return( mode ); 00097 case dbg_message: 00098 if( dbg_message != mode ) 00099 { 00100 /* Switching to message mode. */ 00101 (void)printf( "<PRE>\n" ); 00102 return( dbg_message ); 00103 } 00104 break; 00105 default: 00106 if( dbg_message == mode ) 00107 { 00108 /* Switching out of message mode. */ 00109 (void)printf( "</PRE>\n\n" ); 00110 return( dbg_null ); 00111 } 00112 } 00113 00114 return( mode ); 00115 } /* modechange */
debug2html.c の 117 行で定義されています。
参照先 dbg_level・dbg_lineno・dbg_sourcefile・dbg_timestamp・printf().
参照元 main().
00121 : old - The previous token. 00122 * new - The current token. 00123 * 00124 * Output: none. 00125 * 00126 * Notes: This is called whenever there is a transition from one token 00127 * type to another. It first prints the markup tags that close 00128 * the previous token, and then the markup tags for the new 00129 * token. 00130 * 00131 * ------------------------------------------------------------------------ ** 00132 */ 00133 { 00134 switch( old ) 00135 { 00136 case dbg_timestamp: 00137 (void)printf( ",</B>" ); 00138 break; 00139 case dbg_level: 00140 (void)printf( "</FONT>]</B>\n " ); 00141 break; 00142 case dbg_sourcefile: 00143 (void)printf( ":" ); 00144 break; 00145 case dbg_lineno: 00146 (void)printf( ")" ); 00147 break; 00148 default: 00149 break; 00150 } 00151 00152 switch( newtok ) 00153 { 00154 case dbg_timestamp: 00155 (void)printf( "<B>[" ); 00156 break; 00157 case dbg_level: 00158 (void)printf( " <B><FONT COLOR=MAROON>" ); 00159 break; 00160 case dbg_lineno: 00161 (void)printf( "(" ); 00162 break; 00163 default: 00164 break; 00165 } 00166 } /* newblock */
static void charprint | ( | dbg_Token | tok, | |
int | c | |||
) | [static] |
debug2html.c の 168 行で定義されています。
参照先 dbg_eof・dbg_header・dbg_ignore・dbg_null・printf().
参照元 main().
00172 : tok - The token value of the current character. 00173 * c - The current character. 00174 * 00175 * Output: none. 00176 * 00177 * ------------------------------------------------------------------------ ** 00178 */ 00179 { 00180 switch( tok ) 00181 { 00182 case dbg_ignore: 00183 case dbg_header: 00184 break; 00185 case dbg_null: 00186 case dbg_eof: 00187 (void)putchar( '\n' ); 00188 break; 00189 default: 00190 switch( c ) 00191 { 00192 case '<': 00193 (void)printf( "<" ); 00194 break; 00195 case '>': 00196 (void)printf( ">" ); 00197 break; 00198 case '&': 00199 (void)printf( "&" ); 00200 break; 00201 case '\"': 00202 (void)printf( """ ); 00203 break; 00204 default: 00205 (void)putchar( c ); 00206 break; 00207 } 00208 } 00209 } /* charprint */
int main | ( | int | argc, | |
char * | argv[] | |||
) |
debug2html.c の 211 行で定義されています。
参照先 bufr・charprint()・dbg_char2token()・dbg_eof・dbg_null・len・mode・modechange()・newblock()・printf().
00216 : argc - Currently ignored. 00217 * argv - Currently ignored. 00218 * 00219 * Output: Always zero. 00220 * 00221 * Notes: The HTML output is sent to stdout. 00222 * 00223 * ------------------------------------------------------------------------ ** 00224 */ 00225 { 00226 int i; 00227 int len; 00228 char bufr[DBG_BSIZE]; 00229 dbg_Token old = dbg_null, 00230 newtok = dbg_null, 00231 state = dbg_null, 00232 mode = dbg_null; 00233 00234 (void)printf( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n" ); 00235 (void)printf( "<HTML>\n<HEAD>\n" ); 00236 (void)printf( " <TITLE>Samba Debug Output</TITLE>\n</HEAD>\n\n<BODY>\n" ); 00237 00238 while( (!feof( stdin )) 00239 && ((len = fread( bufr, 1, DBG_BSIZE, stdin )) > 0) ) 00240 { 00241 for( i = 0; i < len; i++ ) 00242 { 00243 old = newtok; 00244 newtok = dbg_char2token( &state, bufr[i] ); 00245 if( newtok != old ) 00246 { 00247 mode = modechange( newtok, mode ); 00248 newblock( old, newtok ); 00249 } 00250 charprint( newtok, bufr[i] ); 00251 } 00252 } 00253 (void)modechange( dbg_eof, mode ); 00254 00255 (void)printf( "</BODY>\n</HTML>\n" ); 00256 return( 0 ); 00257 } /* main */