diff options
Diffstat (limited to '')
-rw-r--r-- | chkfont.c | 63 |
1 files changed, 20 insertions, 43 deletions
@@ -1,14 +1,6 @@ #include <stdio.h> #include <string.h> #include <ctype.h> -#ifdef __STDC__ -#include <stdlib.h> -#endif - -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS (0) -#define EXIT_FAILURE (1) -#endif #define DATE "20 Feb 1996" #define VERSION "2.2" @@ -27,24 +19,18 @@ full o' bugs .... */ -/* Squashed some warnings and a double free(): Kenneth Davies Mar 14 2005 */ - /* #define CHECKBLANKS */ #define FONTFILESUFFIX ".flf" #define FONTFILEMAGICNUMBER "flf2" - -const char -posshardblanks[9] = { '!', '@', '#', '$', '%', '&', '*', '\177', '\0' }; +char posshardblanks[9] = { '!', '@', '#', '$', '%', '&', '*', 0x7f, 0 }; char *myname,*fontfilename; FILE *fontfile; char hardblank; -int charheight,upheight,old_layout; +int charheight,upheight,maxlen=0,old_layout; int spectagcnt; -char *fileline = NULL; -int currline; -int maxlinelength=0; -int maxlen=0; +char *fileline; +int maxlinelength=0,currline; int ec,wc; int incon_endmarkwarn,endmark_countwarn,nonincrwarn; @@ -52,8 +38,8 @@ int bigcodetagwarn,deutschcodetagwarn,asciicodetagwarn; int codetagcnt; int gone; -void -weregone(int really) +void weregone(really) +int really; { if (!really && 2*ec+wc<=40) { return; @@ -74,23 +60,23 @@ printf("------------------------------------------------------------------------ gone=1; } -char * -my_alloc(size_t size) +char *my_alloc(size) +int size; { char *ptr; ptr=(char *)malloc(size); if (ptr==NULL) { fprintf(stderr,"%s: Out of memory\n",myname); - exit(EXIT_FAILURE); /* Bail out now instead of not returning anything */ } else { return(ptr); } } -int -badsuffix(char *path, char *suffix) +int badsuffix(path,suffix) +char *path; +char *suffix; { char ucsuffix[10]; char *s; @@ -107,30 +93,22 @@ badsuffix(char *path, char *suffix) return 1; } -void -usageerr() +void usageerr() { fprintf(stderr,"chkfont by Glenn Chappell <ggc@uiuc.edu>\n"); fprintf(stderr,"Version: %s, date: %s\n",VERSION,DATE); fprintf(stderr,"Checks figlet 2.0/2.1 font files for format errors.\n"); fprintf(stderr,"(Does not modify font files.)\n"); fprintf(stderr,"Usage: %s fontfile ...\n",myname); -exit(EXIT_FAILURE); +exit(1); } -void -readchar() +void readchar() { -int i,expected_width,k,diff,l; +int i,expected_width,k,len,newlen,diff,l; char endmark,expected_endmark; int leadblanks,minleadblanks,trailblanks,mintrailblanks; -int len, newlen; - - minleadblanks=0; - expected_endmark='\0'; - expected_width=0; - mintrailblanks=0; for (i=0;i<charheight;i++) { fgets(fileline,maxlen+1000,fontfile); @@ -224,8 +202,7 @@ if (minleadblanks+mintrailblanks>0 && old_layout>=0) { } -void -checkit() +void checkit() { int i,k,cmtcount,numsread,ffrighttoleft,have_layout,layout; char magicnum[5],cha; @@ -246,7 +223,7 @@ else { fontfile=fopen(fontfilename,"r"); if (fontfile == NULL) { fprintf(stderr,"%s: Could not open file '%s'\n",myname,fontfilename); - exit(EXIT_FAILURE); + exit(1); } } @@ -281,7 +258,6 @@ numsread=sscanf(fileline,"%c %d %d %d %d %d %d %d %d", &hardblank,&charheight,&upheight,&maxlen,&old_layout,&cmtcount, &ffrighttoleft,&layout,&spectagcnt); free(fileline); -fileline = NULL; if (numsread<7) { ffrighttoleft=0; } @@ -460,8 +436,9 @@ weregone(1); if (gone) return; } -int -main(int argc, char *argv[]) +int main(argc,argv) +int argc; +char *argv[]; { int arg; |