Ejemplo n.º 1
0
int add_command_list(char *option,char  *value){
  char *p;
  int i,ii;

  if(!option || !value || !option[0] || !value[0]){
    return 0;
  }

  for ( i = 0; command_array[i].option[0] != 0; i ++ ){
    p = strstr_ex(command_array[i].option , option);
    if(p){
      
      write_log_file(3,"        C  %s  %s\n",option,value);  
      strcpy(command_array[i].value, value);
      break;
    }
  }

  if(command_array[i].option[0] == 0){
    strcpy( command_array[i].option ,option);
    strcpy( command_array[i].value  ,value);
    write_log_file(3,"        A  %s  %s\n",option,value);  
  }
  return 1;
}
Ejemplo n.º 2
0
int add_command_list(char *option,char  *value){
  char *p;
  int i,ii;


  //DEBUGPRINT2("   add_command_list:start [%s] [%s]\n",option,value);
  if(!option || !value || !option[0] || !value[0]){

    //DEBUGPRINT2("   add_command_list:start ERROR [%d] [%s]\n",option,value);
    return 0;
  }

  for ( i = 0; command_array[i].option[0] != 0; i ++ ){
    //DEBUGPRINT4("   add_command_list:[%s] [%s] [%s] %d\n"
    //	,command_array[i].value,option,value,i);
    p = strstr_ex(command_array[i].option , option);
    if(p){
      //DEBUGPRINT2("     add_command_list   chg element %s %s\n",option,value);  
      write_log_file(3,"        C  %s  %s\n",option,value);  
      strcpy(command_array[i].value, value);
      break;
    }
  }

  if(command_array[i].option[0] == 0){
    //DEBUGPRINT2("     add_command_list   add element %s %s\n",option,value);  
    strcpy( command_array[i].option ,option);
    strcpy( command_array[i].value  ,value);
    write_log_file(3,"        A  %s  %s\n",option,value);  

  }
  return 1;
}
int exec_brprintconf(char *brprintconf___0 , char *printer ) 
{ 
  int i ;
  char exec[300] ;

  {
#line 353
  i = 0;
  {
#line 353
  while (1) {
    while_continue: /* CIL Label */ ;
#line 353
    if (! ((int )command_array[i].value[0] != 0)) {
#line 353
      goto while_break;
    }
    {
#line 354
    sprintf((char */* __restrict  */)(exec), (char const   */* __restrict  */)"%s_%s  %s  \"%s\"",
            brprintconf___0, printer, command_array[i].option, command_array[i].value);
#line 358
    write_log_file(1, (char *)"%s\n", exec);
#line 361
    system((char const   *)(exec));
#line 353
    i ++;
    }
  }
  while_break: /* CIL Label */ ;
  }
#line 366
  return (0);
}
}
Ejemplo n.º 4
0
void  LBM::calculate_macroscopic_quantities(const int& iteration){



	//todo: check, maybe rec_pr's size might have conflict in size dimension
	/************************************************************************
	 *                                                                      *
	 *     Output of results to file 'tecplot.dat'                          *
	 *                                                                      *
	 *            Christos Tsotskas											 *
	 *                                                                      *
	 *     Last change: 09/06/2013                                          *
	 *                                                                      *
	 ************************************************************************/

	if(data_location==GPU)
		copy_data_from_device_to_host();

	pr_diff = calculate_pressure_differences();

	vor = calculate_vorticity();

	write_log_file(iteration);
	write_objectives();

	cout << " save_data exit" << endl;
}
Ejemplo n.º 5
0
int32 UartDown485_Rec(void)
{
    uint8 lu8data = 0;
    fd_set ReadSetFD;
    struct timeval stTimeVal;
    uint8 ret;
    char log[1024];

    while(1) {
        FD_ZERO(&ReadSetFD);
        FD_SET(g_uiRS4852Fd, &ReadSetFD);
        /* 设置等待的超时时间 */
        stTimeVal.tv_sec = REC_TIMEOUT_SEC;
        stTimeVal.tv_usec = REC_TIMEOUT_USEC;

        if (select(g_uiRS4852Fd+1, &ReadSetFD, NULL, NULL,&stTimeVal) > 0){
            if (FD_ISSET(g_uiRS4852Fd, &ReadSetFD)){
                if(read(g_uiRS4852Fd, &lu8data, 1) == 1){
                    ret = QueueWrite((void*)DownRecQueue_RS485, lu8data);
                    if(ret != QUEUE_OK){
                        sprintf(log, "[%s][%s][%d]QueueWrite err, ret = %d QUEUE_EMPTY\n", FILE_LINE, ret);
                        write_log_file(log, strlen(log));
                    }
                    OSSemPost(DOWN_COMMU_DEV_485);
                    //sprintf(log, "[%s][%s][%d] 0x%02X \n",FILE_LINE,lu8data);
                    //write_log_file(log, strlen(log));
                }
            }
        }
    }

  	return(CONTROL_RET_FAIL);
}
Ejemplo n.º 6
0
uint8 ReadWaterMeter(MeterFileType *pmf, waterDataPtr pWaterData)
{
	uint8 err = NO_ERR;
	uint8 lu8retrytimes = 0;
	char log[1024];
	if(pmf->u8ProtocolType >= WATER_PROTO_SUM){  //防止协议版本号超限。
		return ERR_1;
	}

	//根据协议版本号,设置对应端口参数.
	lu8retrytimes = 3;
	do{
		err = (*WATER_METER_ComParaSetArray[gWATER_METER_Table[pmf->u8ProtocolType][0]])();  //按照抄表协议,设置抄表串口参数。
		lu8retrytimes--;
	}while((err != TRUE) && (lu8retrytimes > 0));
	sprintf(log, "[%s][%s][%d]err: %d\n", FILE_LINE, err);
	write_log_file(log, strlen(log));
	//组建抄表数据帧
	err = waterMeterCommunicate(pmf, pWaterData);
	sprintf(log, "[%s][%s][%d]err: %d\n", FILE_LINE, err);
	write_log_file(log, strlen(log));
	return err;
}
Ejemplo n.º 7
0
int exec_brprintconf(char *brprintconf,char *printer,char* rcfilepath)
{
    int i;
    char exec[300];

    DEBUGPRINT("exec_brprintconf:start\n");

    for ( i = 0; command_array[i].value[0] != 0; i ++ ){
        sprintf(exec,"%s_%s   -P %s   %s  \"%s\" -rcfile \"%s\"",brprintconf,printer, printer,
                command_array[i].option,
                command_array[i].value, rcfilepath);
        write_log_file(1,"%s\n",exec);

        system(exec);
    }
}
Ejemplo n.º 8
0
// make sure write files is intended
void
Responder::safe_write_statistics_to_file(StatsMap mapStats, uint64_t max_success, int return_code)
{
    if ((_opt.test_iterations > 0) && (_stats_filename.empty() == false) && (_opt.no_stats_file == false))
    {
        if (mapStats.empty())
        {
            cout << "No results to output (not writing statistics file)" << endl;
        }
        else if ((max_success == 0) && (return_code == RETCODE_MANUAL_ABORT))
        {
            cout << "Aborted before a single successful timed burst (not writing statistics file)" << endl;
        }
        else
        {
            write_statistics_to_file(mapStats);
        }
        write_log_file();
    }
}
Ejemplo n.º 9
0
int exec_brprintconf(char *brprintconf,char *printer){
  int i;
  char exec[300];

  DEBUGPRINT("exec_brprintconf:start\n");

  for ( i = 0; command_array[i].value[0] != 0; i ++ ){
    sprintf(exec,"%s_%s  %s  \"%s\"",brprintconf, printer,
	    command_array[i].option,
	    command_array[i].value);

    write_log_file(1,"%s\n",exec);

//	fprintf (stderr, "ERROR:%s\n", exec);
    system(exec);

    //DEBUGPRINT1("exec: %s\n",exec);
  }

	return 0;
}
Ejemplo n.º 10
0
uint8 waterMeter_DataSendAndRec(MeterFileType *pmf, uint8* buf, uint16* plen)
{
	uint8 err = 0;
	uint32 lu32len = *plen;
	uint16 lu16OutTime = 2000;//毫秒。
	uint8 lu8DownComDev;
	char log[4096];

	if(pmf->u8Channel == RS485_DOWN_CHANNEL) {
		lu8DownComDev = DOWN_COMMU_DEV_485;
	} else {
		lu8DownComDev = DOWN_COMMU_DEV_MBUS;
	}

	switch(gWATER_METER_Table[pmf->u8ProtocolType][em_water_table_busType]) {
	case WATER_MBUS:
		err = MBUS_DataSend(buf, lu32len);
		break;
	case WATER_RS485:
		err = RS485Down_DataSend(buf, lu32len);
		break;
	default:
		break;
	}

	sprintf(log, "[%s][%s][%d]err: %d\n", FILE_LINE, err);
	write_log_file(log, strlen(log));

	switch(gWATER_METER_Table[pmf->u8ProtocolType][em_water_table_protoType]) {
	case WATER_PROTO_MODBUS:
		break;
	case WATER_PROTO_CJ188:
		err = waterReceiveFrame(pmf, lu8DownComDev, lu16OutTime, buf, plen);
		break;
	default:
		break;
	}

	return NO_ERR;
}
Ejemplo n.º 11
0
pictureStruct readPicture (string file_name, pictureStruct picture) {
    
    long lSize = 0;
    unsigned char *buffer;
    int result = 0;
    FILE* ID_LOG_FILE;
    FILE* ID_SOURCE_IMAGE;
    
    // Open source picture for read
    ID_SOURCE_IMAGE = fopen (file_name.c_str(), "rb");
    write_log_file("*INFO readPicture : open file " + file_name + "\n");   
    if (ID_SOURCE_IMAGE == NULL) {
        write_log_file("*INFO readPicture : file for read " + file_name + "can't open\n");
    }

    // Find a size of file
    fseek(ID_SOURCE_IMAGE , 0 , SEEK_END);
    lSize = ftell(ID_SOURCE_IMAGE);
    std::ostringstream ost;
    ost << lSize; 
    write_log_file("*INFO readPicture : lSize = " + ost.str() + "\n");
    rewind(ID_SOURCE_IMAGE);
    
    // Memmory allocation for buffer
    buffer = (unsigned char*) malloc(sizeof(unsigned char) * lSize + 1);
    if (buffer == NULL)
        write_log_file("*ERROR readPicture : Memory error\n");

    // Copy file to buffer
    result = fread(buffer, 1, lSize, ID_SOURCE_IMAGE);
    if (result != lSize)
        write_log_file("*ERROR readPicture : Reading error\n");

    // Close source file
    fclose (ID_SOURCE_IMAGE);

    // Copy buffer to array
    unsigned char img [lSize];
    for (int i = 0; i < lSize; i++) {
        img[i] = *(buffer);
        buffer++;
    }

    for (int i = 0; i < 18; i++) {
        ost.str("");
        ost << (int)img[i];
        write_log_file("*INFO readPicture : head =  " + ost.str() + "\n");
    }

    // Find a width
    picture.width = (int)img[13]*256 + (int)img[12];
    ost.str("");
    ost << picture.width;
    write_log_file("*INFO readPicture : width = " + ost.str() + "\n");

    // Find a high
    picture.high = (int)img[15]*256 + (int)img[14];
    ost.str("");
    ost << picture.high;
    write_log_file("*INFO readPicture : high = " + ost.str() + "\n");

    // Find a type
    int type = (int)img[17];
    ost.str("");
    ost << type;
    write_log_file("*INFO readPicture : type = " + ost.str() + "\n");

    // CREATE 2-dimensional arrays of different colours
    int k = 18;
    int oldW = picture.width;
    int oldH = picture.high;
    picture.image.resize(oldW*oldH);

    if (type == 24) {
        for (int i = oldH - 1; i >= 0; i--)
            for (int j = oldW - 1; j >= 0; j--) {
                picture[i][j].blue = img[k];
                picture[i][j].green = img[k+1];
                picture[i][j].red = img[k+2];
                picture[i][j].a = img[k+3];
                k+=4;
            }
    }
    else if (type == 40) {
        for (int i = 0; i < oldH; i++)
            for (int j = 0; j < oldW; j++) {
                picture[i][j].blue = img[k];
                picture[i][j].green = img[k+1];
                picture[i][j].red = img[k+2];
                picture[i][j].a = img[k+3];
                k+=4;
            }
    }
    else if (type == 8) {
        for (int i = oldH - 1; i >= 0; i--)
            for (int j = 0; j < oldW; j++) {
                picture[i][j].blue = img[k];
                picture[i][j].green = img[k+1];
                picture[i][j].red = img[k+2];
                picture[i][j].a = img[k+3];
                k+=4;
            }
    }
    else if (type == 56) {
        for (int i = 0; i < oldH; i++)
            for (int j = oldW - 1; j >= 0; j--) {
                picture[i][j].blue = img[k];
                picture[i][j].green = img[k+1];
                picture[i][j].red = img[k+2];
                picture[i][j].a = img[k+3];
                k+=4;
            }
    }
    else
        write_log_file("*ERROR readPicture: wrong 17th byte of head\n");

    return picture;
}
Ejemplo n.º 12
0
int main(int argc,char * argv[]) {

  char *printer;
  char ppd_line[500],tmp[500],*p_tmp,tmp_n[10],tmp_op[500];
  FILE *fp_ppd;
  char *p;
  char *commandline,*ppdfile;
  int i,ii;

#ifdef  _CUSTOM_TAPE_
      TapeItem tapeitem;
#endif
  DEBUGPRINT("main:start\n");

//  fprintf (stderr, "ERROR: brcupsconfpt1 pid=%d\n", getpid());
//  sleep(100);

#ifdef _CUSTOM_TAPE_
	memset(&g_tapelist, 0, sizeof(TapeList));
	g_tapelist.iSelIndex = -1;
#endif

  if(argc < 1){
    return 0;
  }
  printer = argv[1];
  if(argc > 2){
    ppdfile= argv[2];
  }
  else{
    ppdfile="";
  }

//	fprintf(stderr, "ERROR: pid=%d\n", getpid());
//	sleep(1000);

  if(argc > 3){
    if(argv[3][0] >= '0' && argv[3][0] <= '9'){

      log_level = argv[3][0] -'0';
    }
    else{
      log_level = 0;
    }
  }
  else{
    log_level = 0;
  }

  if(argc > 4){
    commandline = argv[4];
  }
  else{
    commandline = "NULL COMMAND LINE";
  }
  fp_ppd = fopen(ppdfile , "r");
  if( fp_ppd == NULL) return 0;


  initialize_command_list();




  //************************************
  //  set default setting
  //************************************
  DEBUGPRINT("main:set default setting\n");
  write_log_file(5,"DEFAULT SETTING\n");  
  for ( i = 0; default_setting[i] != NULL; i ++){
    p = strstr_ex(default_setting[i],"BROTHERPRINTER_XXX");
    if(p){
      p = strchr(p,'-');
      if(p){
	add_command_list_brcommand(p);
      }
    }
  }


  //************************************
  //  set PPD option 
  //************************************


      DEBUGPRINT("main:set PPD option (string)\n");
      write_log_file(5,"PPD SETTING\n");
#ifdef  _CUSTOM_TAPE_
 //     TapeItem tapeitem;
       while(fgets(ppd_line,sizeof(ppd_line),fp_ppd))
	{
		if(NULL == delete_ppd_comment(ppd_line))
			continue;
		if( 1 == GetLabel_name_id(ppd_line, tapeitem.tape_name, tapeitem.tape_id) )
		{
			add_tape(&g_tapelist, tapeitem.tape_name, tapeitem.tape_id);
		}
	}
	rewind(fp_ppd);
#endif

	while(fgets(ppd_line,sizeof(ppd_line),fp_ppd)){
		if(NULL == delete_ppd_comment(ppd_line))continue;
    		if(NULL == chk_ppd_default_setting_line(ppd_line))continue;

    //************************************
    //  set PPD option (string)
    //************************************

		for ( i = 0; ppdcommand_all_list[i]!= NULL; i ++)
		{
      //DEBUGPRINT2(    "main: set PPD option (string)    [%s]  [%s]\n",
      //	      ppd_line,ppdcommand_all_list[i]->label);
			p = strstr_ex(ppd_line,ppdcommand_all_list[i]->label);
			if(p)
			{
	//DEBUGPRINT2(    "main: set PPD option (string)    [%s]  [%s]\n",
	//       ppdcommand_all_list[i]->label,ppd_line);
				for (ii = 0; ppdcommand_all_list[i]->ppdcommandlist[ii].value != NULL; ii++)
				{
	  //DEBUGPRINT3(    "main: set PPD option (string)    [%s]  [%s]  [%s]\n",
	  //       ppdcommand_all_list[i]->label,ppdcommand_all_list[i]->ppdcommandlist[ii].value ,  ppd_line);
					p = strstr_ex(ppd_line,ppdcommand_all_list[i]->ppdcommandlist[ii].value);
					if(p)
					{
						add_command_list_brcommand(ppdcommand_all_list[i]->ppdcommandlist[ii].brcommand);
						break;
					}
				}
#ifdef _CUSTOM_TAPE_
				if( strcmp(ppdcommand_all_list[i]->label, "DefaultPageSize") == 0 )
				{
					for( ii = 0; ii < g_tapelist.count; ii++ )
					{
						p = strstr_ex(ppd_line, g_tapelist.tapelist[ii].tape_id);
						if(p)
						{
							char lp[512];
							sprintf(lp, "-media %s", g_tapelist.tapelist[ii].tape_name);
							add_command_list_brcommand(lp);
							break;


						}
					}
				}
#endif
			}
		}



    //************************************
    //  set PPD option (numerical)
    //************************************
		for ( i = 0; PPDdefaultN[i].option!= NULL; i ++){
      			strcpy(tmp,PPDdefaultN[i].option);
      			p_tmp = tmp;
     			if(tmp[0] == '^')p_tmp ++;
      			p = strstr_ex(ppd_line,p_tmp);
     			if(p){
	//DEBUGPRINT2(    "main: set PPD option (numerical)    [%s]  [%s]\n",
	//       ppd_line,p_tmp);

				sprintf(tmp,"%s  %s",PPDdefaultN[i].value,
	       		p + strlen(PPDdefaultN[i].option));
        //DEBUGPRINT1("set commandline option(n)   **********    : [%s]\n",tmp);

				get_token(PPDdefaultN[i].value ,tmp_op);
				get_token(p + strlen(PPDdefaultN[i].option) ,tmp_n);

				add_command_list(tmp_op,tmp_n);

      			}	
		}
	}



  //************************************
  //  set brother command line option (string)
  //************************************
  DEBUGPRINT("main:set brother command line option (string)\n");
  write_log_file(5,"BROTHER COMMAND LINE SETTING(S)\n");  
  for ( i = 0; commandlinelist[i].value != NULL; i ++){
    //DEBUGPRINT2("main:set command line option (string)    Loop [%s] [%s]\n",
    //       commandline,commandlinelist[i].value );
    p = strstr_ex(commandline,commandlinelist[i].option);
    if(p){
      add_command_list_brcommand(commandlinelist[i].value);
    }
  }



  //************************************
  //  set cups standard command line option (duplex)
  //************************************
  DEBUGPRINT("main:set standard command line option (duplex)\n");
  write_log_file(5,"STANDARD COMMAND LINE SETTING(DUPLEX)\n");  
  for ( i = 0; standard_side_commandlinelist[i].value != NULL; i ++){
    //DEBUGPRINT2("main:set command line option (duplex)    Loop [%s] [%s]\n",
    //       commandline,standard_side_commandlinelist[i].option );
    p = strstr_ex(commandline,standard_side_commandlinelist[i].option);
    if(p){

      add_command_list_brcommand(standard_side_commandlinelist[i].value);

    }


  }


  //************************************
  //  set cups standard command line option (media )
  //************************************
  DEBUGPRINT("main:set standard command line option (media)\n");
  write_log_file(5,"STANDARD COMMAND LINE SETTING(MEDIA)\n");  
  {
    char output[5][30];
    int max;

    max = divide_media_token(commandline,output);
    //DEBUGPRINT2("main:set command line option (media)    Loop count %d   %s \n",
    //         max,commandline);
    for ( ii=0; ii < max; ii++){
//      for ( i = 0; standard_media_commandlinelist[i].value != NULL; i ++){
		for ( i = 0; standard_commandlinelist[i].value != NULL; i ++){
		
	//DEBUGPRINT2("main:set command line option (media)    Loop [%s] [%s]\n",
	//	    output[ii],standard_media_commandlinelist[i].option);
			p = strstr(standard_commandlinelist[i].option, output[ii]);
			if(p){
				add_command_list_brcommand(standard_commandlinelist[i].value);
			}
		}
#ifdef _CUSTOM_TAPE_
         	for ( i = 0; i < g_tapelist.count; i++)
		{
                    // modified by Liu Bin 2006.2.20	
			char lp[512];

			p = strstr(output[ii], g_tapelist.tapelist[i].tape_name);
			
			if(p)		// when the user uses the tool to set media
			{
				sprintf(lp, "-media \"%s\"", g_tapelist.tapelist[i].tape_name);
				add_command_list_brcommand(lp);
			}
			else 	
			{
				p = strstr(output[ii], g_tapelist.tapelist[i].tape_id);
				if(p) // when the printing system uses the tool to set media
				{
					sprintf(lp, "-media \"%s\"", g_tapelist.tapelist[i].tape_name);
					add_command_list_brcommand(lp);
				}
			}
		}
#endif		
    	}
  }
  
  //************************************

  //  set command line option (numerical)
  //************************************
  DEBUGPRINT("main:set command line option (numerical)\n");
  write_log_file(5,"COMMAND LINE SETTING(N)\n");  

  for(i = 0; commandlinelist2[i].option != NULL; i ++){
    p = strstr_ex(commandline,commandlinelist2[i].option);
    //DEBUGPRINT3("set commandline option(n) : [%s] [%s] [%s]\n"
    //	,commandline,commandlinelist2[i].option,p);
    if(p){
      //DEBUGPRINT3("set commandline option(n) 1  **********  : [%s] [%s] [%s]\n"
      //	  ,tmp_n,p + strlen(commandlinelist2[i].option),p);
      get_token(commandlinelist2[i].value   ,tmp_op);
      get_token(p + strlen(commandlinelist2[i].option) ,tmp_n);
      sprintf(tmp,"%s  %s",tmp_op,tmp_n );
      //DEBUGPRINT2("set commandline option(n) 2  **********    : [%s] [%s]\n"
      //	  ,tmp_op,tmp_n);

      add_command_list(tmp_op,tmp_n);

    }
  }

  //************************************
  //  call brprintconf
  //************************************

  exec_brprintconf(brprintconf,printer);

	return 0;
}
int main(int argc , char **argv ) 
{ 
  char *printer ;
  char ppd_line[500] ;
  char tmp[500] ;
  char *p_tmp ;
  char tmp_n[10] ;
  char tmp_op[500] ;
  FILE *fp_ppd ;
  char *p ;
  char *commandline ;
  char *ppdfile ;
  char *printer_model ;
  int i ;
  int ii ;
  char *tmp___0 ;
  char *tmp___1 ;
  size_t tmp___2 ;
  size_t tmp___3 ;
  char *tmp___4 ;
  char output[5][30] ;
  int max ;
  size_t tmp___5 ;

  {
#line 93
  if (argc < 1) {
#line 94
    return (0);
  }
#line 96
  printer = *(argv + 1);
#line 97
  if (argc > 2) {
#line 98
    ppdfile = *(argv + 2);
  } else {
#line 101
    ppdfile = (char *)"";
  }
#line 108
  if (argc > 3) {
#line 109
    if ((int )*(*(argv + 3) + 0) >= 48) {
#line 109
      if ((int )*(*(argv + 3) + 0) <= 57) {
#line 111
        log_level = (int )*(*(argv + 3) + 0) - 48;
      } else {
#line 114
        log_level = 0;
      }
    } else {
#line 114
      log_level = 0;
    }
  } else {
#line 118
    log_level = 0;
  }
#line 121
  if (argc > 4) {
#line 122
    commandline = *(argv + 4);
  } else {
#line 125
    commandline = (char *)"NULL COMMAND LINE";
  }
  {
#line 128
  printer_model = *(argv + 5);
#line 130
  fp_ppd = fopen((char const   */* __restrict  */)ppdfile, (char const   */* __restrict  */)"r");
  }
#line 131
  if ((unsigned long )fp_ppd == (unsigned long )((void *)0)) {
#line 131
    return (0);
  }
  {
#line 134
  initialize_command_list();
#line 163
  write_log_file(5, (char *)"PPD SETTING\n");
  }
  {
#line 165
  while (1) {
    while_continue: /* CIL Label */ ;
    {
#line 165
    tmp___4 = fgets((char */* __restrict  */)(ppd_line), (int )sizeof(ppd_line), (FILE */* __restrict  */)fp_ppd);
    }
#line 165
    if (! tmp___4) {
#line 165
      goto while_break;
    }
    {
#line 166
    tmp___0 = delete_ppd_comment(ppd_line);
    }
#line 166
    if ((unsigned long )((void *)0) == (unsigned long )tmp___0) {
#line 166
      goto while_continue;
    }
    {
#line 167
    tmp___1 = chk_ppd_default_setting_line(ppd_line);
    }
#line 167
    if ((unsigned long )((void *)0) == (unsigned long )tmp___1) {
#line 167
      goto while_continue;
    }
#line 173
    i = 0;
    {
#line 173
    while (1) {
      while_continue___0: /* CIL Label */ ;
#line 173
      if (! ((unsigned long )ppdcommand_all_list[i] != (unsigned long )((void *)0))) {
#line 173
        goto while_break___0;
      }
      {
#line 177
      p = strstr_ex(ppd_line, (ppdcommand_all_list[i])->label);
      }
#line 178
      if (p) {
#line 182
        ii = 0;
        {
#line 182
        while (1) {
          while_continue___1: /* CIL Label */ ;
#line 182
          if (! ((unsigned long )(ppdcommand_all_list[i])->ppdcommandlist[ii].value != (unsigned long )((void *)0))) {
#line 182
            goto while_break___1;
          }
          {
#line 186
          p = strstr_ex(ppd_line, (ppdcommand_all_list[i])->ppdcommandlist[ii].value);
          }
#line 190
          if (p) {
            {
#line 192
            add_command_list_brcommand((ppdcommand_all_list[i])->ppdcommandlist[ii].brcommand);
            }
#line 193
            goto while_break___1;
          }
#line 182
          ii ++;
        }
        while_break___1: /* CIL Label */ ;
        }
      }
#line 173
      i ++;
    }
    while_break___0: /* CIL Label */ ;
    }
#line 204
    i = 0;
    {
#line 204
    while (1) {
      while_continue___2: /* CIL Label */ ;
#line 204
      if (! ((unsigned long )PPDdefaultN[i].option != (unsigned long )((void *)0))) {
#line 204
        goto while_break___2;
      }
      {
#line 205
      strcpy((char */* __restrict  */)(tmp), (char const   */* __restrict  */)PPDdefaultN[i].option);
#line 206
      p_tmp = tmp;
      }
#line 207
      if ((int )tmp[0] == 94) {
#line 207
        p_tmp ++;
      }
      {
#line 208
      p = strstr_ex(ppd_line, p_tmp);
      }
#line 209
      if (p) {
        {
#line 213
        tmp___2 = strlen((char const   *)PPDdefaultN[i].option);
#line 213
        sprintf((char */* __restrict  */)(tmp), (char const   */* __restrict  */)"%s  %s",
                PPDdefaultN[i].value, p + tmp___2);
#line 217
        get_token(PPDdefaultN[i].value, tmp_op);
#line 218
        tmp___3 = strlen((char const   *)PPDdefaultN[i].option);
#line 218
        get_token(p + tmp___3, tmp_n);
#line 220
        add_command_list(tmp_op, tmp_n);
        }
      }
#line 204
      i ++;
    }
    while_break___2: /* CIL Label */ ;
    }
  }
  while_break: /* CIL Label */ ;
  }
  {
#line 233
  write_log_file(5, (char *)"BROTHER COMMAND LINE SETTING(S)\n");
#line 234
  i = 0;
  }
  {
#line 234
  while (1) {
    while_continue___3: /* CIL Label */ ;
#line 234
    if (! ((unsigned long )commandlinelist[i].value != (unsigned long )((void *)0))) {
#line 234
      goto while_break___3;
    }
    {
#line 237
    p = strstr_ex(commandline, commandlinelist[i].option);
    }
#line 238
    if (p) {
      {
#line 239
      add_command_list_brcommand(commandlinelist[i].value);
      }
    }
#line 234
    i ++;
  }
  while_break___3: /* CIL Label */ ;
  }
  {
#line 253
  write_log_file(5, (char *)"STANDARD COMMAND LINE SETTING(DUPLEX)\n");
#line 254
  i = 0;
  }
  {
#line 254
  while (1) {
    while_continue___4: /* CIL Label */ ;
#line 254
    if (! ((unsigned long )standard_side_commandlinelist[i].value != (unsigned long )((void *)0))) {
#line 254
      goto while_break___4;
    }
    {
#line 257
    p = strstr_ex(commandline, standard_side_commandlinelist[i].option);
    }
#line 258
    if (p) {
      {
#line 260
      add_command_list_brcommand(standard_side_commandlinelist[i].value);
      }
    }
#line 254
    i ++;
  }
  while_break___4: /* CIL Label */ ;
  }
  {
#line 271
  write_log_file(5, (char *)"STANDARD COMMAND LINE SETTING(MEDIA)\n");
#line 276
  max = divide_media_token(commandline, (char (*)[30])(output));
#line 279
  ii = 0;
  }
  {
#line 279
  while (1) {
    while_continue___5: /* CIL Label */ ;
#line 279
    if (! (ii < max)) {
#line 279
      goto while_break___5;
    }
#line 281
    i = 0;
    {
#line 281
    while (1) {
      while_continue___6: /* CIL Label */ ;
#line 281
      if (! ((unsigned long )standard_commandlinelist[i].value != (unsigned long )((void *)0))) {
#line 281
        goto while_break___6;
      }
      {
#line 285
      p = strstr((char const   *)standard_commandlinelist[i].option, (char const   *)(output[ii]));
      }
#line 286
      if (p) {
        {
#line 287
        add_command_list_brcommand(standard_commandlinelist[i].value);
        }
      }
#line 281
      i ++;
    }
    while_break___6: /* CIL Label */ ;
    }
#line 279
    ii ++;
  }
  while_break___5: /* CIL Label */ ;
  }
  {
#line 298
  write_log_file(5, (char *)"COMMAND LINE SETTING(N)\n");
#line 300
  i = 0;
  }
  {
#line 300
  while (1) {
    while_continue___7: /* CIL Label */ ;
#line 300
    if (! ((unsigned long )commandlinelist2[i].option != (unsigned long )((void *)0))) {
#line 300
      goto while_break___7;
    }
    {
#line 301
    p = strstr_ex(commandline, commandlinelist2[i].option);
    }
#line 304
    if (p) {
      {
#line 307
      get_token(commandlinelist2[i].value, tmp_op);
#line 308
      tmp___5 = strlen((char const   *)commandlinelist2[i].option);
#line 308
      get_token(p + tmp___5, tmp_n);
#line 309
      sprintf((char */* __restrict  */)(tmp), (char const   */* __restrict  */)"%s  %s",
              tmp_op, tmp_n);
#line 313
      add_command_list(tmp_op, tmp_n);
      }
    }
#line 300
    i ++;
  }
  while_break___7: /* CIL Label */ ;
  }
  {
#line 322
  exec_brprintconf(brprintconf, printer_model);
  }
#line 324
  return (0);
}
}
Ejemplo n.º 14
0
int main(int argc,char * argv[]) {
  char *printer;
  char ppd_line[500],tmp[500],*p_tmp,tmp_n[10],tmp_op[500];
  FILE *fp_ppd;
  char *p;
  char *commandline,*ppdfile;
  int i,ii;

  DEBUGPRINT("main:start\n");
  
  if(argc < 1){
    return 0;
  }
  printer = argv[1];
  if(argc > 2){
    ppdfile= argv[2];
  }
  else{
    ppdfile="";
  }
  if(argc > 3){
    if(argv[3][0] >= '0' && argv[3][0] <= '9'){
      log_level = argv[3][0] -'0';
    }
    else{
      log_level = 0;
    }
  }
  else{
    log_level = 0;
  }
  if(argc > 4){
    commandline = argv[4];
  }
  else{
    commandline = "NULL COMMAND LINE";
  }
  fp_ppd = fopen(ppdfile , "r");
  if( fp_ppd == NULL) return 0;


  initialize_command_list();




  DEBUGPRINT("main:set default setting\n");
  write_log_file(5,"DEFAULT SETTING\n");  
  for ( i = 0; default_setting[i] != NULL; i ++){
    p = strstr_ex(default_setting[i],"BROTHERPRINTER_XXX");
    if(p){
      p = strchr(p,'-');
      if(p){
	add_command_list_brcommand(p);
      }
    }
  }


  DEBUGPRINT("main:set PPD option (string)\n");
  write_log_file(5,"PPD SETTING\n");  
  while(fgets(ppd_line,sizeof(ppd_line),fp_ppd)){
    if(NULL == delete_ppd_comment(ppd_line))continue;
    if(NULL == chk_ppd_default_setting_line(ppd_line))continue;


    for ( i = 0; ppdcommand_all_list[i]!= NULL; i ++){
      p = strstr_ex(ppd_line,ppdcommand_all_list[i]->label);
      if(p){
	for (ii = 0; ppdcommand_all_list[i]->ppdcommandlist[ii].value != NULL; ii++){
	  p = strstr_ex(ppd_line,ppdcommand_all_list[i]->ppdcommandlist[ii].value);
	  if(p){
	    add_command_list_brcommand(ppdcommand_all_list[i]->ppdcommandlist[ii].brcommand);
	    break;
	  }
	}
      }
    }



    for ( i = 0; PPDdefaultN[i].option!= NULL; i ++){
      strcpy(tmp,PPDdefaultN[i].option);
      p_tmp = tmp;
      if(tmp[0] == '^')p_tmp ++;
      p = strstr_ex(ppd_line,p_tmp);
      if(p){

	sprintf(tmp,"%s  %s",PPDdefaultN[i].value,
	       p + strlen(PPDdefaultN[i].option));

	get_token(PPDdefaultN[i].value ,tmp_op);
	get_token(p + strlen(PPDdefaultN[i].option) ,tmp_n);

	add_command_list(tmp_op,tmp_n);

      }
    }

  }



  DEBUGPRINT("main:set brother command line option (string)\n");
  write_log_file(5,"BROTHER COMMAND LINE SETTING(S)\n");  
  for ( i = 0; commandlinelist[i].value != NULL; i ++){
    p = strstr_ex(commandline,commandlinelist[i].option);
    if(p){
      add_command_list_brcommand(commandlinelist[i].value);
    }
  }



  DEBUGPRINT("main:set standard command line option (duplex)\n");
  write_log_file(5,"STANDARD COMMAND LINE SETTING(DUPLEX)\n");  
  for ( i = 0; standard_side_commandlinelist[i].value != NULL; i ++){
    p = strstr_ex(commandline,standard_side_commandlinelist[i].option);
    if(p){
      add_command_list_brcommand(standard_side_commandlinelist[i].value);
    }
  }


  DEBUGPRINT("main:set standard command line option (media)\n");
  write_log_file(5,"STANDARD COMMAND LINE SETTING(MEDIA)\n");  
  {
    char output[5][30];
    int max;

    max = divide_media_token(commandline,output);
    for ( ii=0; ii < max; ii++){
      for ( i = 0; standard_media_commandlinelist[i].value != NULL; i ++){
	p = strstr_ex(output[ii],standard_media_commandlinelist[i].option);
	if(p){
	  add_command_list_brcommand(standard_media_commandlinelist[i].value);
	}
      }
    }
  }
  
  DEBUGPRINT("main:set command line option (numerical)\n");
  write_log_file(5,"COMMAND LINE SETTING(N)\n");  

  for(i = 0; commandlinelist2[i].option != NULL; i ++){
    p = strstr_ex(commandline,commandlinelist2[i].option);
    if(p){
      get_token(commandlinelist2[i].value   ,tmp_op);
      get_token(p + strlen(commandlinelist2[i].option) ,tmp_n);
      sprintf(tmp,"%s  %s",tmp_op,tmp_n );

      add_command_list(tmp_op,tmp_n);

    }
  }


  exec_brprintconf(brprintconf,printer);



}
Ejemplo n.º 15
0
int main(int argc,char * argv[]) {

    TapeItem tapeitem;
    char *printer;
    char ppd_line[500],tmp[500],*p_tmp,tmp_n[10],tmp_op[500];
    FILE *fp_ppd;
    char *p;
    char *commandline,*ppdfile;
    int i,ii;

    memset(&g_tapelist, 0, sizeof(TapeList));
    g_tapelist.iSelIndex = -1;

    if(argc < 1){
        return 0;
    }

    printer = argv[1];
    if(argc > 2){
        ppdfile= argv[2];
    }
    else{
        ppdfile="";
    }

    if(argc > 3){
        if(argv[3][0] >= '0' && argv[3][0] <= '9'){
            log_level = argv[3][0] -'0';
        }
        else{
            log_level = 0;
        }
    }
    else{
        log_level = 0;
    }

    if(argc > 4){
        commandline = argv[4];
    }
    else{
        commandline = "NULL COMMAND LINE";
    }
    fp_ppd = fopen(ppdfile , "r");
    if( fp_ppd == NULL) return 0;


    initialize_command_list();




    //************************************
    //  set default setting
    //************************************
    DEBUGPRINT("main:set default setting\n");
    write_log_file(5,"DEFAULT SETTING\n");  
    for ( i = 0; default_setting[i] != NULL; i ++){
        p = strstr_ex(default_setting[i],"BROTHERPRINTER_XXX");
        if(p){
            p = strchr(p,'-');
            if(p){
                add_command_list_brcommand(p);
            }
        }
    }


    //************************************
    //  set PPD option 
    //************************************
    DEBUGPRINT("main:set PPD option (string)\n");
    write_log_file(5,"PPD SETTING\n");
    while(fgets(ppd_line,sizeof(ppd_line),fp_ppd))
    {
        if(NULL == delete_ppd_comment(ppd_line))
            continue;
        if( 1 == GetLabel_name_id(ppd_line, tapeitem.tape_name, tapeitem.tape_id) )
        {
            add_tape(&g_tapelist, tapeitem.tape_name, tapeitem.tape_id);
        }
    }
    rewind(fp_ppd);

    while(fgets(ppd_line,sizeof(ppd_line),fp_ppd)){
        if(NULL == delete_ppd_comment(ppd_line))continue;
        if(NULL == chk_ppd_default_setting_line(ppd_line))continue;

        //************************************
        //  set PPD option (string)
        //************************************

        for ( i = 0; ppdcommand_all_list[i]!= NULL; i ++)
        {
            p = strstr_ex(ppd_line,ppdcommand_all_list[i]->label);
            if(p)
            {
                for (ii = 0; ppdcommand_all_list[i]->ppdcommandlist[ii].value != NULL; ii++)
                {
                    p = strstr_ex(ppd_line,ppdcommand_all_list[i]->ppdcommandlist[ii].value);
                    if(p)
                    {
                        add_command_list_brcommand(ppdcommand_all_list[i]->ppdcommandlist[ii].brcommand);
                        break;
                    }
                }

                if( strcmp(ppdcommand_all_list[i]->label, "DefaultPageSize") == 0 )
                {
                    for( ii = 0; ii < g_tapelist.count; ii++ )
                    {
                        p = strstr_ex(ppd_line, g_tapelist.tapelist[ii].tape_id);
                        if(p)
                        {
                            char lp[512];
                            sprintf(lp, "-media %s", g_tapelist.tapelist[ii].tape_name);
                            add_command_list_brcommand(lp);
                            break;
                        }
                    }
                }
            }
        }

        //************************************
        //  set PPD option (numerical)
        //************************************
        for ( i = 0; PPDdefaultN[i].option!= NULL; i ++){
            strcpy(tmp,PPDdefaultN[i].option);
            p_tmp = tmp;

            if(tmp[0] == '^')p_tmp ++;
            p = strstr_ex(ppd_line,p_tmp);

            if(p){
                sprintf(tmp,"%s  %s",PPDdefaultN[i].value,
                        p + strlen(PPDdefaultN[i].option));

                get_token(PPDdefaultN[i].value ,tmp_op);
                get_token(p + strlen(PPDdefaultN[i].option) ,tmp_n);

                add_command_list(tmp_op,tmp_n);
            }
        }
    }

    //************************************
    //  set brother command line option (string)
    //************************************
    DEBUGPRINT("main:set brother command line option (string)\n");
    write_log_file(5,"BROTHER COMMAND LINE SETTING(S)\n");
    for ( i = 0; commandlinelist[i].value != NULL; i ++){
        p = strstr_ex(commandline,commandlinelist[i].option);
        if(p){
            add_command_list_brcommand(commandlinelist[i].value);
        }
    }

    //************************************
    //  set cups standard command line option (duplex)
    //************************************
    DEBUGPRINT("main:set standard command line option (duplex)\n");
    write_log_file(5,"STANDARD COMMAND LINE SETTING(DUPLEX)\n");
    for ( i = 0; standard_side_commandlinelist[i].value != NULL; i ++){
        p = strstr_ex(commandline,standard_side_commandlinelist[i].option);
        if(p){
            add_command_list_brcommand(standard_side_commandlinelist[i].value);
        }
    }
   
    //************************************
    //  set cups standard command line option (media )
    //************************************
    DEBUGPRINT("main:set standard command line option (media)\n");
    write_log_file(5,"STANDARD COMMAND LINE SETTING(MEDIA)\n");
    {
        char output[5][30];
        int max;

        max = divide_media_token(commandline,output);

        for ( ii=0; ii < max; ii++){
            for ( i = 0; standard_commandlinelist[i].value != NULL; i ++){
                p = strstr(standard_commandlinelist[i].option, output[ii]);
                if(p){
                    add_command_list_brcommand(standard_commandlinelist[i].value);
                }
            }

            for ( i = 0; i < g_tapelist.count; i++)
            {
                char lp[512];
                p = strstr(output[ii], g_tapelist.tapelist[i].tape_name);
            
                if(p)
                {
                    sprintf(lp, "-media \"%s\"", g_tapelist.tapelist[i].tape_name);
                    add_command_list_brcommand(lp);
                }
                else
                {
                    p = strstr(output[ii], g_tapelist.tapelist[i].tape_id);
                    if(p)
                    {
                        sprintf(lp, "-media \"%s\"", g_tapelist.tapelist[i].tape_name);
                        add_command_list_brcommand(lp);
                    }
                }
            }
        }
    }

    //************************************
    //  set command line option (numerical)
    //************************************
    DEBUGPRINT("main:set command line option (numerical)\n");
    write_log_file(5,"COMMAND LINE SETTING(N)\n");

    for(i = 0; commandlinelist2[i].option != NULL; i ++){
        p = strstr_ex(commandline,commandlinelist2[i].option);
    
        if(p){
            get_token(commandlinelist2[i].value   ,tmp_op);
            get_token(p + strlen(commandlinelist2[i].option) ,tmp_n);
            sprintf(tmp,"%s  %s",tmp_op,tmp_n );
            add_command_list(tmp_op,tmp_n);
        }
    }

    //************************************
    //  call brprintconf
    //************************************
    exec_brprintconf(brprintconf,printer,argv[5]);
    
    return 0;
}
Ejemplo n.º 16
0
int main(int argc,char * argv[]) {

  char *printer;
  char ppd_line[500],tmp[500],*p_tmp,tmp_n[10],tmp_op[500];
  FILE *fp_ppd;
  char *p;
  char *commandline,*ppdfile, *printer_model;
  int i,ii;
  DEBUGPRINT("main:start\n");

//  fprintf (stderr, "ERROR: brcupsconfpt1 pid=%d\n", getpid());
//  sleep(100);

  if(argc < 1){
    return 0;
  }
  printer = argv[1];
  if(argc > 2){
    ppdfile= argv[2];
  }
  else{
    ppdfile="";
  }
	

//	fprintf(stderr, "ERROR: pid=%d\n", getpid());
//	sleep(1000);

  if(argc > 3){
    if(argv[3][0] >= '0' && argv[3][0] <= '9'){

      log_level = argv[3][0] -'0';
    }
    else{
      log_level = 0;
    }
  }
  else{
    log_level = 0;
  }

  if(argc > 4){
    commandline = argv[4];
  }
  else{
    commandline = "NULL COMMAND LINE";
  }

	printer_model = argv[5];

  fp_ppd = fopen(ppdfile , "r");
  if( fp_ppd == NULL) return 0;


  initialize_command_list();




  //************************************
  //  set default setting
  //************************************

#if	0
  DEBUGPRINT("main:set default setting\n");
  write_log_file(5,"DEFAULT SETTING\n");  
  for ( i = 0; default_setting[i] != NULL; i ++){
    p = strstr_ex(default_setting[i],"BROTHERPRINTER_XXX");
    if(p){
      p = strchr(p,'-');
      if(p){
	add_command_list_brcommand(p);
      }
    }
  }
#endif	// 0

  //************************************
  //  set PPD option 
  //************************************


  DEBUGPRINT("main:set PPD option (string)\n");
  write_log_file(5,"PPD SETTING\n");

  while(fgets(ppd_line,sizeof(ppd_line),fp_ppd)){
    if(NULL == delete_ppd_comment(ppd_line))continue;
    if(NULL == chk_ppd_default_setting_line(ppd_line))continue;

    //************************************
    //  set PPD option (string)
    //************************************

	for ( i = 0; ppdcommand_all_list[i]!= NULL; i ++)
	{
      //DEBUGPRINT2(    "main: set PPD option (string)    [%s]  [%s]\n",
      //	      ppd_line,ppdcommand_all_list[i]->label);
		p = strstr_ex(ppd_line,ppdcommand_all_list[i]->label);
		if(p)
		{
	//DEBUGPRINT2(    "main: set PPD option (string)    [%s]  [%s]\n",
	//       ppdcommand_all_list[i]->label,ppd_line);
	
		#if 1		// Added by SteadyBJ, Guo Jianxin , 20080121
			char * tmp;
			tmp = p + strlen( ppdcommand_all_list[i]->label);
        #endif
			for (ii = 0; ppdcommand_all_list[i]->ppdcommandlist[ii].value != NULL; ii++)
			{
	  //DEBUGPRINT3(    "main: set PPD option (string)    [%s]  [%s]  [%s]\n",
	  //       ppdcommand_all_list[i]->label,ppdcommand_all_list[i]->ppdcommandlist[ii].value ,  ppd_line);
	  		#if 0        // Modified by SteadyBJ, Guo Jianxin , 20080121
				p = strstr_ex(ppd_line,ppdcommand_all_list[i]->ppdcommandlist[ii].value);
			#else
				p = strstr_ex(tmp,ppdcommand_all_list[i]->ppdcommandlist[ii].value);
			#endif



				if(p)
				{
					add_command_list_brcommand(ppdcommand_all_list[i]->ppdcommandlist[ii].brcommand);
					break;
				}
			}
		}
	}



    //************************************
    //  set PPD option (numerical)
    //************************************
    for ( i = 0; PPDdefaultN[i].option!= NULL; i ++){
      strcpy(tmp,PPDdefaultN[i].option);
      p_tmp = tmp;
      if(tmp[0] == '^')p_tmp ++;
      p = strstr_ex(ppd_line,p_tmp);
      if(p){
	//DEBUGPRINT2(    "main: set PPD option (numerical)    [%s]  [%s]\n",
	//       ppd_line,p_tmp);

	sprintf(tmp,"%s  %s",PPDdefaultN[i].value,
	       p + strlen(PPDdefaultN[i].option));
        //DEBUGPRINT1("set commandline option(n)   **********    : [%s]\n",tmp);

	get_token(PPDdefaultN[i].value ,tmp_op);
	get_token(p + strlen(PPDdefaultN[i].option) ,tmp_n);

	add_command_list(tmp_op,tmp_n);

      }
    }

  }



  //************************************
  //  set brother command line option (string)
  //************************************
  DEBUGPRINT("main:set brother command line option (string)\n");
  write_log_file(5,"BROTHER COMMAND LINE SETTING(S)\n");  
  for ( i = 0; commandlinelist[i].value != NULL; i ++){
    //DEBUGPRINT2("main:set command line option (string)    Loop [%s] [%s]\n",
    //       commandline,commandlinelist[i].value );
    p = strstr_ex(commandline,commandlinelist[i].option);
    if(p){
      add_command_list_brcommand(commandlinelist[i].value);
    }
  }







  //************************************
  //  set cups standard command line option (duplex)
  //************************************
  DEBUGPRINT("main:set standard command line option (duplex)\n");
  write_log_file(5,"STANDARD COMMAND LINE SETTING(DUPLEX)\n");  
  for ( i = 0; standard_side_commandlinelist[i].value != NULL; i ++){
    //DEBUGPRINT2("main:set command line option (duplex)    Loop [%s] [%s]\n",
    //       commandline,standard_side_commandlinelist[i].option );
    p = strstr_ex(commandline,standard_side_commandlinelist[i].option);
    if(p){

      add_command_list_brcommand(standard_side_commandlinelist[i].value);
    }


  }


  //************************************
  //  set cups standard command line option (media )
  //************************************
  DEBUGPRINT("main:set standard command line option (media)\n");
  write_log_file(5,"STANDARD COMMAND LINE SETTING(MEDIA)\n");  
  {
    char output[5][30];
    int max;

    max = divide_media_token(commandline,output);
    //DEBUGPRINT2("main:set command line option (media)    Loop count %d   %s \n",
    //         max,commandline);
    for ( ii=0; ii < max; ii++){
//      for ( i = 0; standard_media_commandlinelist[i].value != NULL; i ++){
		for ( i = 0; standard_commandlinelist[i].value != NULL; i ++){
		
	//DEBUGPRINT2("main:set command line option (media)    Loop [%s] [%s]\n",
	//	    output[ii],standard_media_commandlinelist[i].option);
			p = strstr(standard_commandlinelist[i].option, output[ii]);
			if(p){
				add_command_list_brcommand(standard_commandlinelist[i].value);
			}
		}
    	}
  }
  
  //************************************

  //  set command line option (numerical)
  //************************************
  DEBUGPRINT("main:set command line option (numerical)\n");
  write_log_file(5,"COMMAND LINE SETTING(N)\n");  

  for(i = 0; commandlinelist2[i].option != NULL; i ++){
    p = strstr_ex(commandline,commandlinelist2[i].option);
    //DEBUGPRINT3("set commandline option(n) : [%s] [%s] [%s]\n"
    //	,commandline,commandlinelist2[i].option,p);
    if(p){
      //DEBUGPRINT3("set commandline option(n) 1  **********  : [%s] [%s] [%s]\n"
      //	  ,tmp_n,p + strlen(commandlinelist2[i].option),p);
      get_token(commandlinelist2[i].value   ,tmp_op);
      get_token(p + strlen(commandlinelist2[i].option) ,tmp_n);
      sprintf(tmp,"%s  %s",tmp_op,tmp_n );
      //DEBUGPRINT2("set commandline option(n) 2  **********    : [%s] [%s]\n"
      //	  ,tmp_op,tmp_n);

      add_command_list(tmp_op,tmp_n);

    }
  }

  //************************************
  //  call brprintconf
  //************************************

	exec_brprintconf(brprintconf,printer_model);

	return 0;
}
int add_command_list(char *option , char *value ) 
{ 
  char *p ;
  int i ;

  {
#line 383
  if (! option) {
#line 386
    return (0);
  } else
#line 383
  if (! value) {
#line 386
    return (0);
  } else
#line 383
  if (! *(option + 0)) {
#line 386
    return (0);
  } else
#line 383
  if (! *(value + 0)) {
#line 386
    return (0);
  }
#line 389
  i = 0;
  {
#line 389
  while (1) {
    while_continue: /* CIL Label */ ;
#line 389
    if (! ((int )command_array[i].option[0] != 0)) {
#line 389
      goto while_break;
    }
    {
#line 392
    p = strstr_ex(command_array[i].option, option);
    }
#line 393
    if (p) {
      {
#line 395
      write_log_file(3, (char *)"        C  %s  %s\n", option, value);
#line 396
      strcpy((char */* __restrict  */)(command_array[i].value), (char const   */* __restrict  */)value);
      }
#line 397
      goto while_break;
    }
#line 389
    i ++;
  }
  while_break: /* CIL Label */ ;
  }
#line 401
  if ((int )command_array[i].option[0] == 0) {
    {
#line 403
    strcpy((char */* __restrict  */)(command_array[i].option), (char const   */* __restrict  */)option);
#line 404
    strcpy((char */* __restrict  */)(command_array[i].value), (char const   */* __restrict  */)value);
#line 405
    write_log_file(3, (char *)"        A  %s  %s\n", option, value);
    }
  }
#line 407
  return (1);
}
}