set flag off while open connection { input /nowrap 10 \13\10.\13\10 # Wait for <CRLF>.<CRLF> if success { frwrite /string \%o {\freplace(\v(input),\13\10.\13\10,\13\10)} set flag on break } else if ( == \v(instatus) 6 || == \v(instatus) 1 ) { frwrite /string \%o {\v(input)} continue } break } if flag (handle success)
Note carefully the braces around the FWRITE text; without them, trailing spaces would be lost. Also note that the IF condition that checks \v(instatus) could be written more simply as:
} else if match \v(instatus) [16] {
Previously the only way to INPUT an entire data stream without losing anything (assuming it was ordinary lines of text that were not "too long"), was line-by-line (as in this example where we want to copy everything up to the next "$" prompt to a file):
while open connection { input /clear 10 \13\10 if fail break if eq "\v(input)" "\13\10$\32" break fwrite /string \%o {\freplace(\v(input),\13\10,\10)} }
The new code is 3 times faster using the default INPUT buffer length of 4K. Raising it to 16K makes it 3.6 times faster (not worth it). Changing the POP3 script to use INPUT /NOWRAP makes it about twice as fast (it does more; it has to do all the byte-stuffing and unstuffing).
The POP script that prompted the addition of INPUT /NOWRAP is in production and can be seen HERE. C-Kermit makes an excellent POP client because of:
For reference, here is a current list of INPUT status codes:
\v(instatus) Meaning 0 Success 1 Timed out 2 User interrupted from keyboard 3 Internal error 4 I/O error or connection lost 5 Internet Kermit Service active, INPUT disabled 6 Buffer full and /NOWRAP specified
fdc@columbia.edu, 3 Dec 2005.
[ C-Kermit Daily Builds ] [ C-Kermit Home ] [ Kermit Home ]