sort cores; print stack as command
diff --git a/src/cmd/core.c b/src/cmd/core.c index 94a38bb..a0021a0 100644 --- a/src/cmd/core.c +++ b/src/cmd/core.c
@@ -43,6 +43,20 @@ return dir; } +int +timecmp(const void *va, const void *vb) +{ + Dir *a, *b; + + a = (Dir*)va; + b = (Dir*)vb; + if(a->mtime < b->mtime) + return 1; + if(a->mtime > b->mtime) + return -1; + return 0; +} + void coreall(char *name) { @@ -62,6 +76,7 @@ return; } n = dirreadall(fd, &d); + qsort(d, n, sizeof(d[0]), timecmp); for(i=0; i<n; i++){ p = smprint("%s/%s", name, d[i].name); if(p == nil) @@ -97,12 +112,6 @@ fprint(2, "%s: not a core file\n", name); return; } - print("acid %s # %s %s\n", name, t, hdr->cmd); - - /* - * To do: look at command line to determine binary. - * Print stack. - */ + print("stack %s\n\t# %s\n\t# %s\n", name, t, hdr->cmdline); uncrackhdr(hdr); } -