Skip to content

Commit

Permalink
Fix segfault, add test script
Browse files Browse the repository at this point in the history
  • Loading branch information
kovzol committed Jan 6, 2025
1 parent 4dbb703 commit 2c19652
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions statements/pbrst-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ int main(int ac, char **av)
}
if (graphviz) {
char *g_start = strstr(parseinfo, "diagram: graphviz: start\n");
if (g_start == NULL) exit(0); // empty output
g_start = strstr(g_start, "\n");
g_start++;
char *g_end = strstr(parseinfo, "diagram: graphviz: end");
Expand Down
21 changes: 21 additions & 0 deletions statements/tests/runme-graphviz
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# This test assumes that pbrst-cli has already been compiled.
# It creates an HTML file with embedded SVG images.

HTML=graphviz.html
echo "<html><body><center>" > $HTML

FILES=`ls -1 *.brst`
F_NO=`ls -1 *.brst | wc -l`
n=0
for i in $FILES; do
n=$((n+1))
echo -n -e "\r$i ($n/$F_NO)\033[0K"
../pbrst-cli -g $i > $i.dot
dot -Tsvg $i.dot > $i.svg
echo "<img src=$i.svg><br>" >> $HTML
done
echo

echo "</center></body></html>" >> $HTML

0 comments on commit 2c19652

Please sign in to comment.