Blob Blame History Raw
diff -Nrup a/memstomp.c b/memstomp.c
--- a/memstomp.c	2013-05-30 06:02:56.578486389 -0600
+++ b/memstomp.c	2013-05-30 06:06:42.648731070 -0600
@@ -64,6 +64,8 @@
 
 static bool abrt_trap = false;
 
+static bool quiet_mode = false;
+
 #ifndef SCHED_RESET_ON_FORK
 /* "Your libc lacks the definition of SCHED_RESET_ON_FORK. We'll now
  * define it ourselves, however make sure your kernel is new
@@ -162,7 +164,10 @@ static void setup(void) {
         if (LIKELY(initialized))
                 return;
 
-        if (!dlsym(NULL, "main"))
+        if (getenv("MEMSTOMP_QUIET"))
+                quiet_mode = true;
+
+        if (!dlsym(NULL, "main") && !quiet_mode)
                 fprintf(stderr,
                         "memstomp: Application appears to be compiled without -rdynamic. It might be a\n"
                         "memstomp: good idea to recompile with -rdynamic enabled since this produces more\n"
@@ -173,9 +178,11 @@ static void setup(void) {
 
         initialized = true;
 
-	char prname[17];
-        fprintf(stderr, "memstomp: "PACKAGE_VERSION" successfully initialized for process %s (pid %lu).\n",
-                get_prname(prname), (unsigned long) getpid());
+        if (!quiet_mode) {
+                char prname[17];
+                fprintf(stderr, "memstomp: "PACKAGE_VERSION" successfully initialized for process %s (pid %lu).\n",
+                        get_prname(prname), (unsigned long) getpid());
+        }
 }
 
 static void show_summary(void) { }
diff -Nrup a/memstomp.in b/memstomp.in
--- a/memstomp.in	2011-03-30 21:27:19.000000000 -0600
+++ b/memstomp.in	2013-05-30 06:06:42.649731067 -0600
@@ -18,7 +18,7 @@
 # You should have received a copy of the GNU Lesser General Public
 # License along with memstomp. If not, see <http://www.gnu.org/licenses/>.
 
-if ! TEMP=`getopt -o +dhk --long help,debug-info,kill -n memstomp -- "$@"` ; then
+if ! TEMP=`getopt -o +dqhk --long help,quiet,debug-info,kill -n memstomp -- "$@"` ; then
     exit 1
 fi
 
@@ -38,6 +38,10 @@ while : ; do
                         shift 1
                         ;;
 
+                -q|--quiet)
+                        export MEMSTOMP_QUIET=1
+                        shift 1
+                        ;;
 
                 -h|--help)
                         cat <<EOF
@@ -51,6 +55,7 @@ COMMANDS:
 OPTIONS:
   -d, --debug-info                Make use of debug information in stack traces
   -k, --kill                      Kill application when problem memcpy occurs
+  -q, --quiet                     Be less verbose
 EOF
                         exit 0
                         ;;
diff -Nrup a/memstomp.man b/memstomp.man
--- a/memstomp.man	2013-05-30 06:02:56.577486392 -0600
+++ b/memstomp.man	2013-05-30 06:06:18.531812637 -0600
@@ -47,6 +47,9 @@ Kill the analyzed application when a pro
 .TP
 .BR \-h ", " \-\-help
 Display usage information and exit.
+.TP
+.BR \-q ", " \-\-quiet
+Be less verbose
 .SH SEE ALSO
 .BR memcpy (3),
 .BR memccpy (3),