home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / ftp.vapor.com / microdot-1 / md1_src_02.lzx / rmail.c < prev    next >
C/C++ Source or Header  |  1989-06-24  |  21KB  |  670 lines

  1. #include "uuconv.h"
  2.  
  3. #ifndef UUXQT_MD
  4. extern char linebuffer[];
  5. #endif
  6.  
  7. /* Returncodes:
  8.  
  9.     3 = can't open tofile  
  10.     1 = can't open file
  11.    21 = keine from-zeile
  12.    22 = from-syntax-error
  13.    23 = address convert error
  14. */
  15.  
  16. extern long lastoffset;
  17. extern char gzipfullpath[];
  18. extern char tempfile[];
  19. extern APTR app;
  20. #ifndef UUXQT_MD
  21. extern APTR tx[6];
  22. #endif
  23.  
  24. int rmail( char *from, char *to, char *cmd )
  25. {
  26.         struct AsyncFile *newsfile;
  27.         struct AsyncFile *tofile;
  28.         int offs, c, ch, toctr;
  29.         char buffer[á256 ];
  30.         char *p, *token, *p2;
  31.         BOOL flag_myreceivedby = 0;
  32.         BOOL isiso = FALSE;
  33.         BOOL ismime = FALSE;
  34.         BOOL iscompleteaddress = 0;
  35.         int gotsubject = FALSE;
  36.         char dummy1[512], dummy2[256];
  37.  
  38.         domui();
  39.         set_status( GS( MSG_TXT_CONVERTMAIL ) );
  40.  
  41.         newsfile = CLU_OpenAsync( from, ASMODE_READ, ASYNCBUFF );
  42.         if( !newsfile )
  43.                 return( 1 );
  44.  
  45.         CLU_FGetsAsync( newsfile, linebuffer, 2047 );
  46.         clnl( linebuffer );
  47.  
  48.         if( strnicmp( linebuffer, "From ", 5 ) )
  49.         {
  50.                 CLU_CloseAsync( newsfile );
  51.                 return( 21 );
  52.         }
  53.  
  54. //      Printf( "rmail: got %s\n", linebuffer );
  55.         
  56.         strcpy( linebuffer, &linebuffer[á5 ]á);
  57.  
  58.         tofile = CLU_OpenAsync( to, ASMODE_WRITE, ASYNCBUFF );
  59.         if( !tofile )
  60.         {
  61.                 CLU_CloseAsync( newsfile );
  62.                 return( 3 );
  63.         }
  64.  
  65.         /* in ROT verwandeln... */
  66.         p = strchr( linebuffer, ' 'á);
  67.         if( !p )
  68.                 p = strchr( linebuffer, '\t'á);
  69.         token = strrchr( linebuffer, ' 'á);
  70.         if( !token )
  71.                 token = strrchr( linebuffer, '\t'á);
  72.  
  73.         if( ( !p ) || ( !token ) || ( token <= p ) )
  74.         {
  75.                 CLU_CloseAsync( tofile );
  76.                 DeleteFile( to );
  77.                 CLU_CloseAsync( newsfile );
  78.                 return( 22 );
  79.         }
  80.  
  81.         *p = 0;
  82.         *token++ = 0;
  83.  
  84. #ifndef UUXQT_MD
  85.        set(tx[1], MUIA_Text_Contents, linebuffer );
  86. #endif
  87.  
  88.         p = strrchr( linebuffer, '!'á);
  89.         if( p )
  90.         {
  91.                 *p++ = 0;
  92.                 iscompleteaddress = TRUE;
  93.                 p2 = linebuffer;
  94.         }
  95.         else
  96.         {
  97.                 p = linebuffer;
  98.                 p2 = token;
  99.         }
  100.  
  101.  
  102. //      Printf( "rmail: after rotparse token %s, linebuffer %s\n", token, linebuffer );
  103.  
  104.  
  105.        if (iscompleteaddress)
  106.             CLU_FPrintfAsync( tofile, "WAB:%s@%s\n", p, p2 );
  107.        else
  108.             CLU_FPrintfAsync( tofile, "WAB:%s\n", p );
  109.  
  110.  
  111.        if (p = strchr( linebuffer, '@' ))
  112.        {
  113.             p++;
  114.             if (*p != 0)
  115.                 CLU_FPrintfAsync( tofile, "ROT:%s\n", p );
  116.             else
  117.                 CLU_FPrintfAsync( tofile, "ROT:%s\n", linebuffer );
  118.             }
  119.         else
  120.             CLU_FPrintfAsync( tofile, "ROT:%s\n", linebuffer );
  121.  
  122. #ifndef UUXQT_MD
  123.  
  124.         *dummy1 = 0;
  125.         *dummy2 = 0;
  126.         toctr = 0;
  127. #endif
  128.  
  129.         while( *cmd )
  130.         {
  131.                 p = buffer;
  132.                 while( ( *cmd ) && ( !isspace( *cmd ) ) )
  133.                 {
  134.                         *p++ = *cmd++;
  135.                 }
  136.                 *p = 0;
  137.                 cmd = stpblk( cmd );
  138.                 if( !buffer[á0 ] )
  139.                         continue;
  140.  
  141.                 /* Eventuelle Bang-Pfade l÷st der JSortin auf */
  142.  
  143. #ifndef UUXQT_MD
  144.                 if(strlen(buffer) < 255)
  145.                 {
  146.                     if (*dummy1)
  147.                         sprintf(dummy2, ",%s", buffer);
  148.                     else
  149.                         sprintf(dummy2,"%s", buffer);
  150.  
  151.                     toctr++;
  152.                     }
  153.  
  154.                 if (toctr < 4)
  155.                     strcat(dummy1,dummy2);
  156.                 if (toctr == 4)
  157.                     strcat(dummy1,",...");
  158.  
  159.                 toctr++;
  160.  
  161. #endif
  162.  
  163.                 CLU_FPrintfAsync( tofile, "EMP:%s\n", buffer );
  164.         }
  165.  
  166. #ifndef UUXQT_MD
  167.                 if(*dummy1 == 0)
  168.                     set(tx[3], MUIA_Text_Contents, "<EmpfΣngerangabe zu umfangreich>");
  169.                 else
  170.                     set(tx[3], MUIA_Text_Contents, dummy1);
  171. #endif
  172.  
  173.  
  174. //      Printf( "rmail: after empgen\n" );
  175.  
  176.         while( readheaderline( newsfile, 0 ) )
  177.         {
  178.                 domui();
  179.                 
  180. //              Printf( "rmail: readheaderline %s\n", linebuffer );
  181.  
  182.                 if( !linebuffer[á0 ]á)
  183.                         break;
  184.  
  185.                 p = strchr( linebuffer, ':'á);
  186.                 if( !p )
  187.                         break;
  188.  
  189.                 *p++ = 0;
  190.                 p = stpblk( p );
  191.  
  192. //              Printf( "rmail: line %s <:> %s\n", linebuffer, p );
  193.  
  194.                 if( !stricmp( linebuffer, "Organization" ) )
  195.                         CLU_FPrintfAsync( tofile, "ORG:%s\n",  p );
  196.                 else if( !stricmp( linebuffer, "Subject" ) )
  197.                 {
  198.                         CLU_FPrintfAsync( tofile, "BET:%s\n",  p );
  199. #ifndef UUXQT_MD
  200.                         set(tx[4], MUIA_Text_Contents, p);
  201. #endif
  202.                         gotsubject = TRUE;
  203.                 }
  204.                 else if( !stricmp( linebuffer, "From" ) )
  205.                 {
  206.                         c = convertadr( p, buffer );
  207.                         if( c < 0 )
  208.                         {
  209.                                 CLU_CloseAsync( newsfile );
  210.                                 CLU_CloseAsync( tofile );
  211.                                 return( 23 );
  212.                         }
  213.                         CLU_FPrintfAsync( tofile, "ABS:%s\n",  buffer );
  214. //                        CLU_FPrintfAsync( tofile, "ROT:%s\n", buffer );
  215.                         if( c )
  216.                                 CLU_FPrintfAsync( tofile, "U-From:%s\n", p );
  217.  
  218. #ifndef UUXQT_MD
  219.                         set(tx[2], MUIA_Text_Contents, buffer);
  220. #endif
  221.  
  222.                 }
  223.  
  224.                 else if( !stricmp( linebuffer, "Return-Receipt-To" ) )
  225.                 {
  226.                         c = convertadr( p, buffer );
  227.                         if( c < 0 )
  228.                         {
  229.                                 CLU_CloseAsync( newsfile );
  230.                                 CLU_CloseAsync( tofile );
  231.                                 return( 23 );
  232.                         }
  233.                         CLU_FPrintfAsync( tofile, "EB:%s\n",  buffer );
  234.                         if( c )
  235.                                 CLU_FPrintfAsync( tofile, "U-Return-Receipt-To:%s\n", p );
  236.                 }
  237.                 else if( !stricmp( linebuffer, "x-charset" ) )
  238.                 {
  239.                         if( !stricmp( p, "ISO-8859-1" ) )
  240.                                 isiso = TRUE;
  241.                 }
  242.                 else if( !stricmp( linebuffer, "content-type" ) )
  243.                 {
  244.                         if( strstr( p, "ISO" ) || strstr( p, "Iso" ) || strstr( p, "iso" ) )
  245.                                 isiso = TRUE;
  246.                 }
  247.  
  248.                 else if( !strcmp( linebuffer, "mime-version" ) )
  249.                         ismime = TRUE;
  250.  
  251.                 else if( !strcmp( linebuffer, "content-transfer") )
  252.                 {
  253.                         if( stricmp( p, "8bit" ) )
  254.                                 isiso    = TRUE;
  255.                         }
  256.  
  257.                 else if( !stricmp( linebuffer, "CC" ) )
  258.                 {
  259.                         CLU_FPrintfAsync( tofile, "U-CC:%s\n", p );
  260.  
  261.                         while( token = strtok( p, "," ) )
  262.                         {
  263.                                 p = NULL;
  264.                                 c = convertadr( token, buffer );
  265.                                 if( c < 0 )
  266.                                 {
  267.                                         /* Nichtkonvertierbare, m÷glicherweise falsche Adresse */
  268.                                         continue;
  269.                                 }
  270.                                 CLU_FPrintfAsync( tofile, "KOP:%s\n",  buffer );
  271.                         }
  272.                 }
  273.                 else if( !stricmp( linebuffer, "Date" ) )
  274.                 {
  275.                         token = convertuudate( p );
  276.                         if( !token )
  277.                                 return( -2 );
  278.                         CLU_FPrintfAsync( tofile, "EDA:%s\n",  token );
  279.                         CLU_FPrintfAsync( tofile, "U-Date:%s\n", p );
  280.                 }
  281.  
  282.                 else if( !stricmp( linebuffer, "Reply-To" ) )
  283.                 {
  284.                         c = convertadr( p, buffer );
  285.                         if( c < 0 )
  286.                         {
  287.                                 CLU_CloseAsync( newsfile );
  288.                                 CLU_CloseAsync( tofile );
  289.                                 return( -1 );
  290.                         }
  291.                         CLU_FPrintfAsync( tofile, "ANTWORT-AN:%s\n",  buffer );
  292.                         if( c )
  293.                                 CLU_FPrintfAsync( tofile, "U-Reply-To:%s\n", p );
  294.                 }
  295.  
  296. //                else if (!stricmp( linebuffer, "To" ) )
  297. //                {
  298. //                    c = convertadr( p, buffer );
  299. //                    if (c < 0)
  300. //                    {
  301. //                        CLU_CloseAsync( newsfile );
  302. //                        CLU_CloseAsync( tofile );
  303. //                        return( -1 );
  304. //                        }
  305. //
  306. //                    CLU_FPrintfAsync( tofile, "OEM:%s\n", buffer );
  307. ////                    if ( c )
  308. //                        CLU_FPrintfAsync( tofile, "U-To:%s\n", p );
  309. //                    }
  310.  
  311.                 else if( !stricmp( linebuffer, "In-Reply-To" ) || !stricmp( linebuffer, "References" ) )
  312.                 {
  313.                         p = strchr( p, '<' );
  314.                         if( p )
  315.                         {
  316.                                 while( token = strtok( p, ">" ) )
  317.                                 {
  318.                                         if( token[ 0 ]á== '<' )
  319.                                         {
  320.                                                 CLU_FPrintfAsync( tofile, "BEZ:%s\n", breakmid( token ) );
  321.                                         }
  322.                                         p = NULL;
  323.                                 }
  324.                         }
  325.                 }
  326.                 else if( !stricmp( linebuffer, "Message-ID" ) )
  327.                 {
  328.                         CLU_FPrintfAsync( tofile, "MID:%s\n", breakmid( p ) );
  329.                 }
  330.                 else if( !stricmp( linebuffer, "Supersedes" ) )
  331.                 {
  332.                         CLU_FPrintfAsync( tofile, "ERSETZT:%s\n", breakmid( p ) );
  333.                 }
  334.                 else if( !stricmp( linebuffer, "X-Newsreader" ) )
  335.                         CLU_FPrintfAsync( tofile, "MAILER:%s\n",  p );
  336.                 else if( !stricmp( linebuffer, "X-Mailer" ) )
  337.                         CLU_FPrintfAsync( tofile, "MAILER:%s\n",  p );
  338.                 else if( !stricmp( linebuffer, "X-Newssoftware" ) )
  339.                         CLU_FPrintfAsync( tofile, "MAILER:%s\n",  p );
  340.                 else if( !strnicmp( linebuffer, "X-Z-", 4 ) )
  341.                         CLU_FPrintfAsync( tofile, "%s:%s\n", &linebuffer[ 4 ], p );
  342.                 else if( !strnicmp( linebuffer, "X-ZC-", 5 ) )
  343.                         CLU_FPrintfAsync( tofile, "%s:%s\n", &linebuffer[ 5 ], p );
  344.                 else if( !stricmp( linebuffer, "Received:" ) ) 
  345.                 {
  346.                         if( !flag_myreceivedby )
  347.                         {
  348.                                 char x[6];
  349.  
  350.                                 utunpk( time( NULL ), x );
  351.  
  352. #ifndef UUXQT_MD
  353.                                 CLU_FPrintfAsync( tofile, "by %s (%02ld-%02ld-%02ld %02ld:%02ld:%02ld; Connectline/AmigaOS v" UUVER ")\n",
  354.                                         CLP_GetSystemAddress(),
  355.                                         x[ 2 ], x[á1 ], x[á0 ],
  356.                                         x[á3 ], x[á4 ], x[á5 ]
  357.                                 );
  358. #else
  359.                                 CLU_FPrintfAsync( tofile, "by %s.%s (%02ld-%02ld-%02ld %02ld:%02ld:%02ld; MicroDot/Amiga v" MDVER ")\n",
  360.                                         prefs.pointname, prefs.boxdomain,
  361.                                         x[ 2 ], x[á1 ], x[á0 ],
  362.                                         x[á3 ], x[á4 ], x[á5 ]
  363.                                 );
  364. #endif
  365.  
  366.                                 flag_myreceivedby = TRUE;
  367.                         }
  368.                         CLU_FPrintfAsync( tofile, "U-Received", p );
  369.                 }
  370.                 else
  371.                 {
  372.                     if( !strnicmp( linebuffer, "X-", 2 ) )
  373.                         CLU_FPrintfAsync( tofile, "%s:%s\n", linebuffer, p );
  374.                     else
  375.                         CLU_FPrintfAsync( tofile, "U-%s:%s\n", linebuffer, p );
  376.                     }
  377.         }
  378.  
  379.         domui();
  380.  
  381. //      Printf( "rmail:after headerparse\n" );
  382.  
  383.         if( (isiso ) || ( !isiso && !ismime ) )
  384.                 CLU_WriteAsync( tofile, "CHARSET:ISO1\n", 13 );
  385.  
  386.         /* Zeilen zΣhlen */
  387.         offs = CLU_FtellAsync( newsfile );
  388. //      Printf( "rmail: offs %ld\n", offs );
  389.         c = 0;
  390.         FOREVER
  391.         {
  392.                 ch = CLU_ReadCharAsync( newsfile );
  393.                 if( ch < 0 )
  394.                         break;
  395.                 if( ch == 10 )
  396.                         c += 2;
  397.                 else if( ch == 13 )
  398.                         continue;
  399.                 else c++;
  400.         }
  401.         CLU_SeekAsync( newsfile, offs, ASMODE_START );
  402.  
  403.         if( !gotsubject )
  404.                 CLU_FPrintfAsync( tofile, "BET:\n" );
  405.  
  406. #ifndef UUXQT_MD
  407.         CLU_FPrintfAsync( tofile, "__SOURCEFMT:RFC1036/822\nLEN:%ld\n\n", c );
  408. #else
  409.         CLU_FPrintfAsync( tofile, "LEN:%ld\n\n", c );
  410. #endif
  411.  
  412.         domui();
  413.  
  414. //      Printf( "rmail: zclen %ld\n", c );
  415.  
  416.         /* Artikelinhalt kopieren */
  417.         FOREVER
  418.         {
  419.                 ch = CLU_ReadCharAsync( newsfile );
  420.                 if( ch < 0 )
  421.                         break;
  422.                 if( ch == 13 )
  423.                         continue;
  424.                 else if( ch == 10 )
  425.                 {
  426.                         CLU_WriteCharAsync( tofile, 13 );
  427.                         CLU_WriteCharAsync( tofile, 10 );
  428.                 }
  429.                 else CLU_WriteCharAsync( tofile, ch );
  430.         }
  431.  
  432. //      Printf( "rmail: after msgcopy\n" );
  433.  
  434.         CLU_CloseAsync( tofile );
  435.         CLU_CloseAsync( newsfile );
  436.  
  437.         DeleteFile( from );
  438.  
  439. //      Printf( "rmail: exiting rmail\n" );
  440.  
  441.         return( 0 );
  442. }
  443.  
  444. /* Returncodes:
  445.  
  446.     3 = can't open tofile  
  447.     1 = can't open file
  448.         30 = smtp format error
  449.         31 = unexpected EOF
  450. */
  451.  
  452. int bsmtp( char *fromname )
  453. {
  454.         struct AsyncFile *bfile, *tofile;
  455.         char toname[á64 ];
  456.         char xname[á64 ];
  457.         BPTR xfile;
  458.         int Done = FALSE;
  459.         int rc = 0;
  460.         BOOL havefrom, haveto, havehelo;
  461.         char from[ 256 ], sys[á256 ];
  462.         char fromsys[á128 ], fromuser[á128 ];
  463.         char *p;
  464.         BPTR oldcd;
  465.         int mailcount = 0;
  466.         static char to[ 2048 ];
  467.  
  468.         lastoffset = NULL;
  469.  
  470.         domui();
  471.         set_status( GS( MSG_TXT_DOBSMTP ) );
  472.  
  473.         addlog( 6, "extracting smtp batch" );
  474.  
  475.         bfile = CLU_OpenAsync( fromname, ASMODE_READ, ASYNCBUFF );
  476.         if( !bfile )
  477.                 return( 1 );
  478.  
  479. #ifndef UUXQT_MD
  480.         oldcd = CurrentDir( Lock( "UUSPOOL:", SHARED_LOCK ) );
  481. #endif
  482.  
  483.         havehelo = FALSE;
  484.  
  485.         while( !Done )
  486.         {
  487.                 havefrom = FALSE;
  488.                 haveto = FALSE;
  489.                 to[á0 ]á= 0;
  490.                 set_fg( lastoffset = CLU_FtellAsync( bfile ) );
  491.  
  492.                 while( !Done )
  493.                 {
  494.                         if( !CLU_FGetsAsync( bfile, linebuffer, LBLEN ) )
  495.                         {
  496.                                 Done = 2;
  497.                                 break;
  498.                         }
  499.                         clnl( linebuffer );
  500.                         if( !stricmp( linebuffer, "QUIT" ) )
  501.                         {
  502.                                 Done = 1;
  503.                                 break;
  504.                         }
  505.                         else if( !stricmp( linebuffer, "DATA" ) )
  506.                         {
  507.                                 Done = 3;
  508.                                 break;
  509.                         }
  510.                         else if( !strnicmp( linebuffer, "HELO", 4 ) )
  511.                         {
  512.                                 strcpy( sys, stpblk( &linebuffer[á4 ]á) );
  513.                                 p = strchr( sys, '.' );
  514.                                 if( p )
  515.                                         *p = 0;
  516.                                 havehelo = TRUE;
  517.                         }
  518.                         else if( !strnicmp( linebuffer, "MAIL FROM:", 10 ) )
  519.                         {
  520.                                 strcpy( from, stpblk( &linebuffer[á10 ]á) + 1 );
  521.                                 havefrom = TRUE;
  522.                                 from[ástrlen( from ) - 1 ]á= 0;
  523.                         }
  524.                         else if( !strnicmp( linebuffer, "RCPT TO:", 8 ) )
  525.                         {
  526.                                 haveto = TRUE;
  527.                                 strcat( to, stpblk( &linebuffer[á8 ]á) + 1 );
  528.                                 strcpy(á&to[ástrlen( to ) - 1 ], " " );
  529.                         }
  530.                 }
  531.                 
  532.                 if( Done == 1 )
  533.                 {
  534.                         rc = 0;
  535.                         break;
  536.                 }
  537.  
  538.                 // OK, Header ist eingelesen
  539.                 if( Done == 2 )
  540.                 {
  541.                         rc = 31;
  542.                         break;                  
  543.                 }
  544.                 if( !haveto || !havefrom || !havehelo )
  545.                 {
  546.                         rc = 30;
  547.                         break;
  548.                 }
  549.  
  550.                 // Letztes Leerzeichen
  551.                 to[ástrlen( to ) - 1 ] = 0;
  552.  
  553.                 // Nun gut, also Data...
  554.  
  555.                 sprintf( xname, "X.%sNLL%ld", sys, CLU_GetSeqNum() );
  556.                 sprintf( toname, "D.%sloc%ld", sys, CLU_GetSeqNum() );
  557.  
  558.                 xfile = Open( xname, MODE_NEWFILE );
  559.  
  560.                 mailcount++;
  561.  
  562.                 FPrintf( xfile,
  563.                         "# bsmtp demangler command file (%ld from %s)\n"
  564.                         "U root %s\n"
  565.                         "F %s\n"
  566.                         "C rmail %s\n",
  567.  
  568.                         mailcount, fromname,
  569.                         sys, toname,
  570.                         to
  571.                 );
  572.                 Close( xfile );
  573.  
  574.                 tofile = CLU_OpenAsync( toname, ASMODE_WRITE, 8192 );
  575.  
  576.                 strcpy( fromuser, from );
  577.                 p = strchr( fromuser, '@' );
  578.                 if( p )
  579.                 {
  580.                         *p++ = 0;
  581.                         strcpy( fromsys, p );
  582.                 }
  583.  
  584.                 CLU_FPrintfAsync( tofile, "From %s!%s remote from %s\n", fromsys, fromuser, sys );
  585.  
  586.                 for(;;)
  587.                 {
  588.                         if( !CLU_FGetsAsync( bfile, linebuffer, LBLEN ) )
  589.                                 break;
  590.                         if( !strcmp( linebuffer, ".\n" ) )
  591.                                 break;
  592.                         CLU_WriteAsync( tofile, linebuffer, strlen( linebuffer ) );
  593.                 }
  594.                 CLU_CloseAsync( tofile );
  595.  
  596.                 if( Done == 3 )
  597.                         Done = FALSE;
  598.         }
  599.  
  600.         CLU_CloseAsync( bfile );
  601.  
  602.         addlog( 7, "bsmtp batch contained %ld mail(s)", mailcount );
  603.  
  604. #ifndef UUXQT_MD
  605.         UnLock( CurrentDir( oldcd ) );
  606. #endif
  607.  
  608.         return( rc );
  609. }
  610.  
  611. int cbsmtp( char *file )
  612. {
  613.         BPTR dosnewsfile, dostmpfile;
  614.         int rc;
  615.  
  616.         dosnewsfile = Open( file, MODE_OLDFILE );
  617.         if( !dosnewsfile )
  618.                 return( 1 );
  619.  
  620.         sprintf( tempfile, "uuconv.%lxtmp", CLU_GetSeqNum() );
  621.  
  622.         addlog( 6, "uncompressing %s to %s", file, tempfile );
  623.  
  624.         dostmpfile = Open( tempfile, MODE_NEWFILE );
  625.         if( !dostmpfile )
  626.         {
  627.                 Close( dosnewsfile );
  628.                 return( 3 );
  629.         }
  630.  
  631. #ifndef UUXQT_MD
  632.         CLP_PK_AllocSem();
  633.         rc = CLU_MUI_RunCommand( app, "UUCP:C/GZip -d",
  634.                 NP_Input, dosnewsfile,
  635.                 NP_Output, dostmpfile,
  636.                 NP_StackSize, 20480,
  637.                 NP_Priority, -1,
  638.                 TAG_DONE
  639.         );
  640.         CLP_PK_FreeSem();
  641. #else
  642.         {
  643.                 char exec[ 256 ];
  644.  
  645.                 strcpy( exec, gzipfullpath );
  646.                 strcat( exec, " -d" );
  647.  
  648.                 rc = SystemTags( exec,
  649.                         SYS_Input, dosnewsfile,
  650.                         SYS_Output, dostmpfile,
  651.                         NP_StackSize, 20480,
  652.                         NP_Priority, -1,
  653.                         TAG_DONE
  654.                 );
  655.                 Close( dosnewsfile );
  656.                 Close( dostmpfile );
  657.         }
  658. #endif
  659.  
  660.         rc = bsmtp( tempfile );
  661.  
  662.         if( !rc )
  663.         {
  664.                 DeleteFile( file );
  665.                 DeleteFile( tempfile );
  666.         }
  667.  
  668.         return( rc );
  669. }
  670.