home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
PRF100.LZH
/
PRFSRC.LZH
/
PRF.C
next >
Wrap
C/C++ Source or Header
|
1991-01-29
|
3KB
|
90 lines
#define INCL_WINSHELLDATA
#define INCL_WINPROGRAMLIST
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "prf.h"
static void showuse(void)
{
static char str01[] =
"█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█\n"
"█ Prf Peter Fitzsimmons 91/01/29 █\n"
"█ Version 1.00 █\n"
"█ Usage: PRF <cmd> <file> █\n"
"█ Purpose: Read/Write OS/2 Profile (os2.ini). █\n"
"█ Commands: R - Read Program/Group info into <file>. █\n"
"█ W - Write Program/Group info from <file>. █\n"
"█ C - Change profile to <file>. █\n"
"█ Comments: Only program and group information is saved. █\n"
"█ Any application specific data stored in █\n"
"█ OS2.INI is not saved. █\n"
"█ █\n"
"█ The R and W commands use a special file █\n"
"█ format, which is only recognized by this █\n"
"█ program. █\n"
"█ █\n"
"█ The C command requires an OS/2 .ini file. █\n"
"█ For example, \"prf c c:\\os2\\os2.ini\" would █\n"
"█ reset Presentation Manager with the default █\n"
"█ initialization file. █\n"
"█ If the file specified by the C command does █\n"
"█ not exist, one is created. █\n"
"█ █\n"
"█ NOTE: For OS/2 1.2x █\n"
"█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█\n";
fputs(str01, stdout);
}
void far *zalloc(size_t bytes)
{
void far *ret;
SEL sel;
if(DosAllocSeg(bytes, &sel, 0)){
printf("Memory request of %u bytes failed\n", bytes);
exit(3);
}
ret = MAKEP(sel, 0);
memset(ret, 0, bytes);
return(ret);
}
void Zree(void far *p)
{
DosFreeSeg(SELECTOROF(p));
}
void change(char *user)
{
PRFPROFILE pf;
char *s = "c:/os2/os2sys.ini";
pf.cchUserName = strlen(user);
pf.pszUserName = user;
pf.cchSysName = strlen(s);
pf.pszSysName = s;
exit(TRUE == PrfReset(0, &pf));
}
int cdecl main(int argc, char **argv)
{
if(argc != 3){
showuse();
return(1);
}
if(!stricmp(argv[1], "r"))
READmain(argv[2]);
else if(!stricmp(argv[1], "w"))
WRITEmain(argv[2]);
else if(!stricmp(argv[1], "c"))
change(argv[2]);
else{
showuse();
return(1);
}
}