From: Mathieu Desnoyers Date: Wed, 23 Nov 2011 07:06:33 +0000 (+0100) Subject: allow printing domains when no procname are present, handle various / patterns X-Git-Tag: v0.8~9 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=e38f07e9fae685c92366a0492f234c5576abdd63 allow printing domains when no procname are present, handle various / patterns Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 33287524..20f2dae0 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -1146,10 +1146,11 @@ init_domain_name(struct ctf_trace *td) char *start, *end; start = td->path + strlen(td->collection_path); - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ end = strchr(start, '/'); if (!end) - return; + end = start + strlen(start); memcpy(td->domain, start, end - start); td->domain[end - start] = '\0'; } @@ -1164,11 +1165,13 @@ init_proc_name(struct ctf_trace *td) return; memcpy(buf, td->path, PATH_MAX); start = buf + strlen(td->collection_path); - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ start = strchr(start, '/'); /* get begin of domain content */ if (!start) return; - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ /* find last -, skips time */ end = strrchr(start, '-'); if (!end) @@ -1199,11 +1202,13 @@ init_vpid(struct ctf_trace *td) return; memcpy(buf, td->path, PATH_MAX); start = buf + strlen(td->collection_path); - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ start = strchr(start, '/'); /* get begin of domain content */ if (!start) return; - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ /* find last -, skips time */ end = strrchr(start, '-'); if (!end)