int nfont=0;
int myargc=0;
float aboutl=0.0;
float abouts;
float aboute;
float aboutxs;
float aboutxe;
float aboutfd;
float aboutns=0.167,aboutne=0.8645;
char gfont[60];/*fontname or filename*/

struct _ARGS {
 char option[3];
 char content[30];
};

typedef struct _ARGS Args;

Args myarg[6]={"-s","0.167","-e","0.91","-x","0.167+0.91","-l","0.00","-d","0.88"
 ,"-n","0.167+0.86"};


int is_arg(char *arg){
 int i;



 for( i=0; i < 6; i++){

  if( !strcmp(myarg[i].option,arg) )
   return i;
 }

 return -1;
}

void do_arg(int argc, char *argv[]){
 int i;
 int ret;

 if( argc < 2 || argc > 13 ){
   copyright();
   #ifdef CWPT1
   printf("Usage: cwpt1 fontname [options]\n");
   #else
       printf("Usage: cwpt1u fontname [options]\n");
   #endif

   printf("\tfontname:m, bb, b, f......\n");
   printf("\t   options: -n, produing cwTeX n fonts (n,s,e)=(0.95,0.167,0.864)\n");
   printf("\t   options: -s -e, the same as afm2tfm\n");
   printf("\t    option: -x,   options -s and -e combined, syntax: -x 0.196+0.91\n");
   printf("\t    option: -d, syntax: -d 0.85, cwtex font fd parameter\n");
   printf("\t    option: -l, syntax: -l (-)0.135, \n");
   printf("\t     (lower)raise the font by 0.135 x the height of each character\n");
   exit(1);
  }

  for( i=1; i < argc ; i++){
    if( (ret=is_arg(argv[i])) != -1  ){

      if( ret == 5 )
       {  nfont=1; }
      else if( argv[i+1][0] == '-' || (i+1) == argc ){

       printf("Warning: the option %s needs an argument! give up....\n", argv[i]);
       exit(1);
      }
      else if( ret == 0){

        sscanf(argv[i+1], "%f", &aboutns);
       strcpy(myarg[ret].content,argv[++i]);
      }
      else if( ret == 1){

        sscanf(argv[i+1], "%f", &aboutne);
       strcpy(myarg[ret].content,argv[++i]);
      }
      else
       { strcpy(myarg[ret].content,argv[++i]); }
    }
    else{ myargc++;

        strcpy(gfont,argv[i]);

    }
  }

  if( myargc > 1 ){
    printf("Warning: more than one fontname was specified, giving up...\n");
    exit(1);
  }
  else if( myargc == 0){
   printf("Warning: a fontname must be specified, giving up...\n");
   exit(1);
  }

}
/*
Args myarg[4]={"-s","0.167","-e","0.91","-x","0.167+0.91","-l","0.00"};
int myargc=0;
float aboutl=0.0;
float abouts;
float aboute;
float aboutx;
*/
void dump_content(){
 int i;


  sscanf(myarg[0].content, "%f", &abouts);
  sscanf(myarg[1].content, "%f", &aboute);
  sscanf(myarg[3].content, "%f", &aboutl);
  sscanf(myarg[4].content, "%f", &aboutfd);

  if(   sscanf(myarg[2].content, "%f+%f", &aboutxs,&aboutxe) != 2 )
   { printf("Warning: unknow spefication about the option -x, giving up....\n"); exit(1);}

   if( nfont == 1 ){
   abouts=aboutns;aboute=aboutne;
   aboutxs=aboutns;aboutxe=aboute;
  }
   /*
   printf("\nabouts:%f aboute:%f aboutxe:%f\n aboutxs%f\n",abouts,aboute,aboutxe,aboutxs);
   exit(1);
     */
}
