home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
IDLE.ZIP
/
IDLE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-20
|
2KB
|
79 lines
/****************************************************************************
* *
* Idle - A shell environment to place a process into idle priority *
* *
* useage:- idle <process> <args> *
* *
* CopyRight 1990 by J.G. Rozema *
* *
****************************************************************************/
/*
$Header: I:/BBSTOOLS/IDLE/VCS/IDLE.C_V 1.2 25 Sep 1990 22:12:34 jgr $
$Revision: 1.2 $
$Log: I:/BBSTOOLS/IDLE/VCS/IDLE.C_V $
*
* Rev 1.2 25 Sep 1990 22:12:34 jgr
* Added short description and copyright notice.
*
*
* Rev 1.1 11 Jul 1990 03:31:46 jgr
* Modified the command line processing so that it can now pass parameters to
* the child process. Ability to set the delta is also available by the command
* line now.
*
* Rev 1.0 21 Jun 1990 01:00:26 jgr
* Initial revision.
*/
#define INCL_BASE
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include <string.h>
#include <os2.h>
char command[1024];
void main(int argc, char **argv)
{
SHORT Delta;
int x;
command[0]=0;
if( argc < 2 ){
printf("Idle - Run sessions at idle Priority\n");
printf("Copyright (c) 1990 by J.G. Rozema\n");
printf("Usage: Idle [-delta] <program>\n");
exit(0);
}
Delta=0;
if (argv[1][0]=='-') {
Delta=atoi(&argv[1][1]);
DosSetPrty(PRTYS_PROCESSTREE,PRTYC_IDLETIME,Delta,NULL);
for (x=2; x<argc; x++) {
strcat(command,argv[x]);
strcat(command," ");
}
}
else {
DosSetPrty(PRTYS_PROCESSTREE,PRTYC_IDLETIME,-31,NULL);
for (x=1; x<argc; x++) {
strcat(command,argv[x]);
strcat(command," ");
}
}
system (command);
}