summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/general
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.examples/general')
-rw-r--r--testsuite/systemtap.examples/general/ansi_colors.meta13
-rwxr-xr-xtestsuite/systemtap.examples/general/ansi_colors.stp43
-rw-r--r--testsuite/systemtap.examples/general/ansi_colors2.meta13
-rwxr-xr-xtestsuite/systemtap.examples/general/ansi_colors2.stp31
4 files changed, 83 insertions, 17 deletions
diff --git a/testsuite/systemtap.examples/general/ansi_colors.meta b/testsuite/systemtap.examples/general/ansi_colors.meta
new file mode 100644
index 00000000..2818c235
--- /dev/null
+++ b/testsuite/systemtap.examples/general/ansi_colors.meta
@@ -0,0 +1,13 @@
+title: Color Table for ansi_set_color2() and ansi_set_color3()
+name: ansi_colors.stp
+version: 1.0
+author: Eugene Teo
+keywords: format
+subsystem: none
+status: production
+exit: fixed
+output: text
+scope: system-wide
+description: The script prints a table showing the available color combinations for the ansi_set_color2() and ans_set_color3() functions in the ansi.stp tapset.
+test_check: stap -p4 ansi_colors.stp
+test_installcheck: stap ansi_colors.stp
diff --git a/testsuite/systemtap.examples/general/ansi_colors.stp b/testsuite/systemtap.examples/general/ansi_colors.stp
index ae954e69..01e58b9c 100755
--- a/testsuite/systemtap.examples/general/ansi_colors.stp
+++ b/testsuite/systemtap.examples/general/ansi_colors.stp
@@ -1,21 +1,30 @@
-#! /usr/bin/env stap
+#!/usr/bin/env stap
+# ansi_colors.stp
+# Copyright (C) 2006-2009 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
probe begin {
- printf("a \\ b |");
- for (c = 40; c < 48; c++)
- printf(" %d ", c);
- printf("\12");
- for (l = 0; l < 71; l++)
- printf("-");
- printf("\12");
+ printf("fg,t \\ bg |");
+ for (c = 40; c < 48; c++)
+ printf(" %d ", c);
+ ansi_new_line()
+ for (l = 0; l < 75; l++)
+ printf("-");
+ ansi_new_line()
- for (r = 30; r < 38; r++)
- for (t = 0; t < 2; t++) {
- printf("%d |", r);
- for (c = 40; c < 48; c++)
- printf("\033[%d;%d%s %s \033[0;0m",
- r, c, !t ? "m" : ";1m", !t ? "Normal" : "Bold ");
- printf("\12");
- }
- exit();
+ for (r = 30; r < 38; r++)
+ for (t = 0; t < 2; t++) {
+ printf(" %2d,%1d |", r, t);
+ for (c = 40; c < 48; c++) {
+ ansi_set_color3(r, c, t)
+ printf(" %s ", !t ? "Normal" : "Bold ")
+ ansi_reset_color()
+ }
+ ansi_new_line()
+ }
+ exit();
}
diff --git a/testsuite/systemtap.examples/general/ansi_colors2.meta b/testsuite/systemtap.examples/general/ansi_colors2.meta
new file mode 100644
index 00000000..4ccaf4e3
--- /dev/null
+++ b/testsuite/systemtap.examples/general/ansi_colors2.meta
@@ -0,0 +1,13 @@
+title: Show Attribues in Table for ansi_set_color3()
+name: ansi_colors2.stp
+version: 1.0
+author: Eugene Teo
+keywords: format
+subsystem: none
+status: production
+exit: fixed
+output: text
+scope: system-wide
+description: The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color3() function in the ansi.stp tapset.
+test_check: stap -p4 ansi_colors2.stp
+test_installcheck: stap ansi_colors2.stp
diff --git a/testsuite/systemtap.examples/general/ansi_colors2.stp b/testsuite/systemtap.examples/general/ansi_colors2.stp
new file mode 100755
index 00000000..fadcf011
--- /dev/null
+++ b/testsuite/systemtap.examples/general/ansi_colors2.stp
@@ -0,0 +1,31 @@
+#!/usr/bin/env stap
+# ansi_colors2.stp
+# Copyright (C) 2009 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+
+probe begin {
+ printf("fg,t \\ bg |");
+ for (c = 40; c < 48; c++)
+ printf(" %d ", c);
+ ansi_new_line()
+ for (l = 0; l < 75; l++)
+ printf("-");
+ ansi_new_line()
+
+ for (r = 30; r < 38; r++)
+ # this displays more attributes
+ for (t = 0; t < 8; !t ? ++t : t+=3) {
+ printf(" %2d,%1d |", r, t);
+ for (c = 40; c < 48; c++) {
+ ansi_set_color3(r, c, t)
+ printf(" Colors ")
+ ansi_reset_color()
+ }
+ ansi_new_line()
+ }
+ exit();
+}