
#include<stdio.h>
#include<netinet/in.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
#include<pthread.h>

#include"sitar.h"
#include<almemsys/almemsys.h>


extern global_data_t gd;

/*
int optin(int, char *[]);
*/

int opt_version(void); 
int opt_path(char *); 


int optin(int argc, char * argv[])
{
extern char *optarg;
int i;

opt_path(CONF_PATH);

while((i=getopt(argc,argv,"c:i:p:h:f:v"))!= EOF){
   switch(i){
      case 'c': opt_path(optarg);    break; 
      case 'v': opt_version();       break; 
      default : opt_version();       break;
      }
   }
return 0;
}


/* ------------- sub ------------- */

int opt_version(void)
{
printf("------- %s -------\n", CL_VAR);

printf("MAX THREAD              = %d(default)\n", B_LEN);
printf("MAX process in thread   = %d(default)\n", B_MAX);
printf("MAX Simultaneous thread = %d(default)\n", L_LEN);


#ifdef KEEP_MALLOC
printf("Large-scale operation use\n");
#else
printf("Small-scale operation use\n");
#endif

printf("Options\n");
printf("     -c /*/** config file path\n");
printf("\n");
exit(1);
return 0;
}



int opt_path(char *path) 
{
int inA = strlen(path);
if(0 < inA && inA < BUF_LEN){ 
   gd.fi.conf_path = path;
   }
else {
   gd.fi.conf_path = CONF_PATH;
   } 
return 0;
}




