[netcf-devel] [PATCH 3/3] ncftool: Add a --debug option

Cole Robinson crobinso at redhat.com
Sun Jan 31 00:59:54 UTC 2010


This makes ncftool set the (undocumented) NETCF_DEBUG variable
for us.

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/ncftool.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/ncftool.c b/src/ncftool.c
index 66c590c..96276e9 100644
--- a/src/ncftool.c
+++ b/src/ncftool.c
@@ -663,6 +663,8 @@ static void usage(void) {
     fprintf(stderr, "\nOptions:\n\n");
     fprintf(stderr,
             "  -r, --root ROOT    use ROOT as the root of the filesystem\n\n");
+    fprintf(stderr,
+            "  -d, --debug        Show debugging output\n\n");
     print_all_cmds(stderr);
 
     exit(EXIT_FAILURE);
@@ -673,12 +675,16 @@ static void parse_opts(int argc, char **argv) {
     struct option options[] = {
         { "help",      0, 0, 'h' },
         { "root",      1, 0, 'r' },
+        { "debug",     0, 0, 'd' },
         { 0, 0, 0, 0}
     };
     int idx;
 
-    while ((opt = getopt_long(argc, argv, "+hr:", options, &idx)) != -1) {
+    while ((opt = getopt_long(argc, argv, "+dhr:", options, &idx)) != -1) {
         switch(opt) {
+        case 'd':
+            setenv("NETCF_DEBUG", "1", 1);
+            break;
         case 'h':
             usage();
             break;
-- 
1.6.5.2



More information about the netcf-devel mailing list