"Fossies" - the Fresh Open Source Software Archive

Member "ragel-6.10/examples/mailbox.cpp" (24 Mar 2017, 27937 Bytes) of package /linux/misc/ragel-6.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "mailbox.cpp": 6.9_vs_6.10.

    1 
    2 #line 1 "mailbox.rl"
    3 /*
    4  * Parses unix mail boxes into headers and bodies.
    5  */
    6 
    7 #include <iostream>
    8 #include <stdlib.h>
    9 #include <stdio.h>
   10 #include <string.h>
   11 
   12 using namespace std;
   13 
   14 #define BUFSIZE 2048
   15 
   16 /* A growable buffer for collecting headers. */
   17 struct Buffer
   18 {
   19     Buffer() : data(0), allocated(0), length(0) { }
   20     ~Buffer() { empty(); }
   21 
   22     void append( char p ) {
   23         if ( ++length > allocated )
   24             upAllocate( length*2 );
   25         data[length-1] = p;
   26     }
   27         
   28     void clear() { length = 0; }
   29     void upAllocate( int len );
   30     void empty();
   31 
   32     char *data;
   33     int allocated;
   34     int length;
   35 };
   36 
   37 
   38 struct MailboxScanner
   39 {
   40     Buffer headName;
   41     Buffer headContent;
   42 
   43     int cs, top, stack[1];
   44 
   45     int init( );
   46     int execute( const char *data, int len, bool isEof );
   47     int finish( );
   48 };
   49 
   50 
   51 #line 137 "mailbox.rl"
   52 
   53 
   54 
   55 #line 56 "mailbox.cpp"
   56 static const int MailboxScanner_start = 100;
   57 static const int MailboxScanner_first_final = 100;
   58 static const int MailboxScanner_error = 0;
   59 
   60 static const int MailboxScanner_en_consumeHeader = 102;
   61 static const int MailboxScanner_en_printHeader = 103;
   62 static const int MailboxScanner_en_main = 100;
   63 
   64 
   65 #line 140 "mailbox.rl"
   66 
   67 int MailboxScanner::init( )
   68 {
   69     
   70 #line 71 "mailbox.cpp"
   71     {
   72     cs = MailboxScanner_start;
   73     top = 0;
   74     }
   75 
   76 #line 144 "mailbox.rl"
   77     return 1;
   78 }
   79 
   80 int MailboxScanner::execute( const char *data, int len, bool isEof )
   81 {
   82     const char *p = data;
   83     const char *pe = data + len;
   84     const char *eof = isEof ? pe : 0;
   85 
   86     
   87 #line 88 "mailbox.cpp"
   88     {
   89     if ( p == pe )
   90         goto _test_eof;
   91     goto _resume;
   92 
   93 _again:
   94     switch ( cs ) {
   95         case 100: goto st100;
   96         case 0: goto st0;
   97         case 1: goto st1;
   98         case 2: goto st2;
   99         case 3: goto st3;
  100         case 4: goto st4;
  101         case 5: goto st5;
  102         case 6: goto st6;
  103         case 7: goto st7;
  104         case 8: goto st8;
  105         case 9: goto st9;
  106         case 10: goto st10;
  107         case 11: goto st11;
  108         case 12: goto st12;
  109         case 13: goto st13;
  110         case 14: goto st14;
  111         case 15: goto st15;
  112         case 16: goto st16;
  113         case 17: goto st17;
  114         case 18: goto st18;
  115         case 19: goto st19;
  116         case 20: goto st20;
  117         case 21: goto st21;
  118         case 22: goto st22;
  119         case 23: goto st23;
  120         case 24: goto st24;
  121         case 25: goto st25;
  122         case 26: goto st26;
  123         case 27: goto st27;
  124         case 28: goto st28;
  125         case 29: goto st29;
  126         case 30: goto st30;
  127         case 31: goto st31;
  128         case 32: goto st32;
  129         case 33: goto st33;
  130         case 34: goto st34;
  131         case 101: goto st101;
  132         case 35: goto st35;
  133         case 36: goto st36;
  134         case 37: goto st37;
  135         case 38: goto st38;
  136         case 39: goto st39;
  137         case 40: goto st40;
  138         case 41: goto st41;
  139         case 42: goto st42;
  140         case 43: goto st43;
  141         case 44: goto st44;
  142         case 45: goto st45;
  143         case 46: goto st46;
  144         case 47: goto st47;
  145         case 48: goto st48;
  146         case 49: goto st49;
  147         case 50: goto st50;
  148         case 51: goto st51;
  149         case 52: goto st52;
  150         case 53: goto st53;
  151         case 54: goto st54;
  152         case 55: goto st55;
  153         case 56: goto st56;
  154         case 57: goto st57;
  155         case 58: goto st58;
  156         case 59: goto st59;
  157         case 60: goto st60;
  158         case 61: goto st61;
  159         case 62: goto st62;
  160         case 63: goto st63;
  161         case 64: goto st64;
  162         case 65: goto st65;
  163         case 66: goto st66;
  164         case 67: goto st67;
  165         case 68: goto st68;
  166         case 69: goto st69;
  167         case 70: goto st70;
  168         case 71: goto st71;
  169         case 72: goto st72;
  170         case 73: goto st73;
  171         case 74: goto st74;
  172         case 75: goto st75;
  173         case 76: goto st76;
  174         case 77: goto st77;
  175         case 78: goto st78;
  176         case 79: goto st79;
  177         case 80: goto st80;
  178         case 81: goto st81;
  179         case 82: goto st82;
  180         case 83: goto st83;
  181         case 84: goto st84;
  182         case 85: goto st85;
  183         case 86: goto st86;
  184         case 87: goto st87;
  185         case 88: goto st88;
  186         case 89: goto st89;
  187         case 90: goto st90;
  188         case 91: goto st91;
  189         case 92: goto st92;
  190         case 93: goto st93;
  191         case 94: goto st94;
  192         case 95: goto st95;
  193         case 96: goto st96;
  194         case 97: goto st97;
  195         case 102: goto st102;
  196         case 98: goto st98;
  197         case 103: goto st103;
  198         case 99: goto st99;
  199         case 104: goto st104;
  200     default: break;
  201     }
  202 
  203     if ( ++p == pe )
  204         goto _test_eof;
  205 _resume:
  206     switch ( cs )
  207     {
  208 st100:
  209     if ( ++p == pe )
  210         goto _test_eof100;
  211 case 100:
  212     if ( (*p) == 70 )
  213         goto st1;
  214     goto st0;
  215 tr101:
  216 #line 92 "mailbox.rl"
  217     {
  218         headContent.append(0);
  219         cout << headContent.data << endl;
  220         headContent.clear();
  221         p--;
  222         {cs = stack[--top];goto _again;}
  223     }
  224     goto st0;
  225 #line 226 "mailbox.cpp"
  226 st0:
  227 cs = 0;
  228     goto _out;
  229 st1:
  230     if ( ++p == pe )
  231         goto _test_eof1;
  232 case 1:
  233     if ( (*p) == 114 )
  234         goto st2;
  235     goto st0;
  236 st2:
  237     if ( ++p == pe )
  238         goto _test_eof2;
  239 case 2:
  240     if ( (*p) == 111 )
  241         goto st3;
  242     goto st0;
  243 st3:
  244     if ( ++p == pe )
  245         goto _test_eof3;
  246 case 3:
  247     if ( (*p) == 109 )
  248         goto st4;
  249     goto st0;
  250 st4:
  251     if ( ++p == pe )
  252         goto _test_eof4;
  253 case 4:
  254     if ( (*p) == 32 )
  255         goto st5;
  256     goto st0;
  257 st5:
  258     if ( ++p == pe )
  259         goto _test_eof5;
  260 case 5:
  261     switch( (*p) ) {
  262         case 10: goto st0;
  263         case 32: goto st6;
  264     }
  265     goto st5;
  266 st6:
  267     if ( ++p == pe )
  268         goto _test_eof6;
  269 case 6:
  270     switch( (*p) ) {
  271         case 10: goto st0;
  272         case 32: goto st6;
  273     }
  274     if ( 65 <= (*p) && (*p) <= 90 )
  275         goto st7;
  276     goto st5;
  277 st7:
  278     if ( ++p == pe )
  279         goto _test_eof7;
  280 case 7:
  281     switch( (*p) ) {
  282         case 10: goto st0;
  283         case 32: goto st6;
  284     }
  285     if ( 97 <= (*p) && (*p) <= 122 )
  286         goto st8;
  287     goto st5;
  288 st8:
  289     if ( ++p == pe )
  290         goto _test_eof8;
  291 case 8:
  292     switch( (*p) ) {
  293         case 10: goto st0;
  294         case 32: goto st6;
  295     }
  296     if ( 97 <= (*p) && (*p) <= 122 )
  297         goto st9;
  298     goto st5;
  299 st9:
  300     if ( ++p == pe )
  301         goto _test_eof9;
  302 case 9:
  303     switch( (*p) ) {
  304         case 10: goto st0;
  305         case 32: goto st10;
  306     }
  307     goto st5;
  308 st10:
  309     if ( ++p == pe )
  310         goto _test_eof10;
  311 case 10:
  312     switch( (*p) ) {
  313         case 10: goto st0;
  314         case 32: goto st6;
  315     }
  316     if ( 65 <= (*p) && (*p) <= 90 )
  317         goto st11;
  318     goto st5;
  319 st11:
  320     if ( ++p == pe )
  321         goto _test_eof11;
  322 case 11:
  323     switch( (*p) ) {
  324         case 10: goto st0;
  325         case 32: goto st6;
  326     }
  327     if ( 97 <= (*p) && (*p) <= 122 )
  328         goto st12;
  329     goto st5;
  330 st12:
  331     if ( ++p == pe )
  332         goto _test_eof12;
  333 case 12:
  334     switch( (*p) ) {
  335         case 10: goto st0;
  336         case 32: goto st6;
  337     }
  338     if ( 97 <= (*p) && (*p) <= 122 )
  339         goto st13;
  340     goto st5;
  341 st13:
  342     if ( ++p == pe )
  343         goto _test_eof13;
  344 case 13:
  345     switch( (*p) ) {
  346         case 10: goto st0;
  347         case 32: goto st14;
  348     }
  349     goto st5;
  350 st14:
  351     if ( ++p == pe )
  352         goto _test_eof14;
  353 case 14:
  354     switch( (*p) ) {
  355         case 10: goto st0;
  356         case 32: goto st15;
  357     }
  358     if ( (*p) > 57 ) {
  359         if ( 65 <= (*p) && (*p) <= 90 )
  360             goto st11;
  361     } else if ( (*p) >= 48 )
  362         goto st97;
  363     goto st5;
  364 st15:
  365     if ( ++p == pe )
  366         goto _test_eof15;
  367 case 15:
  368     switch( (*p) ) {
  369         case 10: goto st0;
  370         case 32: goto st6;
  371     }
  372     if ( (*p) > 57 ) {
  373         if ( 65 <= (*p) && (*p) <= 90 )
  374             goto st7;
  375     } else if ( (*p) >= 48 )
  376         goto st16;
  377     goto st5;
  378 st16:
  379     if ( ++p == pe )
  380         goto _test_eof16;
  381 case 16:
  382     switch( (*p) ) {
  383         case 10: goto st0;
  384         case 32: goto st17;
  385     }
  386     goto st5;
  387 st17:
  388     if ( ++p == pe )
  389         goto _test_eof17;
  390 case 17:
  391     switch( (*p) ) {
  392         case 10: goto st0;
  393         case 32: goto st6;
  394     }
  395     if ( (*p) > 57 ) {
  396         if ( 65 <= (*p) && (*p) <= 90 )
  397             goto st7;
  398     } else if ( (*p) >= 48 )
  399         goto st18;
  400     goto st5;
  401 st18:
  402     if ( ++p == pe )
  403         goto _test_eof18;
  404 case 18:
  405     switch( (*p) ) {
  406         case 10: goto st0;
  407         case 32: goto st6;
  408     }
  409     if ( 48 <= (*p) && (*p) <= 57 )
  410         goto st19;
  411     goto st5;
  412 st19:
  413     if ( ++p == pe )
  414         goto _test_eof19;
  415 case 19:
  416     switch( (*p) ) {
  417         case 10: goto st0;
  418         case 32: goto st6;
  419         case 58: goto st20;
  420     }
  421     goto st5;
  422 st20:
  423     if ( ++p == pe )
  424         goto _test_eof20;
  425 case 20:
  426     switch( (*p) ) {
  427         case 10: goto st0;
  428         case 32: goto st6;
  429     }
  430     if ( 48 <= (*p) && (*p) <= 57 )
  431         goto st21;
  432     goto st5;
  433 st21:
  434     if ( ++p == pe )
  435         goto _test_eof21;
  436 case 21:
  437     switch( (*p) ) {
  438         case 10: goto st0;
  439         case 32: goto st6;
  440     }
  441     if ( 48 <= (*p) && (*p) <= 57 )
  442         goto st22;
  443     goto st5;
  444 st22:
  445     if ( ++p == pe )
  446         goto _test_eof22;
  447 case 22:
  448     switch( (*p) ) {
  449         case 10: goto st0;
  450         case 32: goto st23;
  451         case 58: goto st94;
  452     }
  453     goto st5;
  454 st23:
  455     if ( ++p == pe )
  456         goto _test_eof23;
  457 case 23:
  458     switch( (*p) ) {
  459         case 10: goto st0;
  460         case 32: goto st6;
  461         case 43: goto st24;
  462         case 45: goto st24;
  463     }
  464     if ( (*p) > 57 ) {
  465         if ( 65 <= (*p) && (*p) <= 90 )
  466             goto st92;
  467     } else if ( (*p) >= 48 )
  468         goto st84;
  469     goto st5;
  470 st24:
  471     if ( ++p == pe )
  472         goto _test_eof24;
  473 case 24:
  474     switch( (*p) ) {
  475         case 10: goto st0;
  476         case 32: goto st6;
  477     }
  478     if ( 48 <= (*p) && (*p) <= 57 )
  479         goto st25;
  480     goto st5;
  481 st25:
  482     if ( ++p == pe )
  483         goto _test_eof25;
  484 case 25:
  485     switch( (*p) ) {
  486         case 10: goto st0;
  487         case 32: goto st6;
  488     }
  489     if ( 48 <= (*p) && (*p) <= 57 )
  490         goto st26;
  491     goto st5;
  492 st26:
  493     if ( ++p == pe )
  494         goto _test_eof26;
  495 case 26:
  496     switch( (*p) ) {
  497         case 10: goto st0;
  498         case 32: goto st6;
  499     }
  500     if ( 48 <= (*p) && (*p) <= 57 )
  501         goto st27;
  502     goto st5;
  503 st27:
  504     if ( ++p == pe )
  505         goto _test_eof27;
  506 case 27:
  507     switch( (*p) ) {
  508         case 10: goto st0;
  509         case 32: goto st6;
  510     }
  511     if ( 48 <= (*p) && (*p) <= 57 )
  512         goto st28;
  513     goto st5;
  514 st28:
  515     if ( ++p == pe )
  516         goto _test_eof28;
  517 case 28:
  518     switch( (*p) ) {
  519         case 10: goto st0;
  520         case 32: goto st29;
  521     }
  522     goto st5;
  523 st29:
  524     if ( ++p == pe )
  525         goto _test_eof29;
  526 case 29:
  527     switch( (*p) ) {
  528         case 10: goto st0;
  529         case 32: goto st6;
  530     }
  531     if ( (*p) > 57 ) {
  532         if ( 65 <= (*p) && (*p) <= 90 )
  533             goto st7;
  534     } else if ( (*p) >= 48 )
  535         goto st30;
  536     goto st5;
  537 st30:
  538     if ( ++p == pe )
  539         goto _test_eof30;
  540 case 30:
  541     switch( (*p) ) {
  542         case 10: goto st0;
  543         case 32: goto st6;
  544     }
  545     if ( 48 <= (*p) && (*p) <= 57 )
  546         goto st31;
  547     goto st5;
  548 st31:
  549     if ( ++p == pe )
  550         goto _test_eof31;
  551 case 31:
  552     switch( (*p) ) {
  553         case 10: goto st0;
  554         case 32: goto st6;
  555     }
  556     if ( 48 <= (*p) && (*p) <= 57 )
  557         goto st32;
  558     goto st5;
  559 st32:
  560     if ( ++p == pe )
  561         goto _test_eof32;
  562 case 32:
  563     switch( (*p) ) {
  564         case 10: goto st0;
  565         case 32: goto st6;
  566     }
  567     if ( 48 <= (*p) && (*p) <= 57 )
  568         goto st33;
  569     goto st5;
  570 st33:
  571     if ( ++p == pe )
  572         goto _test_eof33;
  573 case 33:
  574     switch( (*p) ) {
  575         case 10: goto st34;
  576         case 32: goto st6;
  577     }
  578     goto st5;
  579 tr88:
  580 #line 108 "mailbox.rl"
  581     {
  582         headName.append(0);
  583         if ( strcmp( headName.data, "From" ) == 0 ||
  584                 strcmp( headName.data, "To" ) == 0 ||
  585                 strcmp( headName.data, "Subject" ) == 0 )
  586         {
  587             /* Print the header name, then jump to a machine the will display
  588              * the contents. */
  589             cout << headName.data << ":";
  590             headName.clear();
  591             {stack[top++] = 34;goto st103;}
  592         }
  593 
  594         headName.clear();
  595         {stack[top++] = 34;goto st102;}
  596     }
  597     goto st34;
  598 st34:
  599     if ( ++p == pe )
  600         goto _test_eof34;
  601 case 34:
  602 #line 603 "mailbox.cpp"
  603     if ( (*p) == 10 )
  604         goto tr38;
  605     if ( (*p) > 57 ) {
  606         if ( 59 <= (*p) && (*p) <= 126 )
  607             goto tr39;
  608     } else if ( (*p) >= 33 )
  609         goto tr39;
  610     goto st0;
  611 tr38:
  612 #line 55 "mailbox.rl"
  613     { cout << endl; }
  614     goto st101;
  615 st101:
  616     if ( ++p == pe )
  617         goto _test_eof101;
  618 case 101:
  619 #line 620 "mailbox.cpp"
  620     switch( (*p) ) {
  621         case 10: goto st101;
  622         case 70: goto st36;
  623     }
  624     goto st35;
  625 st35:
  626     if ( ++p == pe )
  627         goto _test_eof35;
  628 case 35:
  629     if ( (*p) == 10 )
  630         goto st101;
  631     goto st35;
  632 st36:
  633     if ( ++p == pe )
  634         goto _test_eof36;
  635 case 36:
  636     switch( (*p) ) {
  637         case 10: goto st101;
  638         case 114: goto st37;
  639     }
  640     goto st35;
  641 st37:
  642     if ( ++p == pe )
  643         goto _test_eof37;
  644 case 37:
  645     switch( (*p) ) {
  646         case 10: goto st101;
  647         case 111: goto st38;
  648     }
  649     goto st35;
  650 st38:
  651     if ( ++p == pe )
  652         goto _test_eof38;
  653 case 38:
  654     switch( (*p) ) {
  655         case 10: goto st101;
  656         case 109: goto st39;
  657     }
  658     goto st35;
  659 st39:
  660     if ( ++p == pe )
  661         goto _test_eof39;
  662 case 39:
  663     switch( (*p) ) {
  664         case 10: goto st101;
  665         case 32: goto st40;
  666     }
  667     goto st35;
  668 st40:
  669     if ( ++p == pe )
  670         goto _test_eof40;
  671 case 40:
  672     switch( (*p) ) {
  673         case 10: goto st101;
  674         case 32: goto st41;
  675     }
  676     goto st40;
  677 st41:
  678     if ( ++p == pe )
  679         goto _test_eof41;
  680 case 41:
  681     switch( (*p) ) {
  682         case 10: goto st101;
  683         case 32: goto st41;
  684     }
  685     if ( 65 <= (*p) && (*p) <= 90 )
  686         goto st42;
  687     goto st40;
  688 st42:
  689     if ( ++p == pe )
  690         goto _test_eof42;
  691 case 42:
  692     switch( (*p) ) {
  693         case 10: goto st101;
  694         case 32: goto st41;
  695     }
  696     if ( 97 <= (*p) && (*p) <= 122 )
  697         goto st43;
  698     goto st40;
  699 st43:
  700     if ( ++p == pe )
  701         goto _test_eof43;
  702 case 43:
  703     switch( (*p) ) {
  704         case 10: goto st101;
  705         case 32: goto st41;
  706     }
  707     if ( 97 <= (*p) && (*p) <= 122 )
  708         goto st44;
  709     goto st40;
  710 st44:
  711     if ( ++p == pe )
  712         goto _test_eof44;
  713 case 44:
  714     switch( (*p) ) {
  715         case 10: goto st101;
  716         case 32: goto st45;
  717     }
  718     goto st40;
  719 st45:
  720     if ( ++p == pe )
  721         goto _test_eof45;
  722 case 45:
  723     switch( (*p) ) {
  724         case 10: goto st101;
  725         case 32: goto st41;
  726     }
  727     if ( 65 <= (*p) && (*p) <= 90 )
  728         goto st46;
  729     goto st40;
  730 st46:
  731     if ( ++p == pe )
  732         goto _test_eof46;
  733 case 46:
  734     switch( (*p) ) {
  735         case 10: goto st101;
  736         case 32: goto st41;
  737     }
  738     if ( 97 <= (*p) && (*p) <= 122 )
  739         goto st47;
  740     goto st40;
  741 st47:
  742     if ( ++p == pe )
  743         goto _test_eof47;
  744 case 47:
  745     switch( (*p) ) {
  746         case 10: goto st101;
  747         case 32: goto st41;
  748     }
  749     if ( 97 <= (*p) && (*p) <= 122 )
  750         goto st48;
  751     goto st40;
  752 st48:
  753     if ( ++p == pe )
  754         goto _test_eof48;
  755 case 48:
  756     switch( (*p) ) {
  757         case 10: goto st101;
  758         case 32: goto st49;
  759     }
  760     goto st40;
  761 st49:
  762     if ( ++p == pe )
  763         goto _test_eof49;
  764 case 49:
  765     switch( (*p) ) {
  766         case 10: goto st101;
  767         case 32: goto st50;
  768     }
  769     if ( (*p) > 57 ) {
  770         if ( 65 <= (*p) && (*p) <= 90 )
  771             goto st46;
  772     } else if ( (*p) >= 48 )
  773         goto st82;
  774     goto st40;
  775 st50:
  776     if ( ++p == pe )
  777         goto _test_eof50;
  778 case 50:
  779     switch( (*p) ) {
  780         case 10: goto st101;
  781         case 32: goto st41;
  782     }
  783     if ( (*p) > 57 ) {
  784         if ( 65 <= (*p) && (*p) <= 90 )
  785             goto st42;
  786     } else if ( (*p) >= 48 )
  787         goto st51;
  788     goto st40;
  789 st51:
  790     if ( ++p == pe )
  791         goto _test_eof51;
  792 case 51:
  793     switch( (*p) ) {
  794         case 10: goto st101;
  795         case 32: goto st52;
  796     }
  797     goto st40;
  798 st52:
  799     if ( ++p == pe )
  800         goto _test_eof52;
  801 case 52:
  802     switch( (*p) ) {
  803         case 10: goto st101;
  804         case 32: goto st41;
  805     }
  806     if ( (*p) > 57 ) {
  807         if ( 65 <= (*p) && (*p) <= 90 )
  808             goto st42;
  809     } else if ( (*p) >= 48 )
  810         goto st53;
  811     goto st40;
  812 st53:
  813     if ( ++p == pe )
  814         goto _test_eof53;
  815 case 53:
  816     switch( (*p) ) {
  817         case 10: goto st101;
  818         case 32: goto st41;
  819     }
  820     if ( 48 <= (*p) && (*p) <= 57 )
  821         goto st54;
  822     goto st40;
  823 st54:
  824     if ( ++p == pe )
  825         goto _test_eof54;
  826 case 54:
  827     switch( (*p) ) {
  828         case 10: goto st101;
  829         case 32: goto st41;
  830         case 58: goto st55;
  831     }
  832     goto st40;
  833 st55:
  834     if ( ++p == pe )
  835         goto _test_eof55;
  836 case 55:
  837     switch( (*p) ) {
  838         case 10: goto st101;
  839         case 32: goto st41;
  840     }
  841     if ( 48 <= (*p) && (*p) <= 57 )
  842         goto st56;
  843     goto st40;
  844 st56:
  845     if ( ++p == pe )
  846         goto _test_eof56;
  847 case 56:
  848     switch( (*p) ) {
  849         case 10: goto st101;
  850         case 32: goto st41;
  851     }
  852     if ( 48 <= (*p) && (*p) <= 57 )
  853         goto st57;
  854     goto st40;
  855 st57:
  856     if ( ++p == pe )
  857         goto _test_eof57;
  858 case 57:
  859     switch( (*p) ) {
  860         case 10: goto st101;
  861         case 32: goto st58;
  862         case 58: goto st79;
  863     }
  864     goto st40;
  865 st58:
  866     if ( ++p == pe )
  867         goto _test_eof58;
  868 case 58:
  869     switch( (*p) ) {
  870         case 10: goto st101;
  871         case 32: goto st41;
  872         case 43: goto st59;
  873         case 45: goto st59;
  874     }
  875     if ( (*p) > 57 ) {
  876         if ( 65 <= (*p) && (*p) <= 90 )
  877             goto st77;
  878     } else if ( (*p) >= 48 )
  879         goto st69;
  880     goto st40;
  881 st59:
  882     if ( ++p == pe )
  883         goto _test_eof59;
  884 case 59:
  885     switch( (*p) ) {
  886         case 10: goto st101;
  887         case 32: goto st41;
  888     }
  889     if ( 48 <= (*p) && (*p) <= 57 )
  890         goto st60;
  891     goto st40;
  892 st60:
  893     if ( ++p == pe )
  894         goto _test_eof60;
  895 case 60:
  896     switch( (*p) ) {
  897         case 10: goto st101;
  898         case 32: goto st41;
  899     }
  900     if ( 48 <= (*p) && (*p) <= 57 )
  901         goto st61;
  902     goto st40;
  903 st61:
  904     if ( ++p == pe )
  905         goto _test_eof61;
  906 case 61:
  907     switch( (*p) ) {
  908         case 10: goto st101;
  909         case 32: goto st41;
  910     }
  911     if ( 48 <= (*p) && (*p) <= 57 )
  912         goto st62;
  913     goto st40;
  914 st62:
  915     if ( ++p == pe )
  916         goto _test_eof62;
  917 case 62:
  918     switch( (*p) ) {
  919         case 10: goto st101;
  920         case 32: goto st41;
  921     }
  922     if ( 48 <= (*p) && (*p) <= 57 )
  923         goto st63;
  924     goto st40;
  925 st63:
  926     if ( ++p == pe )
  927         goto _test_eof63;
  928 case 63:
  929     switch( (*p) ) {
  930         case 10: goto st101;
  931         case 32: goto st64;
  932     }
  933     goto st40;
  934 st64:
  935     if ( ++p == pe )
  936         goto _test_eof64;
  937 case 64:
  938     switch( (*p) ) {
  939         case 10: goto st101;
  940         case 32: goto st41;
  941     }
  942     if ( (*p) > 57 ) {
  943         if ( 65 <= (*p) && (*p) <= 90 )
  944             goto st42;
  945     } else if ( (*p) >= 48 )
  946         goto st65;
  947     goto st40;
  948 st65:
  949     if ( ++p == pe )
  950         goto _test_eof65;
  951 case 65:
  952     switch( (*p) ) {
  953         case 10: goto st101;
  954         case 32: goto st41;
  955     }
  956     if ( 48 <= (*p) && (*p) <= 57 )
  957         goto st66;
  958     goto st40;
  959 st66:
  960     if ( ++p == pe )
  961         goto _test_eof66;
  962 case 66:
  963     switch( (*p) ) {
  964         case 10: goto st101;
  965         case 32: goto st41;
  966     }
  967     if ( 48 <= (*p) && (*p) <= 57 )
  968         goto st67;
  969     goto st40;
  970 st67:
  971     if ( ++p == pe )
  972         goto _test_eof67;
  973 case 67:
  974     switch( (*p) ) {
  975         case 10: goto st101;
  976         case 32: goto st41;
  977     }
  978     if ( 48 <= (*p) && (*p) <= 57 )
  979         goto st68;
  980     goto st40;
  981 st68:
  982     if ( ++p == pe )
  983         goto _test_eof68;
  984 case 68:
  985     switch( (*p) ) {
  986         case 10: goto st34;
  987         case 32: goto st41;
  988     }
  989     goto st40;
  990 st69:
  991     if ( ++p == pe )
  992         goto _test_eof69;
  993 case 69:
  994     switch( (*p) ) {
  995         case 10: goto st101;
  996         case 32: goto st41;
  997     }
  998     if ( 48 <= (*p) && (*p) <= 57 )
  999         goto st70;
 1000     goto st40;
 1001 st70:
 1002     if ( ++p == pe )
 1003         goto _test_eof70;
 1004 case 70:
 1005     switch( (*p) ) {
 1006         case 10: goto st101;
 1007         case 32: goto st41;
 1008     }
 1009     if ( 48 <= (*p) && (*p) <= 57 )
 1010         goto st71;
 1011     goto st40;
 1012 st71:
 1013     if ( ++p == pe )
 1014         goto _test_eof71;
 1015 case 71:
 1016     switch( (*p) ) {
 1017         case 10: goto st101;
 1018         case 32: goto st41;
 1019     }
 1020     if ( 48 <= (*p) && (*p) <= 57 )
 1021         goto st72;
 1022     goto st40;
 1023 st72:
 1024     if ( ++p == pe )
 1025         goto _test_eof72;
 1026 case 72:
 1027     switch( (*p) ) {
 1028         case 10: goto st34;
 1029         case 32: goto st73;
 1030     }
 1031     goto st40;
 1032 st73:
 1033     if ( ++p == pe )
 1034         goto _test_eof73;
 1035 case 73:
 1036     switch( (*p) ) {
 1037         case 10: goto st101;
 1038         case 32: goto st41;
 1039         case 43: goto st74;
 1040         case 45: goto st74;
 1041     }
 1042     if ( 65 <= (*p) && (*p) <= 90 )
 1043         goto st75;
 1044     goto st40;
 1045 st74:
 1046     if ( ++p == pe )
 1047         goto _test_eof74;
 1048 case 74:
 1049     switch( (*p) ) {
 1050         case 10: goto st101;
 1051         case 32: goto st41;
 1052     }
 1053     if ( 48 <= (*p) && (*p) <= 57 )
 1054         goto st65;
 1055     goto st40;
 1056 st75:
 1057     if ( ++p == pe )
 1058         goto _test_eof75;
 1059 case 75:
 1060     switch( (*p) ) {
 1061         case 10: goto st101;
 1062         case 32: goto st41;
 1063     }
 1064     if ( (*p) > 90 ) {
 1065         if ( 97 <= (*p) && (*p) <= 122 )
 1066             goto st43;
 1067     } else if ( (*p) >= 65 )
 1068         goto st76;
 1069     goto st40;
 1070 st76:
 1071     if ( ++p == pe )
 1072         goto _test_eof76;
 1073 case 76:
 1074     switch( (*p) ) {
 1075         case 10: goto st101;
 1076         case 32: goto st41;
 1077     }
 1078     if ( 65 <= (*p) && (*p) <= 90 )
 1079         goto st68;
 1080     goto st40;
 1081 st77:
 1082     if ( ++p == pe )
 1083         goto _test_eof77;
 1084 case 77:
 1085     switch( (*p) ) {
 1086         case 10: goto st101;
 1087         case 32: goto st41;
 1088     }
 1089     if ( (*p) > 90 ) {
 1090         if ( 97 <= (*p) && (*p) <= 122 )
 1091             goto st43;
 1092     } else if ( (*p) >= 65 )
 1093         goto st78;
 1094     goto st40;
 1095 st78:
 1096     if ( ++p == pe )
 1097         goto _test_eof78;
 1098 case 78:
 1099     switch( (*p) ) {
 1100         case 10: goto st101;
 1101         case 32: goto st41;
 1102     }
 1103     if ( 65 <= (*p) && (*p) <= 90 )
 1104         goto st63;
 1105     goto st40;
 1106 st79:
 1107     if ( ++p == pe )
 1108         goto _test_eof79;
 1109 case 79:
 1110     switch( (*p) ) {
 1111         case 10: goto st101;
 1112         case 32: goto st41;
 1113     }
 1114     if ( 48 <= (*p) && (*p) <= 57 )
 1115         goto st80;
 1116     goto st40;
 1117 st80:
 1118     if ( ++p == pe )
 1119         goto _test_eof80;
 1120 case 80:
 1121     switch( (*p) ) {
 1122         case 10: goto st101;
 1123         case 32: goto st41;
 1124     }
 1125     if ( 48 <= (*p) && (*p) <= 57 )
 1126         goto st81;
 1127     goto st40;
 1128 st81:
 1129     if ( ++p == pe )
 1130         goto _test_eof81;
 1131 case 81:
 1132     switch( (*p) ) {
 1133         case 10: goto st101;
 1134         case 32: goto st58;
 1135     }
 1136     goto st40;
 1137 st82:
 1138     if ( ++p == pe )
 1139         goto _test_eof82;
 1140 case 82:
 1141     switch( (*p) ) {
 1142         case 10: goto st101;
 1143         case 32: goto st41;
 1144     }
 1145     if ( 48 <= (*p) && (*p) <= 57 )
 1146         goto st51;
 1147     goto st40;
 1148 tr39:
 1149 #line 52 "mailbox.rl"
 1150     { headName.append((*p)); }
 1151     goto st83;
 1152 st83:
 1153     if ( ++p == pe )
 1154         goto _test_eof83;
 1155 case 83:
 1156 #line 1157 "mailbox.cpp"
 1157     if ( (*p) == 58 )
 1158         goto tr88;
 1159     if ( 33 <= (*p) && (*p) <= 126 )
 1160         goto tr39;
 1161     goto st0;
 1162 st84:
 1163     if ( ++p == pe )
 1164         goto _test_eof84;
 1165 case 84:
 1166     switch( (*p) ) {
 1167         case 10: goto st0;
 1168         case 32: goto st6;
 1169     }
 1170     if ( 48 <= (*p) && (*p) <= 57 )
 1171         goto st85;
 1172     goto st5;
 1173 st85:
 1174     if ( ++p == pe )
 1175         goto _test_eof85;
 1176 case 85:
 1177     switch( (*p) ) {
 1178         case 10: goto st0;
 1179         case 32: goto st6;
 1180     }
 1181     if ( 48 <= (*p) && (*p) <= 57 )
 1182         goto st86;
 1183     goto st5;
 1184 st86:
 1185     if ( ++p == pe )
 1186         goto _test_eof86;
 1187 case 86:
 1188     switch( (*p) ) {
 1189         case 10: goto st0;
 1190         case 32: goto st6;
 1191     }
 1192     if ( 48 <= (*p) && (*p) <= 57 )
 1193         goto st87;
 1194     goto st5;
 1195 st87:
 1196     if ( ++p == pe )
 1197         goto _test_eof87;
 1198 case 87:
 1199     switch( (*p) ) {
 1200         case 10: goto st34;
 1201         case 32: goto st88;
 1202     }
 1203     goto st5;
 1204 st88:
 1205     if ( ++p == pe )
 1206         goto _test_eof88;
 1207 case 88:
 1208     switch( (*p) ) {
 1209         case 10: goto st0;
 1210         case 32: goto st6;
 1211         case 43: goto st89;
 1212         case 45: goto st89;
 1213     }
 1214     if ( 65 <= (*p) && (*p) <= 90 )
 1215         goto st90;
 1216     goto st5;
 1217 st89:
 1218     if ( ++p == pe )
 1219         goto _test_eof89;
 1220 case 89:
 1221     switch( (*p) ) {
 1222         case 10: goto st0;
 1223         case 32: goto st6;
 1224     }
 1225     if ( 48 <= (*p) && (*p) <= 57 )
 1226         goto st30;
 1227     goto st5;
 1228 st90:
 1229     if ( ++p == pe )
 1230         goto _test_eof90;
 1231 case 90:
 1232     switch( (*p) ) {
 1233         case 10: goto st0;
 1234         case 32: goto st6;
 1235     }
 1236     if ( (*p) > 90 ) {
 1237         if ( 97 <= (*p) && (*p) <= 122 )
 1238             goto st8;
 1239     } else if ( (*p) >= 65 )
 1240         goto st91;
 1241     goto st5;
 1242 st91:
 1243     if ( ++p == pe )
 1244         goto _test_eof91;
 1245 case 91:
 1246     switch( (*p) ) {
 1247         case 10: goto st0;
 1248         case 32: goto st6;
 1249     }
 1250     if ( 65 <= (*p) && (*p) <= 90 )
 1251         goto st33;
 1252     goto st5;
 1253 st92:
 1254     if ( ++p == pe )
 1255         goto _test_eof92;
 1256 case 92:
 1257     switch( (*p) ) {
 1258         case 10: goto st0;
 1259         case 32: goto st6;
 1260     }
 1261     if ( (*p) > 90 ) {
 1262         if ( 97 <= (*p) && (*p) <= 122 )
 1263             goto st8;
 1264     } else if ( (*p) >= 65 )
 1265         goto st93;
 1266     goto st5;
 1267 st93:
 1268     if ( ++p == pe )
 1269         goto _test_eof93;
 1270 case 93:
 1271     switch( (*p) ) {
 1272         case 10: goto st0;
 1273         case 32: goto st6;
 1274     }
 1275     if ( 65 <= (*p) && (*p) <= 90 )
 1276         goto st28;
 1277     goto st5;
 1278 st94:
 1279     if ( ++p == pe )
 1280         goto _test_eof94;
 1281 case 94:
 1282     switch( (*p) ) {
 1283         case 10: goto st0;
 1284         case 32: goto st6;
 1285     }
 1286     if ( 48 <= (*p) && (*p) <= 57 )
 1287         goto st95;
 1288     goto st5;
 1289 st95:
 1290     if ( ++p == pe )
 1291         goto _test_eof95;
 1292 case 95:
 1293     switch( (*p) ) {
 1294         case 10: goto st0;
 1295         case 32: goto st6;
 1296     }
 1297     if ( 48 <= (*p) && (*p) <= 57 )
 1298         goto st96;
 1299     goto st5;
 1300 st96:
 1301     if ( ++p == pe )
 1302         goto _test_eof96;
 1303 case 96:
 1304     switch( (*p) ) {
 1305         case 10: goto st0;
 1306         case 32: goto st23;
 1307     }
 1308     goto st5;
 1309 st97:
 1310     if ( ++p == pe )
 1311         goto _test_eof97;
 1312 case 97:
 1313     switch( (*p) ) {
 1314         case 10: goto st0;
 1315         case 32: goto st6;
 1316     }
 1317     if ( 48 <= (*p) && (*p) <= 57 )
 1318         goto st16;
 1319     goto st5;
 1320 tr99:
 1321 #line 86 "mailbox.rl"
 1322     {p--; {cs = stack[--top];goto _again;}}
 1323     goto st102;
 1324 st102:
 1325     if ( ++p == pe )
 1326         goto _test_eof102;
 1327 case 102:
 1328 #line 1329 "mailbox.cpp"
 1329     if ( (*p) == 10 )
 1330         goto st98;
 1331     goto st102;
 1332 st98:
 1333     if ( ++p == pe )
 1334         goto _test_eof98;
 1335 case 98:
 1336     switch( (*p) ) {
 1337         case 9: goto st102;
 1338         case 32: goto st102;
 1339     }
 1340     goto tr99;
 1341 tr106:
 1342 #line 89 "mailbox.rl"
 1343     {headContent.append((*p));}
 1344     goto st103;
 1345 tr108:
 1346 #line 90 "mailbox.rl"
 1347     {headContent.append(' ');}
 1348 #line 89 "mailbox.rl"
 1349     {headContent.append((*p));}
 1350     goto st103;
 1351 st103:
 1352     if ( ++p == pe )
 1353         goto _test_eof103;
 1354 case 103:
 1355 #line 1356 "mailbox.cpp"
 1356     if ( (*p) == 10 )
 1357         goto st99;
 1358     goto tr106;
 1359 st99:
 1360     if ( ++p == pe )
 1361         goto _test_eof99;
 1362 case 99:
 1363     switch( (*p) ) {
 1364         case 9: goto st104;
 1365         case 32: goto st104;
 1366     }
 1367     goto tr101;
 1368 st104:
 1369     if ( ++p == pe )
 1370         goto _test_eof104;
 1371 case 104:
 1372     switch( (*p) ) {
 1373         case 9: goto st104;
 1374         case 10: goto st99;
 1375         case 32: goto st104;
 1376     }
 1377     goto tr108;
 1378     }
 1379     _test_eof100: cs = 100; goto _test_eof; 
 1380     _test_eof1: cs = 1; goto _test_eof; 
 1381     _test_eof2: cs = 2; goto _test_eof; 
 1382     _test_eof3: cs = 3; goto _test_eof; 
 1383     _test_eof4: cs = 4; goto _test_eof; 
 1384     _test_eof5: cs = 5; goto _test_eof; 
 1385     _test_eof6: cs = 6; goto _test_eof; 
 1386     _test_eof7: cs = 7; goto _test_eof; 
 1387     _test_eof8: cs = 8; goto _test_eof; 
 1388     _test_eof9: cs = 9; goto _test_eof; 
 1389     _test_eof10: cs = 10; goto _test_eof; 
 1390     _test_eof11: cs = 11; goto _test_eof; 
 1391     _test_eof12: cs = 12; goto _test_eof; 
 1392     _test_eof13: cs = 13; goto _test_eof; 
 1393     _test_eof14: cs = 14; goto _test_eof; 
 1394     _test_eof15: cs = 15; goto _test_eof; 
 1395     _test_eof16: cs = 16; goto _test_eof; 
 1396     _test_eof17: cs = 17; goto _test_eof; 
 1397     _test_eof18: cs = 18; goto _test_eof; 
 1398     _test_eof19: cs = 19; goto _test_eof; 
 1399     _test_eof20: cs = 20; goto _test_eof; 
 1400     _test_eof21: cs = 21; goto _test_eof; 
 1401     _test_eof22: cs = 22; goto _test_eof; 
 1402     _test_eof23: cs = 23; goto _test_eof; 
 1403     _test_eof24: cs = 24; goto _test_eof; 
 1404     _test_eof25: cs = 25; goto _test_eof; 
 1405     _test_eof26: cs = 26; goto _test_eof; 
 1406     _test_eof27: cs = 27; goto _test_eof; 
 1407     _test_eof28: cs = 28; goto _test_eof; 
 1408     _test_eof29: cs = 29; goto _test_eof; 
 1409     _test_eof30: cs = 30; goto _test_eof; 
 1410     _test_eof31: cs = 31; goto _test_eof; 
 1411     _test_eof32: cs = 32; goto _test_eof; 
 1412     _test_eof33: cs = 33; goto _test_eof; 
 1413     _test_eof34: cs = 34; goto _test_eof; 
 1414     _test_eof101: cs = 101; goto _test_eof; 
 1415     _test_eof35: cs = 35; goto _test_eof; 
 1416     _test_eof36: cs = 36; goto _test_eof; 
 1417     _test_eof37: cs = 37; goto _test_eof; 
 1418     _test_eof38: cs = 38; goto _test_eof; 
 1419     _test_eof39: cs = 39; goto _test_eof; 
 1420     _test_eof40: cs = 40; goto _test_eof; 
 1421     _test_eof41: cs = 41; goto _test_eof; 
 1422     _test_eof42: cs = 42; goto _test_eof; 
 1423     _test_eof43: cs = 43; goto _test_eof; 
 1424     _test_eof44: cs = 44; goto _test_eof; 
 1425     _test_eof45: cs = 45; goto _test_eof; 
 1426     _test_eof46: cs = 46; goto _test_eof; 
 1427     _test_eof47: cs = 47; goto _test_eof; 
 1428     _test_eof48: cs = 48; goto _test_eof; 
 1429     _test_eof49: cs = 49; goto _test_eof; 
 1430     _test_eof50: cs = 50; goto _test_eof; 
 1431     _test_eof51: cs = 51; goto _test_eof; 
 1432     _test_eof52: cs = 52; goto _test_eof; 
 1433     _test_eof53: cs = 53; goto _test_eof; 
 1434     _test_eof54: cs = 54; goto _test_eof; 
 1435     _test_eof55: cs = 55; goto _test_eof; 
 1436     _test_eof56: cs = 56; goto _test_eof; 
 1437     _test_eof57: cs = 57; goto _test_eof; 
 1438     _test_eof58: cs = 58; goto _test_eof; 
 1439     _test_eof59: cs = 59; goto _test_eof; 
 1440     _test_eof60: cs = 60; goto _test_eof; 
 1441     _test_eof61: cs = 61; goto _test_eof; 
 1442     _test_eof62: cs = 62; goto _test_eof; 
 1443     _test_eof63: cs = 63; goto _test_eof; 
 1444     _test_eof64: cs = 64; goto _test_eof; 
 1445     _test_eof65: cs = 65; goto _test_eof; 
 1446     _test_eof66: cs = 66; goto _test_eof; 
 1447     _test_eof67: cs = 67; goto _test_eof; 
 1448     _test_eof68: cs = 68; goto _test_eof; 
 1449     _test_eof69: cs = 69; goto _test_eof; 
 1450     _test_eof70: cs = 70; goto _test_eof; 
 1451     _test_eof71: cs = 71; goto _test_eof; 
 1452     _test_eof72: cs = 72; goto _test_eof; 
 1453     _test_eof73: cs = 73; goto _test_eof; 
 1454     _test_eof74: cs = 74; goto _test_eof; 
 1455     _test_eof75: cs = 75; goto _test_eof; 
 1456     _test_eof76: cs = 76; goto _test_eof; 
 1457     _test_eof77: cs = 77; goto _test_eof; 
 1458     _test_eof78: cs = 78; goto _test_eof; 
 1459     _test_eof79: cs = 79; goto _test_eof; 
 1460     _test_eof80: cs = 80; goto _test_eof; 
 1461     _test_eof81: cs = 81; goto _test_eof; 
 1462     _test_eof82: cs = 82; goto _test_eof; 
 1463     _test_eof83: cs = 83; goto _test_eof; 
 1464     _test_eof84: cs = 84; goto _test_eof; 
 1465     _test_eof85: cs = 85; goto _test_eof; 
 1466     _test_eof86: cs = 86; goto _test_eof; 
 1467     _test_eof87: cs = 87; goto _test_eof; 
 1468     _test_eof88: cs = 88; goto _test_eof; 
 1469     _test_eof89: cs = 89; goto _test_eof; 
 1470     _test_eof90: cs = 90; goto _test_eof; 
 1471     _test_eof91: cs = 91; goto _test_eof; 
 1472     _test_eof92: cs = 92; goto _test_eof; 
 1473     _test_eof93: cs = 93; goto _test_eof; 
 1474     _test_eof94: cs = 94; goto _test_eof; 
 1475     _test_eof95: cs = 95; goto _test_eof; 
 1476     _test_eof96: cs = 96; goto _test_eof; 
 1477     _test_eof97: cs = 97; goto _test_eof; 
 1478     _test_eof102: cs = 102; goto _test_eof; 
 1479     _test_eof98: cs = 98; goto _test_eof; 
 1480     _test_eof103: cs = 103; goto _test_eof; 
 1481     _test_eof99: cs = 99; goto _test_eof; 
 1482     _test_eof104: cs = 104; goto _test_eof; 
 1483 
 1484     _test_eof: {}
 1485     if ( p == eof )
 1486     {
 1487     switch ( cs ) {
 1488     case 104: 
 1489 #line 90 "mailbox.rl"
 1490     {headContent.append(' ');}
 1491     break;
 1492     case 99: 
 1493 #line 92 "mailbox.rl"
 1494     {
 1495         headContent.append(0);
 1496         cout << headContent.data << endl;
 1497         headContent.clear();
 1498         p--;
 1499         {cs = stack[--top]; if ( p == pe )
 1500         goto _test_eof;
 1501 goto _again;}
 1502     }
 1503     break;
 1504 #line 1505 "mailbox.cpp"
 1505     }
 1506     }
 1507 
 1508     _out: {}
 1509     }
 1510 
 1511 #line 154 "mailbox.rl"
 1512 
 1513     if ( cs == MailboxScanner_error )
 1514         return -1;
 1515     if ( cs >= MailboxScanner_first_final )
 1516         return 1;
 1517     return 0;
 1518 }
 1519 
 1520 int MailboxScanner::finish( )
 1521 {
 1522     if ( cs == MailboxScanner_error )
 1523         return -1;
 1524     if ( cs >= MailboxScanner_first_final )
 1525         return 1;
 1526     return 0;
 1527 }
 1528 
 1529 
 1530 void Buffer::empty()
 1531 {
 1532     if ( data != 0 ) {
 1533         free( data );
 1534 
 1535         data = 0;
 1536         length = 0;
 1537         allocated = 0;
 1538     }
 1539 }
 1540 
 1541 void Buffer::upAllocate( int len )
 1542 {
 1543     if ( data == 0 )
 1544         data = (char*) malloc( len );
 1545     else
 1546         data = (char*) realloc( data, len );
 1547     allocated = len;
 1548 }
 1549 
 1550 MailboxScanner mailbox;
 1551 char buf[BUFSIZE];
 1552 
 1553 int main()
 1554 {
 1555     mailbox.init();
 1556     while ( 1 ) {
 1557         int len = fread( buf, 1, BUFSIZE, stdin );
 1558         mailbox.execute( buf, len, len != BUFSIZE );
 1559         if ( len != BUFSIZE )
 1560             break;
 1561     }
 1562     if ( mailbox.finish() <= 0 )
 1563         cerr << "mailbox: error parsing input" << endl;
 1564     return 0;
 1565 }