fixed binary writing
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Thu, 13 Sep 2007 12:09:56 +0000 (14:09 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Thu, 13 Sep 2007 12:09:56 +0000 (14:09 +0200)
betty/font2b.c

index 6c1af61..fd88252 100644 (file)
@@ -40,7 +40,7 @@ int main(int argc,char **argv) {
 
        stat=CHAR;
        if(argc==2) {
-               fd=open(argv[1],O_WRONLY);
+               fd=open(argv[1],O_WRONLY|O_CREAT);
                if(fd<0) {
                        perror("file open");
                        return fd;
@@ -54,11 +54,13 @@ int main(int argc,char **argv) {
        for(font=0;font<=0xff;font++) {
 
                /* print the font number */
-               printf("\t/* %d 0x%02x",font,font);
-               if((font>0x1f)&(font<0x7f))
-                       printf(" %c */\n",font);
-               else
-                       printf(" */\n");
+               if(stat==CHAR) {
+                       printf("\t/* %d 0x%02x",font,font);
+                       if((font>0x1f)&(font<0x7f))
+                               printf(" %c */\n",font);
+                       else
+                               printf(" */\n");
+               }
 
                /* print the array content of the font */
                for(col=0;col<8;col++) {