"Fossies" - the Fresh Open Source Software Archive 
Member "postal-0.76/ex-test.cpp" (4 Feb 2000, 615 Bytes) of package /linux/privat/postal-0.76.tgz:
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.
For more information about "ex-test.cpp" see the
Fossies "Dox" file reference documentation.
1 #include "expand.h"
2 #include <string>
3 #include <stdio.h>
4
5 void usage()
6 {
7 printf("Usage: ex-test input-file conversion-file\n");
8 exit(1);
9 }
10
11 int main(int argc, char **argv)
12 {
13 if(argc != 3)
14 usage();
15 NameExpand exp(argv[2]);
16 FILE *fp = fopen(argv[1], "r");
17 if(!fp)
18 usage();
19 char buf[1024];
20 while(fgets(buf, sizeof(buf), fp) )
21 {
22 if(buf[0] && buf[0] != '\n')
23 {
24 strtok(buf, "\n");
25 for(int i = 0; i < 1000; i++)
26 {
27 string str;
28 if(exp.expand(str, buf))
29 return 1;
30 printf("%s\n", str.c_str());
31 }
32 }
33 }
34 fclose(fp);
35 return 0;
36 }