home *** CD-ROM | disk | FTP | other *** search
- /* WarpOS tool program which modifies the NICE value of a task
- specified by task ID (or the current task if no ID is given)
- 3.3.1998 by Sam Jordan */
-
- #include <stdio.h>
- #include <exec/libraries.h>
- #include <dos/rdargs.h>
- #include <utility/tagitem.h>
- #include <powerpc/tasksppc.h>
- #include <clib/dos_protos.h>
- #include <clib/powerpc_protos.h>
-
- extern struct Library* PowerPCBase;
- struct TaskPPC* taskptr;
- char template[] = "ID/K/N,NICE/N";
- int* array[2];
- struct RDArgs* result;
- int initialnice = 0;
-
- void main(void)
- {
- if (PowerPCBase->lib_Version < 14)
- {
- printf("Error: powerpc.library V14+ required");
- return;
- }
- if ((result = ReadArgs(template,(LONG *)&array,NULL)) == NULL)
- {
- printf("Utility to set NICE values. Please specify a task ID and a NICE value.\n");
- return;
- }
- if (array[0])
- taskptr = FindTaskByID(*(array[0]));
- else
- taskptr = FindTaskPPC(NULL);
- if (array[1])
- initialnice = *(array[1]);
- if (taskptr != NULL)
- {
- SetNiceValue(taskptr,initialnice);
- printf("NICE value of task '%s' (ID=%ld) is set to %ld\n",taskptr->tp_Task.tc_Node.ln_Name,taskptr->tp_Id,initialnice);
- }
- else
- printf("Task not found\n");
- FreeArgs(result);
- }
-