home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 22 gnu
/
22-gnu.zip
/
PMCSR102.ZIP
/
OPTIONS.C
< prev
next >
Wrap
Text File
|
1990-12-17
|
3KB
|
91 lines
//
// Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
// Copyright (c) 1988, 1989, 1990 John Stanback
//
// Project: OS/2 PM Port of GNU CHESS 3.1 (PmChess)
//
// Version: 1.02 1990-12-17
//
// Module: Options save and restore logic.
//
// Author: Benny N. Ormson
//
// System: OS2 1.2 using Microsoft C 6.0
//
// Remarks: This code was added in version 1.02 after the PM port.
//
// License:
//
// CHESS is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY. No author or distributor accepts responsibility to anyone for
// the consequences of using it or for whether it serves any particular
// purpose or works at all, unless he says so in writing. Refer to the
// CHESS General Public License for full details.
//
// Everyone is granted permission to copy, modify and redistribute CHESS,
// but only under the conditions described in the CHESS General Public
// License. A copy of this license is supposed to have been given to you
// along with CHESS so you can know your rights and responsibilities. It
// should be in a file named COPYING. Among other things, the copyright
// notice and this notice must be preserved on all copies.
//
#define INCL_WINPROGRAMLIST
#define INCL_WINSHELLDATA
#include <os2.h>
#include "pmchess.h"
#include "GnuChess.h"
extern short coords;
extern struct flags flag;
static char inifile[] = "pmchess.ini";
static char appname[] = "PmChess";
static char keytone[] = "Tone";
static char keycord[] = "Cord";
/**********************************************************************/
/* GetOptions() - Read option settings from ini file. */
/**********************************************************************/
void GetOptions(void)
{
HINI hini;
long ll = sizeof(int);
flag.beep = 1; /* default tone on */
coords = 1; /* default coords on */
hini = PrfOpenProfile(hab,inifile);
if(hini == NULL)
return;
ll = sizeof(flag.beep);
PrfQueryProfileData(hini,appname,keytone,&flag.beep,&ll);
ll = sizeof(coords);
PrfQueryProfileData(hini,appname,keycord,&coords,&ll);
PrfCloseProfile(hini);
return;
}
/**********************************************************************/
/* SaveOptions() - Write option settings to ini file. */
/**********************************************************************/
void SaveOptions(void)
{
HINI hini;
long ll = sizeof(int);
hini = PrfOpenProfile(hab,inifile);
if(hini == NULL)
return;
PrfWriteProfileData(hini,appname,keytone,&flag.beep,sizeof(flag.beep));
PrfWriteProfileData(hini,appname,keycord,&coords,sizeof(coords));
PrfCloseProfile(hini);
return;
}