update
This commit is contained in:
25
DEV.1.2/csv2html.c
Normal file
25
DEV.1.2/csv2html.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* csv2html < file.csv > file.html */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int s;
|
||||
|
||||
printf("<table>\n<tr><td>");
|
||||
|
||||
while ((s = getchar()) != EOF) {
|
||||
switch(s) {
|
||||
case '\n': printf("</td></tr>\n<tr><td>"); break;
|
||||
case ';': printf("</td><td>"); break;
|
||||
case '<': printf("<"); break;
|
||||
case '>': printf(">"); break;
|
||||
case '&': printf("&"); break;
|
||||
default: putchar(s);
|
||||
}
|
||||
}
|
||||
|
||||
puts("</td></tr>\n</table>");
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user