home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / games / orbit.lzh / orbit / src / STP.c
Encoding:
C/C++ Source or Header  |  1991-09-21  |  688 b   |  30 lines

  1. /* SetTaskPriority by name */
  2. #include <libraries/arpbase.h>
  3. #include <exec/types.h>
  4. #include <exec/tasks.h>
  5.  
  6. struct Task *task,*FindTask();
  7. long pri;
  8.  
  9. main(argc,argv)
  10.  int argc;
  11.  char **argv;
  12.  
  13. { if (argc != 3)
  14.     { puts ("SetTaskPriority");
  15.       puts ("Usage: %s priority taskname"); exit(1); }
  16.   pri=atol(argv[1]);
  17.   if ((pri < -100) || (pri > 100)) exit(1);
  18.   task=FindTask(argv[2]); if (task==0) exit(1);
  19.   SetTaskPri (task,pri);
  20.   printf ("task %x set to priority %d \n",task,pri);
  21.   while (task != 0)
  22.     { task=FindName(task,argv[2]);
  23.       if (task != 0)
  24.         { SetTaskPri (task,pri);
  25.           printf ("task %x set to priority %d \n",task,pri);
  26.         }
  27.     }
  28.   exit(0);
  29. }
  30.