Ejemplo n.º 1
0
INT_PTR BitmapIO_BMP::ConfigCtrlDlgProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam) {
    switch (message) {
      case WM_INITDIALOG:
         if (!mParams.saved)
            ReadCfg();
         switch (mParams.outDepth) {
            case BMM_PALETTED:
               CheckDlgButton( hWnd, IDC_BMP_PALETTE, TRUE );
               break;
            case BMM_NO_TYPE:
            case BMM_TRUE_24:
               CheckDlgButton( hWnd, IDC_BMP_RGB24, TRUE );
               break;
         }
         break;
      case WM_COMMAND:
         switch (LOWORD(wParam)) {
            case IDOK: 
               WriteCfg();
               EndDialog(hWnd,1);
               break;
            case IDCANCEL:
               EndDialog(hWnd,0);
               break;
            case IDC_BMP_PALETTE:
               mParams.outDepth  = BMM_PALETTED;
               break;
            case IDC_BMP_RGB24:
               mParams.outDepth  = BMM_TRUE_24;
               break;
         }
         return TRUE;
   }
   return FALSE;
}
Ejemplo n.º 2
0
int _main( ElfLoaderApp ela )
{
    UINT32 status = RESULT_OK;

    memcpy( ( void * )&FontServ, ( void * )&ela, sizeof( ElfLoaderApp ) );

    status = APP_Register( &FontServ . evcode,
                           1,
                           state_handling_table,
                           HW_STATE_MAX,
                           (void*)FontServStart );

    //LoaderShowApp( &FontServ );

    ReadCfg( );
    FontTool_SetFont( );

    DRM_SetResource( iTunes_EvCdResID, iTunes_Resource, sizeof( UINT32 ) * sizeof( iTunes_Resource ) );
    
    DRM_SetResource( iTunes_NameResID, ( void * )u_app_name, APP_NAME_LEN * 2 );
    
    DRM_SetResource( iTunes_IconResID, ( void * )FONT_TOOL_ICON, 2215 );
    DRM_SetResource( iTunes_IcLsResID, ( void * )FONT_TOOL_ICON_LST, 1106 );
    DRM_SetResource( iTunes_IcAnResID, ( void * )FONT_TOOL_ANI , 2529 );


    return 1;
}
Ejemplo n.º 3
0
UINT32 MainStateEnter( EVENT_STACK_T *ev_st,  void *app,  ENTER_STATE_TYPE_T type )
{
	if(type!=ENTER_STATE_ENTER) return RESULT_OK;

    ReadCfg( );

    return Update( ev_st, app, 0 );
}
Ejemplo n.º 4
0
BMMRES BitmapIO_BMP::OpenOutput(BitmapInfo *fbi, Bitmap *map) {
   if (openMode != BMM_NOT_OPEN)
      return (ProcessImageIOError(&bi,BMMRES_INTERNALERROR));
   if (!map)
      return (ProcessImageIOError(&bi,BMMRES_INTERNALERROR));
   //-- Save Image Info Data
   if (!mParams.saved)
      ReadCfg();
   bi.CopyImageInfo(fbi);    
   bi.SetUpdateWindow(fbi->GetUpdateWindow());
   this->map   = map;
   openMode = BMM_OPEN_W;
   return (BMMRES_SUCCESS);
}
Ejemplo n.º 5
0
int SearchCfg(const char *FileName,
              char *SectionName,
              char *VarName,
              void *DataPtr,
              enum CfgTypes VarType
             )
{
      struct CfgStruct MyVars[2];

      MyVars[0].Name    = VarName;
      MyVars[0].DataPtr = DataPtr;
      MyVars[0].VarType = VarType;

      MyVars[1].Name = MyVars[1].DataPtr = NULL;

      return ReadCfg(FileName, SectionName, MyVars);
}
Ejemplo n.º 6
0
Archivo: png.cpp Proyecto: 2asoft/xray
BMMRES
BitmapIO_PNG::OpenOutput(BitmapInfo *fbi, Bitmap *map) 
{
    if(openMode != BMM_NOT_OPEN)
		return (ProcessImageIOError(fbi, BMMRES_INTERNALERROR));

    if(!map)
		return (ProcessImageIOError(fbi,BMMRES_INTERNALERROR));

	//-- Check for Default Configuration -----------------
	if (!cfg.saved)
		ReadCfg();

    //-- Save Image Info Data
    bi.CopyImageInfo(fbi);    
	bi.SetUpdateWindow(fbi->GetUpdateWindow());

    this->map   = map;
    openMode    = BMM_OPEN_W;

    return BMMRES_SUCCESS;
}
Ejemplo n.º 7
0
/*
 * Read disk volumes.
 */
