From e3c4a363ea7b03a909f9b92c6657ea9129ee53f3 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Thu, 3 Dec 2015 12:18:13 +0100 Subject: Adding verbosity Change-Id: Icc0fdc6a230e2bf11fccc4f7739009e7266f6b9d --- wgtpkg-pack.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'wgtpkg-pack.c') diff --git a/wgtpkg-pack.c b/wgtpkg-pack.c index 9164447..a8aaa05 100644 --- a/wgtpkg-pack.c +++ b/wgtpkg-pack.c @@ -47,6 +47,8 @@ static void usage() "\n" " -o wgtfile the output widget file\n" " -f force overwriting\n" + " -q quiet\n" + " -v verbose\n" "\n", appname ); @@ -56,6 +58,8 @@ static struct option options[] = { { "output", required_argument, NULL, 'o' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, + { "quiet", no_argument, NULL, 'q' }, + { "verbose", no_argument, NULL, 'v' }, { NULL, 0, NULL, 0 } }; @@ -71,13 +75,20 @@ int main(int ac, char **av) force = 0; wgtfile = directory = NULL; for (;;) { - i = getopt_long(ac, av, "hfo:", options, NULL); + i = getopt_long(ac, av, "qvhfo:", options, NULL); if (i < 0) break; switch (i) { case 'o': wgtfile = optarg; break; + case 'q': + if (verbosity) + verbosity--; + break; + case 'v': + verbosity++; + break; case 'f': force = 1; break; @@ -124,7 +135,7 @@ int main(int ac, char **av) return 1; } -printf("\n\nPACKING widget %s from directory %s\n", wgtfile, directory); + notice("-- PACKING widget %s from directory %s", wgtfile, directory); /* creates an existing widget (for realpath it must exist) */ i = open(wgtfile, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666); -- cgit 1.2.3-korg