From 91a186251047127ad7f1238f47ff761d9127627c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 21 Sep 2010 14:06:39 -0400 Subject: [PATCH] printfv and printfq functions in commandline.inc --- scripts/commandline.inc | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/scripts/commandline.inc b/scripts/commandline.inc index 6d94a318d6..9390890ef3 100644 --- a/scripts/commandline.inc +++ b/scripts/commandline.inc @@ -204,3 +204,43 @@ function getUser() return $user; } + +/** "Printf not quiet" */ + +function printfnq() +{ + if (have_option('q', 'quiet')) { + return null; + } + + $cargs = func_num_args(); + + if ($cargs == 0) { + return 0; + } + + $args = func_get_args(); + $format = array_shift($args); + + return vprintf($format, $args); +} + +/** "Print when verbose" */ + +function printfv() +{ + if (!have_option('v', 'verbose')) { + return null; + } + + $cargs = func_num_args(); + + if ($cargs == 0) { + return 0; + } + + $args = func_get_args(); + $format = array_shift($args); + + return vprintf($format, $args); +} \ No newline at end of file