From 298f5fdc242b760e70cd3494e3a4f1f50b20664d Mon Sep 17 00:00:00 2001 From: Devin Teske Date: Wed, 23 Jul 2014 21:08:04 +0000 Subject: [PATCH] Fix a bug where include file `networking/services.subr' was not being properly clustered. Change `fixedsize' to `fixedsize = true' to satisfy newer versions of dot(1) generating error "Warning: : syntax error in line 27 near ','". Remove bounding cluster surrounding various include-groupings, allowing groups of include files to float freely to the greatest consumer (reducing the density of rendered diagrams). While here, change the bgcolor of include clusters from white to X11 color `thistle' (a light purple). Also, add the word "Subroutines" after include cluster labels. Do not terminate the digraph definition with a semi-colon [;] after the ending brace to satisfy newer versions of dot(1) generating error "Warning: : syntax error in line 940 near ';'". MFC after: 3 days X-MFC-to: stable/10, stable/9 --- usr.sbin/bsdconfig/dot/dot | 65 +++++++++----------- usr.sbin/bsdconfig/dot/include/messages.subr | 1 + 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/usr.sbin/bsdconfig/dot/dot b/usr.sbin/bsdconfig/dot/dot index 9093d633dd28..f71c0e81487f 100755 --- a/usr.sbin/bsdconfig/dot/dot +++ b/usr.sbin/bsdconfig/dot/dot @@ -249,6 +249,7 @@ if [ "$SHOW_INCLUDES" ]; then $menu_program_list \ $submenu_program_list \ $cmd_program_list \ + $BSDCFG_SHARE/script.subr \ ; do [ -e "$file" ] && echo $file done | sort -u @@ -298,12 +299,6 @@ if [ "$SHOW_INCLUDES" ]; then done fi -# -# Add script.subr to includes if it exists -# -[ -f $BSDCFG_SHARE/script.subr ] && - include_file_list="$include_file_list script.subr" - # # Start the directional-graph (digraph) output # @@ -352,7 +347,7 @@ printf '\tnode [\n' printf '\t\tfontname = "Times-Roman",\n' printf '\t\tfontsize = 12,\n' printf '\t\twidth = 2.5, // arbitrary minimum width for all nodes\n' -printf '\t\tfixedsize, // turn minimum width into exact width\n' +printf '\t\tfixedsize = true, // turn minimum width into exact width\n' printf '\t];\n' # @@ -546,34 +541,36 @@ printf '\t\tbgcolor = "%s";\n' "$bgcolor_bsdconfig" printf '\t\tlabel = "bsdconfig(8)";\n' printf '\t\ttooltip = "bsdconfig(8)";\n' print_node "bsdconfig" +end_nodelist if [ "$SHOW_INCLUDES" ]; then - printf '\t\tsubgraph "cluster_includes" {\n' - printf '\t\t\tbgcolor = "%s";\n' "$bgcolor_includes" - printf '\t\t\tlabel = "%s";\n' "$msg_includes" - for include_file in $include_file_list; do echo $include_file - done | awk -v bgcolor="$bgcolor_bsdconfig" ' - BEGIN { created = 0 } - function end_subgraph() { printf "\t\t\t};\n" } - ( $0 !~ "/" ) { - if ( ! created ) - { - printf "\t\t\tsubgraph \"%s\" {\n", - "cluster_bsdconfig_includes" - printf "\t\t\t\tbgcolor = \"%s\";\n", bgcolor - printf "\t\t\t\tlabel = \"bsdconfig\";\n" - created++ + done | awk \ + -v bgcolor="$bgcolor_bsdconfig" \ + -v msg_subroutines="$msg_subroutines" \ + ' + BEGIN { created = 0 } + function end_subgraph() { printf "\t};\n" } + ( $0 !~ "/" ) { + if ( ! created ) + { + printf "\tsubgraph \"%s\" {\n", + "cluster_bsdconfig_includes" + printf "\t\tbgcolor = \"%s\";\n", bgcolor + printf "\t\tlabel = \"bsdconfig %s\";\n", + msg_subroutines + created++ + } + printf "\t\t\"%s\";\n", $1 } - printf "\t\t\t\t\"%s\";\n", $1 - } - END { created && end_subgraph() }' + END { created && end_subgraph() } + ' # END-QUOTE for include_file in $include_file_list; do echo $include_file - done | awk ' + done | awk -v msg_subroutines="$msg_subroutines" ' BEGIN { created = 0 } - function end_subgraph() { printf "\t\t\t};\n" } + function end_subgraph() { printf "\t};\n" } ( $0 ~ "/" ) { include_dir_tmp = $1 sub("/[^/]*$", "", include_dir_tmp) @@ -588,20 +585,18 @@ if [ "$SHOW_INCLUDES" ]; then if ( ! created ) { include_dir = include_dir_tmp - printf "\t\t\tsubgraph \"cluster_%s_includes\" {\n", + printf "\tsubgraph \"cluster_%s_includes\" {\n", include_dir - printf "\t\t\t\tbgcolor = \"white\";\n" - printf "\t\t\t\tlabel = \"%s\";\n", include_dir + printf "\t\tbgcolor = \"thistle\";\n" + printf "\t\tlabel = \"%s %s\";\n", include_dir, + msg_subroutines created++ } - printf "\t\t\t\t\"%s\";\n", $1 + printf "\t\t\"%s\";\n", $1 } END { created && end_subgraph() }' - - printf '\t\t};\n' fi -end_nodelist for INDEX in */INDEX; do menu_title= menu_help= @@ -676,7 +671,7 @@ for INDEX in */INDEX; do end_nodelist done -printf '\n};\n' +printf '\n}\n' ################################################################################ # END diff --git a/usr.sbin/bsdconfig/dot/include/messages.subr b/usr.sbin/bsdconfig/dot/include/messages.subr index 527f30885ab0..f1095f7e4995 100644 --- a/usr.sbin/bsdconfig/dot/include/messages.subr +++ b/usr.sbin/bsdconfig/dot/include/messages.subr @@ -28,3 +28,4 @@ msg_graph_label_with_command="bsdconfig(8)\\\ndot(1) output generated by \`\`%s' msg_graph_label_with_command_and_date="bsdconfig(8)\\\ndot(1) output generated by \`\`%s'' on\\\n%s" msg_includes="Includes" msg_shortcuts="Shortcuts" +msg_subroutines="Subroutines"