home *** CD-ROM | disk | FTP | other *** search
- /* Quick and dirty hack to display all task names */
-
- #include "exec/types.h"
- #include "exec/execbase.h"
- #include "exec/tasks.h"
-
- #define MAXTASKS 200
- char names[MAXTASKS][50];
- extern struct ExecBase *SysBase;
-
- int cmp(char *a,char *b) { return(stricmp(a,b)); }
-
- main()
- {
- LONG nr=0,i;
- struct Task *task;
-
- Forbid();
-
- for (task =(struct Task *)(((struct ExecBase *)SysBase)->TaskWait.lh_Head);
- task!=(struct Task *)(((struct ExecBase *)SysBase)->TaskWait.lh_TailPred->ln_Succ);
- task =(struct Task *)task->tc_Node.ln_Succ)
- {
- if (task->tc_Node.ln_Name) stccpy(names[nr++],task->tc_Node.ln_Name,50);
- if (nr==MAXTASKS) break;
- }
-
- Permit();
-
- qsort(names,nr,50,cmp);
-
- for (i=0;i<nr;i++)
- printf("%s\n",names[i]);
- }
-