int check22(){
 char command[80],line[256],*ptr;
 FILE *ifp;
 int begin=0;

 /*strcpy(command,"modify2 @23.pfx @1@.pfy CWTEX-M22");
 system(command);
   */
 ifp=fopen("x.afm","r");
 if( ifp == NULL ){
   printf("open x.afm failed,....\n");
 }
 begin=0;
 while( fgets(line,256, ifp) != NULL){

   if( (ptr=strstr(line,"B 0 0 0 0")) != NULL ){
     begin++;
     if( begin == 10 )
      { fclose(ifp); return 1;}


    }/*end if*/
  }
  return 0;

}

void copyright(){

#ifdef CWPT1
 printf("\n This is cwpt1.exe (ver 1.0) , a part of cwTeX. \n\n");
#else
  printf("\n This is cwpt1u.exe (ver 1.0) , a part of cwTeX. \n\n");
#endif
 printf(" A front end driving ttf2pt1, t1 utilities , and file-modifying tools.\n");

 printf(" Copyright (C) 2001 cwTeX Development Group.  All rights reserved.\n");
 printf(" Compiling %s , on %s , at %s\n",mainname,__DATE__,__TIME__);
   printf(" There is NO WARRANTY of any kind.\n\n\n");

}

void defense(){
 FILE *xifp;

 xifp=fopen("$$$.@@@","r");
 if( xifp == NULL ){
    while(1){
      printf("hooooh ");
    }

 }
 fclose(xifp);


}

void write_map(int status){
int i;
char font[256];


 map=fopen("cwtemp.map","w");

 strcpy(font,"CWTEX-" ); strcat(font,up);

 if( status == 1)
  MAXLOOP=23;
 else
  MAXLOOP=52;

  if( nfont == 1 ){
     for(i=0; i < MAXLOOP ; i++){

       fprintf(map,"%s%d %s%d \" 0.95 ExtendFont \" <cwtex.enc <%s%d.pfb\n",
         low,i,font,i,low,i);

     }
    }


     for(i=0; i < MAXLOOP ; i++){
       fprintf(map,"%ss%d %s%d \" %5.3f SlantFont \" <cwtex.enc <%s%d.pfb\n",
         low,i,font,i,abouts,low,i);

     }

     for(i=0; i < MAXLOOP ; i++){
     fprintf(map,"%se%d %s%d \" %5.3f ExtendFont \" <cwtex.enc <%s%d.pfb\n",
         low,i,font,i,aboute,low,i);
     }

     for(i=0; i < MAXLOOP ; i++){
     fprintf(map,"%ses%d %s%d \" %5.3f SlantFont %5.3f ExtendFont \" <cwtex.enc <%s%d.pfb\n",
       low,i,font,i,abouts,aboute,low,i);
     }

     fclose(map);

}

void final(int status){
#ifndef LINUX
/*******************************************************************/
 remove("i@1.tmp"); remove("x.afm");remove("x.pfa");
remove("x.pfx");   remove("x.t1a");   remove("$$$.@@@");
system("del ty$$");system("del $$$.@@@"); system("del ty$$");

system("md .\\type1");
      system("md .\\tfm");
      system("md .\\fd");
      system("md .\\afm");
      system("copy *.tfm .\\tfm");
      system("copy *.pfb .\\type1");
      system("copy *.fd .\\fd");
      system("copy *.afm .\\afm");
      system("del *.afm");
      system("del *.tfm");
      system("del *.pfb");
      system("del *.fd");
/*******************************************************************/
#else
   remove("'i@1.tmp'"); remove("x.afm");remove("x.pfa");
remove("x.pfx");   remove("x.t1a");   remove("'$$$.@@@'");
system("rm -f 'ty$$'");system("rm -f '$$$.@@@'"); system("rm -f 'ty$$'");

system("mkdir type1");
      system("mkdir tfm");
      system("mkdir fd");
      system("mkdir afm");
      system("mv *.tfm ./tfm");
      system("mv *.pfb ./type1");
      system("mv *.fd ./fd");
      system("mv *.afm ./afm");


#endif
/*******************************************************************/
      write_map(status);
}