void
ReadDiskVolumes(
		char *diskvols_name)	/* NULL if default conf file name */
{
	extern char *program_name;

	int	errors;
	int ret;
	DiskVolumeInfo_t *dv;

	fname = SAM_CONFIG_PATH"/diskvols.conf";
	if (diskvols_name != NULL) {
		fname = diskvols_name;
	}

	DiskVolCount = 0;
	DiskVolClientCount = 0;

	if (diskVols.data != NULL) {
		SamFree(diskVols.data);
		diskVols.count = 0;
		diskVols.alloc = 0;
		diskVols.data = NULL;
	}

	errors = ReadCfg(fname, dirProcTable, dirname, token, ConfigFileMsg);
	if (errors != 0 && !(errors == -1) && diskvols_name == NULL) {
		/* Absence of the default diskvols conf file not an error. */
		if (errors > 0) {
			errno = 0;
		}
		/* Read diskvols %s failed */
		/* Problem with file system command file. */
		FatalError(17230, fname);
	}
}
Ejemplo n.º 8
0
int FTP::ProcessShortcutLine(char *Line)
{
	char *m,*m1;
	char  str[20]; //Hold single dec number - need not use of String

	if(!Line)
		return FALSE;

	ReadCfg();

	if(StrCmp(Line,"FTP:",4) == 0)
	{
		/*
		FTP
		  Host
		  1
		  AskLogin    + 3
		  AsciiMode   + 3
		  PassiveMode + 3
		  UseFirewall + 3
		  HostTable
		  1
		  User
		  1
		  Password
		  1
		  ExtCmdView + 3
		  IOBuffSize (atoi)
		  1
		  FFDup + '0'
		  DecodeCmdLine + '0'
		  1
		*/
		Line += 4;
		m = strchr(Line,'\x1');

		if(!m || strlen(m) < 4) return FALSE;

		m++;
		Host.Init();
		StrCpy(Host.Host,     Line, Min((int)(m-Line), (int)ARRAYSIZE(Host.Host)));
		strcpy(Host.HostName, Host.Host);
		Host.AskLogin    = *(m++) - '\x3';

		if(*m == 0) return FALSE;

		Host.AsciiMode   = *(m++) - '\x3';

		if(*m == 0) return FALSE;

		Host.PassiveMode = *(m++) - '\x3';

		if(*m == 0) return FALSE;

		Host.UseFirewall = *(m++) - '\x3';

		if(*m == 0) return FALSE;

		m1 = m;
		m = strchr(m1,'\x1');

		if(!m) return FALSE;

		StrCpy(str, m1, (int)(m-m1+1));
		Host.ServerType = (WORD)atoi(str);
		m1 = m+1;
		m = strchr(m1,'\x1');

		if(!m) return FALSE;

		StrCpy(Host.HostTable, m1, (int)(m-m1+1));
		m1 = m+1;
		m  = strchr(m1,'\x1');

		if(!m) return FALSE;

		StrCpy(Host.User,m1,(int)(m-m1+1));
		m1 = m+1;
		m  = strchr(m1,'\x1');

		if(!m) return FALSE;

		StrCpy(Host.Password,m1,(int)(m-m1+1));

		do
		{
			Host.ExtCmdView    = Opt.ExtCmdView;
			Host.IOBuffSize    = Opt.IOBuffSize;
			Host.FFDup         = Opt.FFDup;
			Host.DecodeCmdLine = TRUE;
			//IOBuffSize
			m1 = m+1;

			if(!m1[0])
				break;

			Host.ExtCmdView = *(m1++) - '\x3';
			m = strchr(m1,'\x1');

			if(!m)
				return FALSE;

			StrCpy(str,m1,(int)(m-m1+1));
			Host.IOBuffSize = Max(FTR_MINBUFFSIZE,(DWORD)atoi(str));
			//FFDup
			m1 = m+1;

			if(!m1[0])
				break;

			m = strchr(m1,'\x1');

			if(!m)
				break;

			if(*m1 != '0' && *m1 != '1')
				break;

			Host.FFDup = *m1 - '0';
			//DecodeCmdLine
			m1++;

			if(!m1[0] ||
			        (*m1 != '0' && *m1 != '1'))
				break;

			Host.DecodeCmdLine = *m1 - '0';
		}
		while(0);

		return FullConnect();
	}
	else if(StrCmp(Line,"HOST:",5) == 0)
	{
		Line += 5;
		strcpy(HostsPath,Line);
		return 1;
	}

	return 0;
}
Ejemplo n.º 9
0
int OptLogInit()
{
    int ret;
    int cfglen;
    int i;
    int j;
    setlinebuf(stdout);
    EngModePrintOn=0;
    ST_OptLogCfgData sval;
    ST_OptLogCfgInfo *cfginf = NULL;
    bzero(&sval,sizeof(sval));
    
    Debug_print("%s\n",CONFIG_FILE);

	if (gendata.initlized)
	{
		Debug_print("The operation log has been initlized ,can not init again\n");
		return 0;
	}
    ret = ReadCfg(CONFIG_FILE,&cfginf,&cfglen);
    if (ret < 0)
    {
        printf("read configuration file failed, use default set\n");
        sval.curlevel = 3;
        sval.enflags |= PrtAllComp;
        if (!getcwd(sval.rcdpath,PATHLEN)) 
        {
            perror("get current directory failed");
            return -1;
        }
    }
    for (i=0;i<cfglen;i++)
    {
        Debug_print("key:%s\t val:%s\n",cfginf[i].key,cfginf[i].val); 
        if (!strcmp(cfginf[i].key,"prtlevel")&&cfginf[i].val[0]!='0')
        {
	    	sval.enflags |= EnLevel; 
            continue;
        }
        if (!strcmp(cfginf[i].key,"prtfilename")&&cfginf[i].val[0]!='0')
        {
	    	sval.enflags|= EnFName; 
            continue;
        }
        if (!strcmp(cfginf[i].key,"prtfuncname")&&cfginf[i].val[0]!='0')
        {
	    	sval.enflags|= EnFcName; 
            continue;
        }
        if (!strcmp(cfginf[i].key,"prtlinenum")&&cfginf[i].val[0]!='0')
        {
	    	sval.enflags|= EnLine; 
            continue;
        }
        if (!strcmp(cfginf[i].key,"prttime")&&cfginf[i].val[0]!='0')
        {
	    	sval.enflags|= EnTime; 
            continue;
        }
        if (!strcmp(cfginf[i].key,"prtinfile")&&cfginf[i].val[0]!='0')
        {
	    	sval.enflags|= EnFRcd; 
            continue;
        }
        if (!strcmp(cfginf[i].key,"recordpath")&&cfginf[i].val[0]!=0)
        {
            int slen;
            slen = strlen(cfginf[i].val);
            if (cfginf[i].val[slen-1] == '/')
            {
                cfginf[i].val[slen-1] = 0;
            }
	    	strncpy(sval.rcdpath,cfginf[i].val,PATHLEN);
            continue;
        }
        if (!strcmp(cfginf[i].key,"level")&&cfginf[i].val[0]!=0)
        {
            sval.curlevel = atoi(cfginf[i].val);
            continue;
        }
        if (!strcmp(cfginf[i].key,"componentlist")&&cfginf[i].val[0]!=0)
        {
            if (GetComps(cfginf[i].val,&sval) < 0)
            {
                Debug_print("get components list failed\n");
            }
            else
            {
                for (j=0;j<sval.compnum;j++)
                Debug_print("component name:%s\n",sval.comp[j]);
            }
            continue;
        }
         
    }
    if (cfginf)
    {
        free(cfginf);
    }
    Debug_print("enflag:%x\tpath:%s\n",sval.enflags,sval.rcdpath);
    //create shared memory and init semaphore
    gendata.shmid = shmget(IPC_KEY,sizeof(ST_OptLogCfgData),0666);
    if (gendata.shmid == -1)
    {
        Debug_print("shared memory does not exist,need create\n");
        gendata.shmid = shmget(IPC_KEY,sizeof(ST_OptLogCfgData),0666|IPC_CREAT);
        if (gendata.shmid < 0)
        {
            perror("create shared memory failed");
            return -1;
        }
        Debug_print("create shared memory success\n");
    } 
    else
    {
        sval.enflags |= SMemExist;
    }
    Debug_print("get shared memory success\n");
    gendata.cfg = (ST_OptLogCfgData *)shmat(gendata.shmid,NULL,0);
    if (gendata.cfg == (void *)-1)
    {
        perror("get shared memory address failed");
        shmctl(gendata.shmid,IPC_RMID,NULL);
        gendata.cfg = NULL;
        return -1;
    }
    //bzero(gendata.cfg,4096*65);

    Debug_print("get shared memory address success\n");

    gendata.semid = semget(SEM_KEY,0,0666);
    if (gendata.semid < 0)
    {
        Debug_print("semaphore is not created, need create\n");
        gendata.semid = semget(SEM_KEY,1,0666|IPC_CREAT);
        if (gendata.semid < 0)
        {
            perror("create semaphore failed");
            return -1;
        }
        Debug_print("create semaphore success\n");
        if (init_sem(gendata.semid,1) < 0)
        {
            printf("init semaphore failed\n");
            del_sem(gendata.semid);
            return -1;
        }
        Debug_print("init semaphore success\n");
    }
    Debug_print("get semaphore success\n");
    if(pthread_mutex_init(&gendata.filemutex,NULL) != 0)
    {
        perror("create file mutex failed");
        return -1;
    }
    if(pthread_mutex_init(&gendata.pathmutex,NULL) != 0)
    {
        perror("create path mutex failed");
        return -1;
    }
    #ifdef READ_CFG
    if (1) 
    #else
    if (!(sval.enflags&SMemExist))
    #endif
    {
        Debug_print("shared memory does not exists need to set value to memory\n");
        Debug_print("curlevel:%d\trcdpath:%s\tcomnum:%d\tenflags:%x\n",sval.curlevel,\
        sval.rcdpath,sval.compnum,sval.enflags);
        OptLogSet(&sval);
    }
	gendata.initlized = 1;
    return 0;
}
Ejemplo n.º 10
0
/*
 * Read disk volumes.
 */
