From 3d0a0b310187950c21731a0a37fe5341f860d9e7 Mon Sep 17 00:00:00 2001 From: Adrien Schildknecht Date: Tue, 2 Jul 2013 02:50:00 +0200 Subject: add some logging --- xcwd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xcwd.c b/xcwd.c index 82eb7a7..e4fda06 100644 --- a/xcwd.c +++ b/xcwd.c @@ -22,7 +22,7 @@ # include #endif -#define DEBUG 1 +#define DEBUG 0 #define XA_STRING (XInternAtom(dpy, "STRING", 0)) #define XA_CARDINAL (XInternAtom(dpy, "CARDINAL", 0)) @@ -211,8 +211,8 @@ static processes_t getProcesses(void) p->ps[i].ppid = kp[i].ki_ppid; strncpy(p->ps[i].name, kp[i].ki_tdname, 32); strncpy(p->ps[i].cwd, kif->kf_path, MAXPATHLEN); - //fprintf(stderr, "%s (%ld - %ld) - %s\n",p->ps[i].name, p->ps[i].pid, - // p->ps[i].ppid, p->ps[i].cwd); + LOG("\t%-20s\tpid=%6ld\tppid=%6ld\n", p->ps[j].name, p->ps[j].pid, + p->ps[j].ppid); } } @@ -238,8 +238,10 @@ static int readPath(struct proc_s *proc) fprintf(stdout, "%s\n", buf); #endif #ifdef BSD - if(!strlen(proc->cwd)) + if(!strlen(proc->cwd)) { + LOG("%ld cwd is empty\n", proc->pid); return 0; + } fprintf(stdout, "%s\n", proc->cwd); #endif return 1; -- cgit v1.2.3