1 /* $NetBSD: stream2rec.c,v 1.1.1.1 2009/06/23 10:08:48 tron Exp $ */ 2 3 /*++ 4 /* NAME 5 /* stream2rec 1 6 /* SUMMARY 7 /* convert stream-lf data to record format 8 /* SYNOPSIS 9 /* stream2rec 10 /* DESCRIPTION 11 /* stream2rec reads lines from standard input and writes 12 /* them to standard output in record form. 13 /* DIAGNOSTICS 14 /* Problems are reported to the standard error stream. 15 /* LICENSE 16 /* .ad 17 /* .fi 18 /* The Secure Mailer license must be distributed with this software. 19 /* AUTHOR(S) 20 /* Wietse Venema 21 /* IBM T.J. Watson Research 22 /* P.O. Box 704 23 /* Yorktown Heights, NY 10598, USA 24 /*--*/ 25 26 /* System library. */ 27 28 #include <sys_defs.h> 29 30 /* Utility library. */ 31 32 #include <vstream.h> 33 #include <vstring.h> 34 35 /* Global library. */ 36 37 #include <record.h> 38 #include <rec_streamlf.h> 39 main(void)40int main(void) 41 { 42 VSTRING *buf = vstring_alloc(150); 43 int type; 44 45 while ((type = rec_streamlf_get(VSTREAM_IN, buf, 150)) > 0) 46 REC_PUT_BUF(VSTREAM_OUT, type, buf); 47 vstream_fflush(VSTREAM_OUT); 48 return (0); 49 } 50