int
parse_diskvols_conf(
char *file,		/* path at which to read the diskvols.conf */
diskvols_cfg_t **cfg)	/* malloced return value */
{

	int	errors;
	char	*first_err;

	Trace(TR_OPRMSG, "parsing diskvols file %s", Str(file));

	if (ISNULL(file, cfg)) {
		Trace(TR_OPRMSG, "parsing diskvols file failed: %s",
		    samerrmsg);
		return (-1);
	}

	if (init_static_variables() != 0) {
		Trace(TR_OPRMSG, "parsing diskvols file failed: %s",
		    samerrmsg);
		return (-1);
	}

	if (strcmp(DISKVOL_CFG, file) != 0) {
		file_required = B_TRUE;
	}


	dv_cfg = mallocer(sizeof (diskvols_cfg_t));
	if (dv_cfg == NULL) {
		Trace(TR_OPRMSG, "parsing diskvols file failed: %s",
		    samerrmsg);
		return (-1);
	}

	memset(dv_cfg, 0, sizeof (diskvols_cfg_t));
	dv_cfg->disk_vol_list = lst_create();
	if (dv_cfg->disk_vol_list == NULL) {
		free_diskvols_cfg(dv_cfg);
		*cfg = NULL;
		Trace(TR_OPRMSG, "parsing diskvols file failed: %s",
		    samerrmsg);
		return (-1);
	}

	dv_cfg->client_list = lst_create();
	if (dv_cfg->client_list == NULL) {
		free_diskvols_cfg(dv_cfg);
		*cfg = NULL;
		Trace(TR_OPRMSG, "parsing diskvols file failed: %s",
		    samerrmsg);
		return (-1);

	}
	dv_cfg->read_time = time(0);
	*cfg = dv_cfg;

	errors = ReadCfg(file, dirProcTable, dir_name, token, read_cfg_msg);
	if (errors != 0 && !(errors == -1 && !file_required)) {

		/* The absence of a command file is not an error */
		if (errors == -1) {

			if (no_cmd_file) {
				/*
				 * The absence of a command file
				 * is not an error
				 */
				Trace(TR_OPRMSG,
				    "parsing diskvols, no file present");

				return (0);
			}

			free_diskvols_cfg(*cfg);
			*cfg = NULL;

			/* other access errors are an error */
			samerrno = SE_CFG_OPEN_FAILED;

			/* open failed for %s: %s */
			snprintf(samerrmsg, MAX_MSG_LEN,
			    GetCustMsg(SE_CFG_OPEN_FAILED), file,
			    open_error);

			Trace(TR_OPRMSG, "parsing diskvols file failed: %s",
			    samerrmsg);
			return (-1);

		} else if (errors == 1 && empty_cmd_file) {
				Trace(TR_OPRMSG,
				    "parsing diskvols, empty file");
				return (0);
		}


		free_diskvols_cfg(*cfg);
		*cfg = NULL;

		if (error_list != NULL && error_list->head != NULL) {
			first_err =
			    ((parsing_error_t *)error_list->head->data)->msg;
		} else {
			first_err = "NULL";
		}

		/* %s contains %d error(s) first:%s */
		samerrno = SE_CONFIG_ERROR;
		snprintf(samerrmsg, MAX_MSG_LEN,
		    GetCustMsg(SE_CONFIG_ERROR), file, errors, first_err);


		Trace(TR_OPRMSG, "parsing diskvols file failed: %s",
		    samerrmsg);
		return (-1);
	}

	Trace(TR_OPRMSG, "parsed diskvols file");
	return (0);
}
Ejemplo n.º 11
0
SDComCfg * CConfigDlg::GetConfig()
{
    ReadCfg();

    return &m_sDComCfgReal;
}
Ejemplo n.º 12
0
void
print_list (FILE * in, int flag, int non_priv)
{
  DbCtlLimitAttr cpu_def, read_def, write_def;
  char val = 'M';
  if (flag == 1) val = 'K';
  else if ( flag == 2 ) val = ' ';
  non_priv = 1;
  if (access(CONFIG_PATH, R_OK) == 0){
	  non_priv = 0;
  }
  ReadCfg ((non_priv?DUPLICATE_CONFIG_PATH:CONFIG_PATH), "default");
  if (flag)
	 printf (" user\tcpu(%%)\tread(%cB/s)\twrite(%cB/s)\n", val, val);
  else
     printf (" user             cpu(%%)                     read(%cB/s)                        write(%cB/s)\n", val, val);
  GetDefault (GetCfg (), flag);

  DbCtlFoundTag *found_tag_ = g_ptr_array_index (GetCfg (), 0);

  strncpy (cpu_def.l_current,
	   GetLimitAttr (found_tag_->limit_attr, "cpu", "current"),
	   sizeof (cpu_def.l_current) - 1);
  strncpy (cpu_def.l_short,
	   GetLimitAttr (found_tag_->limit_attr, "cpu", "short"),
	   sizeof (cpu_def.l_short) - 1);
  strncpy (cpu_def.l_mid, GetLimitAttr (found_tag_->limit_attr, "cpu", "mid"),
	   sizeof (cpu_def.l_mid) - 1);
  strncpy (cpu_def.l_long,
	   GetLimitAttr (found_tag_->limit_attr, "cpu", "long"),
	   sizeof (cpu_def.l_long) - 1);

  strncpy (read_def.l_current,
	   GetLimitAttr (found_tag_->limit_attr, "read", "current"),
	   sizeof (read_def.l_current) - 1);
  strncpy (read_def.l_short,
	   GetLimitAttr (found_tag_->limit_attr, "read", "short"),
	   sizeof (read_def.l_short) - 1);
  strncpy (read_def.l_mid,
	   GetLimitAttr (found_tag_->limit_attr, "read", "mid"),
	   sizeof (read_def.l_mid) - 1);
  strncpy (read_def.l_long,
	   GetLimitAttr (found_tag_->limit_attr, "read", "long"),
	   sizeof (read_def.l_long) - 1);

  strncpy (write_def.l_current,
	   GetLimitAttr (found_tag_->limit_attr, "write", "current"),
	   sizeof (write_def.l_current) - 1);
  strncpy (write_def.l_short,
	   GetLimitAttr (found_tag_->limit_attr, "write", "short"),
	   sizeof (write_def.l_short) - 1);
  strncpy (write_def.l_mid,
	   GetLimitAttr (found_tag_->limit_attr, "write", "mid"),
	   sizeof (write_def.l_mid) - 1);
  strncpy (write_def.l_long,
	   GetLimitAttr (found_tag_->limit_attr, "write", "long"),
	   sizeof (write_def.l_long) - 1);
  FreeCfg ();

  DbCtlLimitAttr limit_attr_def;
  ReadCfg ((non_priv?DUPLICATE_CONFIG_PATH:CONFIG_PATH), "user");
  GPtrArray *tags = addMemoryUser (in, GetCfg ());
  GetDefaultForUsers (tags, &cpu_def, &read_def, &write_def, flag);
  FreeCfg ();
}
Ejemplo n.º 13
0
main()
{
      char        Line[INI_LINESIZE];
      int         Int;
      long        Long;
      double      Double;
      Boolean_T   Bool;
      struct      CfgStruct this_var;
      FILE*       tst;
      long        prices[2];


      /*
      **  First work with a test file
      */
      tst = cant("test.ini", "w");
      fputs("[Section 1]\n", tst);
      fputs("[Section 2]\n", tst);
      fputs("[Section 3]\n", tst);
      fputs("[Section 4]\n", tst);
      fputs("[Section 5]\n", tst);
      fputs("[Section 6]\n", tst);
      fclose(tst);
      puts("Updating the test configuration file");

      puts("Updating section 1");
      UpdateCfg("test.ini", "Section 1", "string #1", "section 1 test");
      puts("Updating section 2");
      UpdateCfg("test.ini", "Section 2", "short #2", "2");
      puts("Updating section 3");
      UpdateCfg("test.ini", "Section 3", "long #3", "3");
      UpdateCfg("test.ini", "Section 4", "double #4", "4.4");
      UpdateCfg("test.ini", "Section 5", "boolean #5", "Y");
      UpdateCfg("test.ini", "Section 6", "boolean #6", "N");
      UpdateCfg("test.ini", "", "global string", "\"Hello, world!\" ;Comment");

      puts("I've finished the updates, now to try to get the data back");

      this_var.Name    = "global string";
      this_var.DataPtr = Line;
      this_var.VarType = Cfg_String;
      printf("ReadCfg(0) returned %d; Line=\n",
             ReadCfg("test.ini", "", &this_var));
      puts(Line);

      this_var.Name    = "string #1";
      this_var.DataPtr = Line;
      this_var.VarType = Cfg_String;
      printf("ReadCfg(1) returned %d; Line=\n",
             ReadCfg("test.ini", "Section 1", &this_var));
      puts(Line);

      this_var.Name    = "short #2";
      this_var.DataPtr = &Int;
      this_var.VarType = Cfg_Short;
      printf("ReadCfg(2) returned %d; Value= ",
             ReadCfg("test.ini", "Section 2", &this_var));
      printf("%d\n", Int);

      this_var.Name    = "long #3";
      this_var.DataPtr = &Long;
      this_var.VarType = Cfg_Long;
      printf("ReadCfg(3) returned %d; Value = ",
             ReadCfg("test.ini", "Section 3", &this_var));
      printf("%ld\n", Long);

      this_var.Name    = "double #4";
      this_var.DataPtr = &Double;
      this_var.VarType = Cfg_Double;
      printf("ReadCfg(4) returned %d; Value = ",
             ReadCfg("test.ini", "Section 4", &this_var));
      printf("%f\n", Double);

      this_var.Name    = "boolean #5";
      this_var.DataPtr = &Bool;
      this_var.VarType = Cfg_Boolean;
      printf("ReadCfg(5) returned %d; Value = ",
             ReadCfg("test.ini", "Section 5", &this_var));
      printf("%c\n", Bool ? 'T' : 'F');

      this_var.Name    = "boolean #6";
      this_var.DataPtr = &Bool;
      this_var.VarType = Cfg_Boolean;
      printf("ReadCfg(6) returned %d; Value = ",
             ReadCfg("test.ini", "Section 6", &this_var));
      printf("%c\n", Bool ? 'T' : 'F');

      /*
      **  Look for non-existant sections and/or variables
      */

      Line[0] = NUL;
      this_var.Name    = "string #99";
      this_var.DataPtr = Line;
      this_var.VarType = Cfg_String;
      printf("ReadCfg(99) returned %d; Line=\n",
             ReadCfg("test.ini", "Section 99", &this_var));
      puts(Line);

      Line[0] = NUL;
      this_var.Name    = "string #99";
      this_var.DataPtr = Line;
      this_var.VarType = Cfg_String;
      printf("ReadCfg(0/99) returned %d; Line=\n",
             ReadCfg("test.ini", "", &this_var));
      puts(Line);

      Line[0] = NUL;
      this_var.Name    = "string #99";
      this_var.DataPtr = Line;
      this_var.VarType = Cfg_String;
      printf("ReadCfg(1/99) returned %d; Line=\n",
             ReadCfg("test.ini", "Section 1", &this_var));
      puts(Line);

      Line[0] = NUL;
      this_var.Name    = "string #1";
      this_var.DataPtr = Line;
      this_var.VarType = Cfg_String;
      printf("ReadCfg(1/100) returned %d; Line=\n",
             ReadCfg("test.ini", "Section 100", &this_var));
      puts(Line);

      /*
      **  Next, add a section and new variables
      */

      UpdateCfg("test.ini", "", "new global variable", "abc");
      UpdateCfg("test.ini", "Section -1", "new variable", "xyz");
     
      /*
      **  Next work with a sample real PRICES.INI file
      */

      this_var.Name    = "Price of #1";
      this_var.DataPtr = &prices[0];
      this_var.VarType = Cfg_Long;
      printf("ReadCfg(1) returned %d; Value = ",
             ReadCfg(PINI_fname, "", &this_var));
      printf("%ld\n", prices[0]);

      this_var.Name    = "Price of #2";
      this_var.DataPtr = &prices[1];
      this_var.VarType = Cfg_Long;
      printf("ReadCfg(2) returned %d; Value = ",
             ReadCfg(PINI_fname, "", &this_var));
      printf("%ld\n", prices[1]);

      UpdateCfg("prices.ini", "", "Price of #2", "999");

      this_var.Name    = "Price of #2";
      this_var.DataPtr = &prices[1];
      this_var.VarType = Cfg_Long;
      printf("ReadCfg(2) returned %d; Value = ",
             ReadCfg(PINI_fname, "", &this_var));
      printf("%ld\n", prices[1]);

      UpdateCfg(PINI_fname, "", "Price of #2", "389");

      this_var.Name    = "Price of #2";
      this_var.DataPtr = &prices[1];
      this_var.VarType = Cfg_Long;
      printf("ReadCfg(2) returned %d; Value = ",
             ReadCfg(PINI_fname, "", &this_var));
      printf("%ld\n", prices[1]);

      /*
      **  Finally, try an invalid file name
      */

      this_var.Name    = "global string";
      this_var.DataPtr = Line;
      this_var.VarType = Cfg_String;
      printf("ReadCfg(0) returned %d; Line=\n",
             ReadCfg("none.ini", "", &this_var));
      puts(Line);

      return EXIT_SUCCESS;
}