Permalink
Browse files

Add a [-V]erbose flag; default is off.

reptyr should just work and not utter all those
debug messages unless asked.

Signed-off-by: Randy MacLeod <rwmacleod@gmail.com>
[nelhage@nelhage.com: Reduce nesting in debug()]

Signed-off-by: Nelson Elhage <nelhage@nelhage.com>
  • Loading branch information...
1 parent aa9fba3 commit d5f80609e38e109d8032e8f81a6529ae2db2bb0c @rwmacleod rwmacleod committed with Dec 21, 2011
Showing with 11 additions and 0 deletions.
  1. +11 −0 reptyr.c
View
11 reptyr.c
@@ -38,6 +38,8 @@
#error reptyr is currently Linux-only.
#endif
+static int verbose = 0;
+
void _debug(const char *pfx, const char *msg, va_list ap) {
if (pfx)
@@ -56,7 +58,12 @@ void die(const char *msg, ...) {
}
void debug(const char *msg, ...) {
+
va_list ap;
+
+ if (!verbose)
+ return;
+
va_start(ap, msg);
_debug("[+] ", msg, ap);
va_end(ap);
@@ -195,6 +202,10 @@ int main(int argc, char **argv) {
printf(" by Nelson Elhage <nelhage@nelhage.com>\n");
printf("http://github.com/nelhage/reptyr/\n");
return 0;
+ case 'V':
+ arg++;
+ verbose = 1;
+ break;
default:
usage(argv[0]);
return 1;

0 comments on commit d5f8060

Please sign in to comment.