home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * GTD -GetTaskData/FreeTaskData tester
- *
- * Matthew Dillon, 30 Sep 1988
- *
- * gtd - show task memlist entries
- * gtd <name> - remove an entry
- * gtd <name> <bytes> - add/retrieve an entry, display it, then
- * store sequential values into the buffer.
- */
-
- #include <stdio.h>
- #include <local/typedefs.h>
- #include <local/xmisc.h>
-
- extern int Enable_Abort;
- extern char *GetTaskData();
-
- main(ac,av)
- char *av[];
- {
- char *ptr;
- long bytes;
- short i;
- TASK *task = FindTask(NULL);
-
- Enable_Abort = 0;
-
- if (openlibs(DRES_LIB) == 0)
- exit(1);
- if (ac == 1) {
- MEMLIST *ml;
- for (ml = GetHead(&task->tc_MemEntry); ml; ml = GetSucc(ml)) {
- printf("memlist %08lx %ld %s\n", ml, ml->ml_NumEntries,
- ((ml->ml_Node.ln_Name) ? ml->ml_Node.ln_Name : "NULL")
- );
- }
- goto fail;
- }
- bytes = atoi(av[2]);
- printf("%s,%ld :", av[1], bytes);
- fflush(stdout);
- if (ac == 2) {
- printf("result %ld\n", FreeTaskData(av[1]));
- } else {
- ptr = GetTaskData(av[1], bytes);
- if (!ptr) {
- puts("failed");
- goto fail;
- }
- printf("%08lx ", ptr);
- fflush(stdout);
- for (i = 0; i < bytes; ++i) {
- printf("%02x ", ptr[i]);
- ptr[i] = i;
- }
- }
- fail:
- closelibs(-1);
- }
-
-