diff conv/c.c @ 65:8ad746efa4f8

*** empty log message ***
author kono
date Thu, 20 Feb 2003 08:56:29 +0900
parents aa779bcffef7
children 0b068058dd67
line wrap: on
line diff
--- a/conv/c.c	Thu Feb 20 05:58:01 2003 +0900
+++ b/conv/c.c	Thu Feb 20 08:56:29 2003 +0900
@@ -2,16 +2,41 @@
 
 #include "mc.h"
 
+static void open(char *);
 static void print(char *);
+static void close();
 
 Converter c_converter = {
-    &print
+    &open,
+    &print,
+    &close,
 };
 
 static FILE *vout;
 
 static void
+open(char *s)
+{
+    char *p=cheapp;
+    while((*cheapp++ = *s++)) {
+	if (*s=='.') {
+	    *cheapp++=*s++; *cheapp++='c';
+	    *cheapp++='c'; *cheapp++=0;
+	    break;
+	}
+    }
+    vout = fopen(p,"w");
+    if(!vout) error(-1);
+}
+
+static void
 print(char *s)
 {
     fprintf(vout,"c: %s\n",s);
 }
+
+static void
+close()
+{
+    fclose(vout);
+}