X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=betty%2Ffont2b.c;h=b0e9c7cfc7f69fa497dc83aad83b19e67332b032;hb=d7ff99dcff9f0f615da9f491b7b7d2c1629bdcf2;hp=6c1af61adabc0aa2b0a035eae695092f8c7636e5;hpb=362d5c63842bf9e3a16de41515f5b76e867d6452;p=my-code%2Farm.git diff --git a/betty/font2b.c b/betty/font2b.c index 6c1af61..b0e9c7c 100644 --- a/betty/font2b.c +++ b/betty/font2b.c @@ -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++) { @@ -66,17 +68,14 @@ int main(int argc,char **argv) { for(row=0;row<8;row++) buf|=(font_data[font*8+row]&(1<<(7-col))); if(stat==CHAR) { - if(!(col%4)) + if(col==0) printf("\t"); - printf("0x%02x,0x%02x",buf,buf); + printf("0x%02x",buf); if((font!=0xff)|(col!=7)) printf(","); - if(col==3) - printf("\n"); } else { write(fd,&buf,1); - write(fd,&buf,1); } } if(stat==CHAR)