]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Indent rrd_tool.c
authorWolfgang Stöggl <c72578@yahoo.de>
Mon, 3 Jun 2019 12:48:11 +0000 (14:48 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Mon, 3 Jun 2019 15:47:21 +0000 (17:47 +0200)
- indent src/rrd_tool.c using GNU indent 2.2.12

src/rrd_tool.c

index a949d023c310c9887a08e55c95c296ed7b68a45d..3a4ba97cf32a5c306d5623d8fcd5da5c5a19ee6a 100644 (file)
@@ -76,8 +76,7 @@ static void PrintUsage(
         N_("* dump - dump an RRD to XML\n\n"
            "\trrdtool dump [--header|-h {none,xsd,dtd}]\n"
            "\t\t[--no-header|-n]\n"
-           "\t\t[--daemon|-d address]\n"
-           "\t\tfile.rrd [file.xml]");
+           "\t\t[--daemon|-d address]\n" "\t\tfile.rrd [file.xml]");
 
     const char *help_info =
         N_("* info - returns the configuration and status of the RRD\n\n"
@@ -93,8 +92,7 @@ static void PrintUsage(
 
     const char *help_last =
         N_("* last - show last update time for RRD\n\n"
-           "\trrdtool last filename.rrd\n"
-           "\t\t[--daemon|-d address]\n");
+           "\trrdtool last filename.rrd\n" "\t\t[--daemon|-d address]\n");
 
     const char *help_lastupdate =
         N_("* lastupdate - returns the most recent datum stored for\n"
@@ -111,7 +109,7 @@ static void PrintUsage(
            "\trrdtool update filename\n"
            "\t\t[--template|-t ds-name:ds-name:...]\n"
            "\t\t[--skip-past-updates|-s]\n"
-          "\t\t[--daemon|-d <address>]\n"
+           "\t\t[--daemon|-d <address>]\n"
            "\t\ttime|N:value[:value...]\n\n"
            "\t\tat-time@value[:value...]\n\n"
            "\t\t[ time:value[:value...] ..]\n");
@@ -131,13 +129,12 @@ static void PrintUsage(
            "\trrdtool fetch filename.rrd CF\n"
            "\t\t[-r|--resolution resolution]\n"
            "\t\t[-s|--start start] [-e|--end end]\n"
-           "\t\t[-a|--align-start]\n"
-           "\t\t[-d|--daemon <address>]\n");
+           "\t\t[-a|--align-start]\n" "\t\t[-d|--daemon <address>]\n");
 
     const char *help_flushcached =
         N_("* flushcached - flush cached data out to an RRD file\n\n"
            "\trrdtool flushcached filename.rrd\n"
-          "\t\t[-d|--daemon <address>]\n");
+           "\t\t[-d|--daemon <address>]\n");
 
 /* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/
 
@@ -217,14 +214,13 @@ static void PrintUsage(
            "\t\t[--smoothing-window|-s fraction-of-season]\n"
            "\t\t[--smoothing-window-deviation|-S fraction-of-season]\n"
            "\t\t[--aberrant-reset|-b ds-name]\n");
-    const char *help_tune3 = 
+    const char *help_tune3 =
         N_("\t\t[--step|-t newstep]\n"
            "\t\t[--daemon|-D address]\n"
            "\t\t[DEL:ds-name]\n"
            "\t\t[DS:ds-spec]\n"
            "\t\t[DELRRA:index]\n"
-           "\t\t[RRA:rra-spec]\n"
-           "\t\t[RRA#index:[+-=]number]\n");
+           "\t\t[RRA:rra-spec]\n" "\t\t[RRA#index:[+-=]number]\n");
     const char *help_resize =
         N_
         (" * resize - alter the length of one of the RRAs in an RRD\n\n"
@@ -236,8 +232,7 @@ static void PrintUsage(
            "\t\t[--enumds] [--json]\n"
            "\t\t[-d|--daemon address]\n"
            "\t\t[DEF:vname=rrd:ds-name:CF]\n"
-           "\t\t[CDEF:vname=rpn-expression]\n"
-           "\t\t[XPORT:vname:legend]\n");
+           "\t\t[CDEF:vname=rpn-expression]\n" "\t\t[XPORT:vname:legend]\n");
     const char *help_quit =
         N_(" * quit - closing a session in remote mode\n\n"
            "\trrdtool quit\n");
@@ -371,7 +366,7 @@ static void PrintUsage(
     case C_TUNE:
         puts(_(help_tune1));
         puts(_(help_tune2));
-       puts(_(help_tune3));
+        puts(_(help_tune3));
         break;
     case C_RESIZE:
         puts(_(help_resize));
@@ -424,8 +419,8 @@ static char *fgetslong(
             exit(1);
         }
     }
-    if (linebuf[0]){
-        return  *aLinePtr = linebuf;
+    if (linebuf[0]) {
+        return *aLinePtr = linebuf;
     }
     free(linebuf);
     return *aLinePtr = 0;
@@ -447,7 +442,7 @@ int main(
 #endif
 
     /* initialize locale settings
-       according to localeconv(3) */       
+       according to localeconv(3) */
     setlocale(LC_ALL, "");
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
@@ -475,15 +470,17 @@ int main(
 #endif
         RemoteMode = 1;
         if ((argc == 3) && strcmp("", argv[2])) {
-            int test_euid = 0;            
+            int       test_euid = 0;
+
 #ifdef HAVE_GETEUID
             test_euid = geteuid() == 0;
 #endif
             if (test_euid) {
 
 #ifdef HAVE_CHROOT
-                if (chroot(argv[2]) != 0){
-                    fprintf(stderr, "ERROR: chroot %s: %s\n", argv[2],rrd_strerror(errno));
+                if (chroot(argv[2]) != 0) {
+                    fprintf(stderr, "ERROR: chroot %s: %s\n", argv[2],
+                            rrd_strerror(errno));
                     exit(errno);
                 }
                 ChangeRoot = 1;
@@ -499,18 +496,20 @@ int main(
             }
         }
         if (strcmp(firstdir, "")) {
-            if (chdir(firstdir) != 0){
-                fprintf(stderr, "ERROR: chdir %s %s\n", firstdir,rrd_strerror(errno));
+            if (chdir(firstdir) != 0) {
+                fprintf(stderr, "ERROR: chdir %s %s\n", firstdir,
+                        rrd_strerror(errno));
                 exit(errno);
             }
         }
 
         while (fgetslong(&aLine, stdin)) {
-            char *aLineOrig = aLine;
+            char     *aLineOrig = aLine;
+
             if ((argc = CountArgs(aLine)) == 0) {
                 free(aLine);
                 printf("ERROR: not enough arguments\n");
-                continue;                
+                continue;
             }
             if ((myargv = (char **) malloc((argc + 1) *
                                            sizeof(char *))) == NULL) {
@@ -520,7 +519,7 @@ int main(
             if ((argc = CreateArgs(argv[0], aLine, myargv)) < 0) {
                 printf("ERROR: creating arguments\n");
             } else {
-                if ( HandleInputLine(argc, myargv, stdout) == 0 ){
+                if (HandleInputLine(argc, myargv, stdout) == 0) {
 #ifdef HAVE_GETRUSAGE
                     getrusage(RUSAGE_SELF, &myusage);
                     gettimeofday(&currenttime, NULL);
@@ -590,14 +589,15 @@ static int HandleInputLine(
                 return (1);
             }
 #endif
-            if (chdir(argv[2]) != 0){
+            if (chdir(argv[2]) != 0) {
                 printf("ERROR: chdir %s %s\n", argv[2], rrd_strerror(errno));
                 return (1);
             }
             return (0);
         }
         if (argc > 1 && strcmp("pwd", argv[1]) == 0) {
-            char     *cwd;      /* To hold current working dir on call to pwd */
+            char     *cwd;  /* To hold current working dir on call to pwd */
+
             if (argc != 2) {
                 printf("ERROR: invalid parameter count for pwd\n");
                 return (1);
@@ -630,8 +630,8 @@ static int HandleInputLine(
                 return (1);
             }
 #endif
-            if(mkdir(argv[2], 0777)!=0){
-                printf("ERROR: mkdir %s: %s\n", argv[2],rrd_strerror(errno));
+            if (mkdir(argv[2], 0777) != 0) {
+                printf("ERROR: mkdir %s: %s\n", argv[2], rrd_strerror(errno));
                 return (1);
             }
             return (0);
@@ -643,6 +643,7 @@ static int HandleInputLine(
             }
             if ((curdir = opendir(".")) != NULL) {
                 struct stat st;
+
                 while ((dent = readdir(curdir)) != NULL) {
                     if (!stat(dent->d_name, &st)) {
                         if (S_ISDIR(st.st_mode)) {
@@ -685,34 +686,32 @@ static int HandleInputLine(
         rrd_info_t *data;
 
         if (strcmp("info", argv[1]) == 0)
-
             data = rrd_info(argc - 1, &argv[1]);
         else
             data = rrd_update_v(argc - 1, &argv[1]);
         rrd_info_print(data);
         rrd_info_free(data);
-    }
-    else if (strcmp("list", argv[1]) == 0) {
-        char *list;
+    } else if (strcmp("list", argv[1]) == 0) {
+        char     *list;
+
         list = rrd_list(argc - 1, &argv[1]);
 
-       if (list) {
-         printf("%s", list);
-         free(list);
-       }
-    }
-    else if (strcmp("--version", argv[1]) == 0 ||
-             strcmp("version", argv[1]) == 0 ||
-             strcmp("v", argv[1]) == 0 ||
-             strcmp("-v", argv[1]) == 0 || strcmp("-version", argv[1]) == 0)
+        if (list) {
+            printf("%s", list);
+            free(list);
+        }
+    } else if (strcmp("--version", argv[1]) == 0 ||
+               strcmp("version", argv[1]) == 0 ||
+               strcmp("v", argv[1]) == 0 ||
+               strcmp("-v", argv[1]) == 0 || strcmp("-version", argv[1]) == 0)
         printf("RRDtool " PACKAGE_VERSION
-               "  Copyright by Tobi Oetiker (%f)\n",
-               rrd_version());
+               "  Copyright by Tobi Oetiker (%f)\n", rrd_version());
     else if (strcmp("restore", argv[1]) == 0)
 #ifdef HAVE_RRD_RESTORE
         rrd_restore(argc - 1, &argv[1]);
 #else
-       rrd_set_error("the instance of rrdtool has been compiled without XML import functions");
+        rrd_set_error
+            ("the instance of rrdtool has been compiled without XML import functions");
 #endif
     else if (strcmp("resize", argv[1]) == 0)
         rrd_resize(argc - 1, &argv[1]);
@@ -763,15 +762,17 @@ static int HandleInputLine(
         }
     } else if (strcmp("xport", argv[1]) == 0) {
 #ifdef HAVE_RRD_GRAPH
-      time_t    start, end;
-      unsigned long step, col_cnt;
-      rrd_value_t *data;
-      char    **legend_v;
-      rrd_xport
-       (argc - 1, &argv[1], NULL, &start, &end, &step, &col_cnt,
-        &legend_v, &data);
+        time_t    start, end;
+        unsigned long step, col_cnt;
+        rrd_value_t *data;
+        char    **legend_v;
+
+        rrd_xport
+            (argc - 1, &argv[1], NULL, &start, &end, &step, &col_cnt,
+             &legend_v, &data);
 #else
-        rrd_set_error("the instance of rrdtool has been compiled without graphics");
+        rrd_set_error
+            ("the instance of rrdtool has been compiled without graphics");
 #endif
     } else if (strcmp("graph", argv[1]) == 0) {
 #ifdef HAVE_RRD_GRAPH
@@ -809,7 +810,8 @@ static int HandleInputLine(
         }
 
 #else
-       rrd_set_error("the instance of rrdtool has been compiled without graphics");
+        rrd_set_error
+            ("the instance of rrdtool has been compiled without graphics");
 #endif
     } else if (strcmp("graphv", argv[1]) == 0) {
 #ifdef HAVE_RRD_GRAPH
@@ -821,7 +823,8 @@ static int HandleInputLine(
             rrd_info_free(grinfo);
         }
 #else
-       rrd_set_error("the instance of rrdtool has been compiled without graphics");
+        rrd_set_error
+            ("the instance of rrdtool has been compiled without graphics");
 #endif
     } else if (strcmp("tune", argv[1]) == 0)
         rrd_tune(argc - 1, &argv[1]);