8#include "tpcclibConfig.h"
23static char *info[] = {
24 "Converts result file to (X)HTML table format for viewing in web browsers",
25 "or importing into Excel or other spreadsheet software.",
27 "Usage: @P [Options] <Result file> [HTML filename]",
29 "If HTML filename is omitted, then it is named automatically by replacing",
30 "original extension with .htm.",
34 " SDs and CVs are not saved into HTML file.",
38 " @P ug77654ki.res ug77654ki.htm",
40 "See also: reslist, rescoll, pardiff, parformat",
42 "Keywords: results, HTML, tool",
61int main(
int argc,
char **argv)
63 int ai, help=0, version=0, verbose=1;
66 char *cptr, resfile[FILENAME_MAX], htmfile[FILENAME_MAX];
72 if(argc==1) {
tpcPrintUsage(argv[0], info, stderr);
return(1);}
73 resfile[0]=htmfile[0]=(char)0;
76 for(ai=1; ai<argc; ai++)
if(*argv[ai]==
'-') {
78 cptr=argv[ai]+1;
if(*cptr==
'-') cptr++;
if(!cptr[0])
continue;
79 if(strncasecmp(cptr,
"NOSD", 1)==0) {
82 fprintf(stderr,
"Error: invalid option '%s'.\n", argv[ai]);
87 if(help==2) {
tpcHtmlUsage(argv[0], info,
"");
return(0);}
92 for(; ai<argc; ai++) {
93 if(!resfile[0]) {
strlcpy(resfile, argv[ai], FILENAME_MAX);
continue;}
94 else if(!htmfile[0]) {
strlcpy(htmfile, argv[ai], FILENAME_MAX);
continue;}
99 fprintf(stderr,
"Error: missing command-line argument; use option --help\n");
103 strcpy(htmfile, resfile);
104 cptr=strrchr(htmfile,
'.');
if(cptr!=NULL) *cptr=(char)0;
105 strcat(htmfile,
".htm");
110 printf(
"resfile := %s\n", resfile);
111 printf(
"htmfile := %s\n", htmfile);
112 printf(
"saveSD := %d\n", saveSD);
120 if(verbose>1) printf(
"reading %s\n", resfile);
121 if(
resRead(resfile, &res, verbose-2)) {
122 fprintf(stderr,
"Error in reading '%s': %s\n", resfile,
reserrmsg);
132 for(
int ri=0; ri<res.
voiNr; ri++)
for(
int pi=0; pi<res.
parNr; pi++)
140 if(verbose>1) printf(
"writing %s\n", htmfile);
142 fprintf(stderr,
"Error in writing '%s': %s\n", resfile,
reserrmsg);
147 if(verbose==1) printf(
"%s written.\n", htmfile);
Header file for libtpccurveio.
int resRead(char *filename, RES *res, int verbose)
int resWriteHTML(RES *res, char *fname, int verbose)
Header file for libtpcmisc.
int tpcProcessStdOptions(const char *s, int *print_usage, int *print_version, int *verbose_level)
size_t strlcpy(char *dst, const char *src, size_t dstsize)
int tpcHtmlUsage(const char *program, char *text[], const char *path)
void tpcPrintBuild(const char *program, FILE *fp)
void tpcPrintUsage(const char *program, char *text[], FILE *fp)
double cl2[MAX_RESPARAMS]
double cl1[MAX_RESPARAMS]