mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
pw-dot: using output - will write the output to stdout
This enables single-liners for viewing the graph in applicable shells.
This commit is contained in:
parent
4a0b7fa9b8
commit
21a36f3c51
2 changed files with 15 additions and 10 deletions
|
|
@ -55,7 +55,7 @@ This file is part of PipeWire.
|
||||||
|
|
||||||
<option>
|
<option>
|
||||||
<p><opt>-o FILE | --output</opt><arg>=FILE</arg></p>
|
<p><opt>-o FILE | --output</opt><arg>=FILE</arg></p>
|
||||||
<optdesc><p>Output file name (Default pw.dot).</p></optdesc>
|
<optdesc><p>Output file name (Default pw.dot). Use - for stdout.</p></optdesc>
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
</options>
|
</options>
|
||||||
|
|
|
||||||
|
|
@ -493,16 +493,21 @@ static int draw_graph(struct data *d, const char *path)
|
||||||
/* draw the footer */
|
/* draw the footer */
|
||||||
dot_str_add(&d->dot_str, "}\n");
|
dot_str_add(&d->dot_str, "}\n");
|
||||||
|
|
||||||
/* open the file */
|
if (strcmp(path, "-") == 0) {
|
||||||
fp = fopen(path, "w");
|
/* wire the dot graph into to stdout */
|
||||||
if (fp == NULL) {
|
fputs(d->dot_str, stdout);
|
||||||
printf("open error: could not open %s for writing\n", path);
|
} else {
|
||||||
return -1;
|
/* open the file */
|
||||||
}
|
fp = fopen(path, "w");
|
||||||
|
if (fp == NULL) {
|
||||||
|
printf("open error: could not open %s for writing\n", path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* wire the dot graph into the file */
|
/* wire the dot graph into the file */
|
||||||
fputs(d->dot_str, fp);
|
fputs(d->dot_str, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue