From: oetiker Date: Sun, 24 Feb 2008 14:27:34 +0000 (+0000) Subject: fix indents gone out of kileter by patching ... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c208ca2237941e0390dafb6714b2e06f1f776394;p=rrdtool.git fix indents gone out of kileter by patching ... git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1298 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_create.c b/src/rrd_create.c index 027c6ab..b3b7077 100644 --- a/src/rrd_create.c +++ b/src/rrd_create.c @@ -694,8 +694,8 @@ int rrd_create_fn( if ((rrd->pdp_prep = calloc(1, sizeof(pdp_prep_t))) == NULL) { rrd_set_error("allocating pdp_prep"); - free(rrd->stat_head); - free(rrd->live_head); + free(rrd->stat_head); + free(rrd->live_head); close(rrd_file); return (-1); } @@ -711,8 +711,8 @@ int rrd_create_fn( if ((rrd->cdp_prep = calloc(1, sizeof(cdp_prep_t))) == NULL) { rrd_set_error("allocating cdp_prep"); - free(rrd->stat_head); - free(rrd->live_head); + free(rrd->stat_head); + free(rrd->live_head); close(rrd_file); return (-1); } @@ -759,8 +759,8 @@ int rrd_create_fn( if ((rrd->rra_ptr = calloc(1, sizeof(rra_ptr_t))) == NULL) { rrd_set_error("allocating rra_ptr"); - free(rrd->stat_head); - free(rrd->live_head); + free(rrd->stat_head); + free(rrd->live_head); close(rrd_file); return (-1); } @@ -777,8 +777,8 @@ int rrd_create_fn( /* write the empty data area */ if ((unknown = (rrd_value_t *) malloc(512 * sizeof(rrd_value_t))) == NULL) { rrd_set_error("allocating unknown"); - free(rrd->stat_head); - free(rrd->live_head); + free(rrd->stat_head); + free(rrd->live_head); close(rrd_file); return (-1); } @@ -796,8 +796,8 @@ int rrd_create_fn( } free(unknown); fdatasync(rrd_file); - free(rrd->stat_head); - free(rrd->live_head); + free(rrd->stat_head); + free(rrd->live_head); if (close(rrd_file) == -1) { rrd_set_error("creating rrd: %s", rrd_strerror(errno)); return -1; @@ -812,14 +812,13 @@ int rrd_create_fn( static int rand_init = 0; -long int -rra_random_row(rra_def_t *rra) +long int rra_random_row( + rra_def_t *rra) { - if (!rand_init) - { - srandom((unsigned int)time(NULL) + (unsigned int)getpid()); + if (!rand_init) { + srandom((unsigned int) time(NULL) + (unsigned int) getpid()); rand_init++; } - + return random() % rra->row_cnt; } diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c index 44f2c17..95210f6 100644 --- a/src/rrd_graph_helper.c +++ b/src/rrd_graph_helper.c @@ -795,10 +795,10 @@ int rrd_parse_PVHLAST( char *saveptr; strcpy(csv, tmpstr); - - pch = strtok_r(tmpstr, ",",&saveptr); + + pch = strtok_r(tmpstr, ",", &saveptr); while (pch != NULL) { - pch = strtok_r(NULL, ",",&saveptr); + pch = strtok_r(NULL, ",", &saveptr); count++; } dprintf("- %d dash value(s) found: ", count); @@ -806,7 +806,7 @@ int rrd_parse_PVHLAST( gdp->dash = 1; gdp->ndash = count; gdp->p_dashes = (double *) malloc(sizeof(double) * count); - pch = strtok_r(csv, ",",&saveptr); + pch = strtok_r(csv, ",", &saveptr); count = 0; while (pch != NULL) { if (sscanf(pch, "%f", &dsh)) { @@ -814,7 +814,7 @@ int rrd_parse_PVHLAST( dprintf("%.1f ", gdp->p_dashes[count]); count++; } - pch = strtok_r(NULL, ",",&saveptr); + pch = strtok_r(NULL, ",", &saveptr); } dprintf("\n"); } else diff --git a/src/rrd_i18n.h b/src/rrd_i18n.h index 8e6fcea..d0c8ff2 100644 --- a/src/rrd_i18n.h +++ b/src/rrd_i18n.h @@ -4,7 +4,7 @@ * rrd_i18n.h Common Header File *****************************************************************************/ #ifdef __cplusplus -extern "C" { +extern "C" { #endif diff --git a/src/rrd_info.c b/src/rrd_info.c index 3c0ee0e..ff3e35b 100644 --- a/src/rrd_info.c +++ b/src/rrd_info.c @@ -186,8 +186,9 @@ info_t *rrd_info_r( info.u_cnt = rrd.rra_def[i].row_cnt; cd = info_push(cd, sprintf_alloc("rra[%d].rows", i), RD_I_CNT, info); - info.u_cnt=rrd.rra_ptr[i].cur_row; - cd=info_push(cd,sprintf_alloc("rra[%d].cur_row",i), RD_I_CNT, info); + info.u_cnt = rrd.rra_ptr[i].cur_row; + cd = info_push(cd, sprintf_alloc("rra[%d].cur_row", i), RD_I_CNT, + info); info.u_cnt = rrd.rra_def[i].pdp_cnt; cd = info_push(cd, sprintf_alloc("rra[%d].pdp_per_row", i), RD_I_CNT, diff --git a/src/rrd_restore.c b/src/rrd_restore.c index 89743a0..b2d1193 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -52,7 +52,7 @@ void parse_FAILURES_history( rrd_t *rrd, int rra_index, int ds_index); -long int rra_random_row( +long int rra_random_row( rra_def_t *); /* convert all occurrences of to */ @@ -429,8 +429,10 @@ int xml2rrd( eat_tag(&ptr2, "cdp_prep"); for (i = 0; i < (int) rrd->stat_head->ds_cnt; i++) { - if (eat_tag(&ptr2, "ds") != 1){ - rrd_set_error("expected to find %lu entries in ",rrd->stat_head->ds_cnt); + if (eat_tag(&ptr2, "ds") != 1) { + rrd_set_error + ("expected to find %lu entries in ", + rrd->stat_head->ds_cnt); return -1; } /* support to read CDP parameters */ @@ -678,26 +680,27 @@ int rrd_creat( fwrite(rrd->cdp_prep, sizeof(cdp_prep_t), rrd->stat_head->rra_cnt * rrd->stat_head->ds_cnt, rrd_file); - for(i=0; i < rrd->stat_head->rra_cnt; i++) - rrd->rra_ptr[i].cur_row = rra_random_row(&rrd->rra_def[i]); + for (i = 0; i < rrd->stat_head->rra_cnt; i++) + rrd->rra_ptr[i].cur_row = rra_random_row(&rrd->rra_def[i]); fwrite(rrd->rra_ptr, sizeof(rra_ptr_t), rrd->stat_head->rra_cnt, rrd_file); /* Dump RRD values */ - rra_offset=0; - for(i=0; i < rrd->stat_head->rra_cnt; i++) - { + rra_offset = 0; + for (i = 0; i < rrd->stat_head->rra_cnt; i++) { unsigned long num_rows = rrd->rra_def[i].row_cnt; unsigned long cur_row = rrd->rra_ptr[i].cur_row; unsigned long ds_cnt = rrd->stat_head->ds_cnt; - fwrite(rrd->rrd_value + (rra_offset + num_rows-1 - cur_row) * ds_cnt, - sizeof(rrd_value_t), (cur_row+1)*ds_cnt, rrd_file); + fwrite(rrd->rrd_value + + (rra_offset + num_rows - 1 - cur_row) * ds_cnt, + sizeof(rrd_value_t), (cur_row + 1) * ds_cnt, rrd_file); fwrite(rrd->rrd_value + rra_offset * ds_cnt, - sizeof(rrd_value_t), (num_rows-1 - cur_row)*ds_cnt, rrd_file); + sizeof(rrd_value_t), (num_rows - 1 - cur_row) * ds_cnt, + rrd_file); rra_offset += num_rows; } diff --git a/src/rrd_tool.c b/src/rrd_tool.c index b91d96f..8caa44e 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -47,14 +47,14 @@ void PrintUsage( char help_main[] = N_("RRDtool %s" - " Copyright 1997-2007 by Tobias Oetiker \n" - " Compiled %s %s\n\n" - "Usage: rrdtool [options] command command_options\n\n"); + " Copyright 1997-2007 by Tobias Oetiker \n" + " Compiled %s %s\n\n" + "Usage: rrdtool [options] command command_options\n\n"); char help_list[] = N_("Valid commands: create, update, updatev, graph, dump, restore,\n" - "\t\tlast, lastupdate, first, info, fetch, tune,\n" - "\t\tresize, xport\n\n"); + "\t\tlast, lastupdate, first, info, fetch, tune,\n" + "\t\tresize, xport\n\n"); char help_listremote[] = N_("Valid remote commands: quit, ls, cd, mkdir, pwd\n\n"); @@ -62,158 +62,159 @@ void PrintUsage( char help_create[] = N_("* create - create a new RRD\n\n" - "\trrdtool create filename [--start|-b start time]\n" - "\t\t[--step|-s step]\n" - "\t\t[DS:ds-name:DST:dst arguments]\n" - "\t\t[RRA:CF:cf arguments]\n\n"); + "\trrdtool create filename [--start|-b start time]\n" + "\t\t[--step|-s step]\n" + "\t\t[DS:ds-name:DST:dst arguments]\n" + "\t\t[RRA:CF:cf arguments]\n\n"); char help_dump[] = N_("* dump - dump an RRD to XML\n\n" - "\trrdtool dump filename.rrd >filename.xml\n\n"); + "\trrdtool dump filename.rrd >filename.xml\n\n"); char help_info[] = N_("* info - returns the configuration and status of the RRD\n\n" - "\trrdtool info filename.rrd\n\n"); + "\trrdtool info filename.rrd\n\n"); char help_restore[] = N_("* restore - restore an RRD file from its XML form\n\n" - "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n"); + "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n"); char help_last[] = N_("* last - show last update time for RRD\n\n" - "\trrdtool last filename.rrd\n\n"); + "\trrdtool last filename.rrd\n\n"); char help_lastupdate[] = N_("* lastupdate - returns the most recent datum stored for\n" - " each DS in an RRD\n\n" "\trrdtool lastupdate filename.rrd\n\n"); + " each DS in an RRD\n\n" "\trrdtool lastupdate filename.rrd\n\n"); char help_first[] = N_("* first - show first update time for RRA within an RRD\n\n" - "\trrdtool first filename.rrd [--rraindex number]\n\n"); + "\trrdtool first filename.rrd [--rraindex number]\n\n"); char help_update[] = N_("* update - update an RRD\n\n" - "\trrdtool update filename\n" - "\t\t--template|-t ds-name:ds-name:...\n" - "\t\ttime|N:value[:value...]\n\n" - "\t\tat-time@value[:value...]\n\n" - "\t\t[ time:value[:value...] ..]\n\n"); + "\trrdtool update filename\n" + "\t\t--template|-t ds-name:ds-name:...\n" + "\t\ttime|N:value[:value...]\n\n" + "\t\tat-time@value[:value...]\n\n" + "\t\t[ time:value[:value...] ..]\n\n"); char help_updatev[] = N_("* updatev - a verbose version of update\n" - "\treturns information about values, RRAs, and datasources updated\n\n" - "\trrdtool updatev filename\n" - "\t\t--template|-t ds-name:ds-name:...\n" - "\t\ttime|N:value[:value...]\n\n" - "\t\tat-time@value[:value...]\n\n" - "\t\t[ time:value[:value...] ..]\n\n"); + "\treturns information about values, RRAs, and datasources updated\n\n" + "\trrdtool updatev filename\n" + "\t\t--template|-t ds-name:ds-name:...\n" + "\t\ttime|N:value[:value...]\n\n" + "\t\tat-time@value[:value...]\n\n" + "\t\t[ time:value[:value...] ..]\n\n"); char help_fetch[] = N_("* fetch - fetch data out of an RRD\n\n" - "\trrdtool fetch filename.rrd CF\n" - "\t\t[-r|--resolution resolution]\n" - "\t\t[-s|--start start] [-e|--end end]\n\n"); + "\trrdtool fetch filename.rrd CF\n" + "\t\t[-r|--resolution resolution]\n" + "\t\t[-s|--start start] [-e|--end end]\n\n"); /* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/ char help_graph1[] = N_("* graph - generate a graph from one or several RRD\n\n" - "\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n" - "\t\t[-x|--x-grid x-axis grid and label]\n" - "\t\t[-Y|--alt-y-grid]\n" - "\t\t[-y|--y-grid y-axis grid and label]\n" - "\t\t[-v|--vertical-label string] [-w|--width pixels]\n" - "\t\t[-h|--height pixels] [-o|--logarithmic]\n" - "\t\t[-u|--upper-limit value] [-z|--lazy]\n" - "\t\t[-l|--lower-limit value] [-r|--rigid]\n" - "\t\t[-g|--no-legend]\n" - "\t\t[-F|--force-rules-legend]\n" "\t\t[-j|--only-graph]\n"); + "\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n" + "\t\t[-x|--x-grid x-axis grid and label]\n" + "\t\t[-Y|--alt-y-grid]\n" + "\t\t[-y|--y-grid y-axis grid and label]\n" + "\t\t[-v|--vertical-label string] [-w|--width pixels]\n" + "\t\t[-h|--height pixels] [-o|--logarithmic]\n" + "\t\t[-u|--upper-limit value] [-z|--lazy]\n" + "\t\t[-l|--lower-limit value] [-r|--rigid]\n" + "\t\t[-g|--no-legend]\n" + "\t\t[-F|--force-rules-legend]\n" "\t\t[-j|--only-graph]\n"); char help_graph2[] = N_("\t\t[-n|--font FONTTAG:size:font]\n" - "\t\t[-m|--zoom factor]\n" - "\t\t[-A|--alt-autoscale]\n" - "\t\t[-M|--alt-autoscale-max]\n" - "\t\t[-R|--font-render-mode {normal,light,mono}]\n" - "\t\t[-B|--font-smoothing-threshold size]\n" - "\t\t[-E|--slope-mode]\n" - "\t\t[-N|--no-gridfit]\n" - "\t\t[-X|--units-exponent value]\n" - "\t\t[-L|--units-length value]\n" - "\t\t[-S|--step seconds]\n" - "\t\t[-f|--imginfo printfstr]\n" - "\t\t[-a|--imgformat PNG]\n" - "\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n" - "\t\t[-W|--watermark string]\n" "\t\t[DEF:vname=rrd:ds-name:CF]\n"); + "\t\t[-m|--zoom factor]\n" + "\t\t[-A|--alt-autoscale]\n" + "\t\t[-M|--alt-autoscale-max]\n" + "\t\t[-R|--font-render-mode {normal,light,mono}]\n" + "\t\t[-B|--font-smoothing-threshold size]\n" + "\t\t[-E|--slope-mode]\n" + "\t\t[-N|--no-gridfit]\n" + "\t\t[-X|--units-exponent value]\n" + "\t\t[-L|--units-length value]\n" + "\t\t[-S|--step seconds]\n" + "\t\t[-f|--imginfo printfstr]\n" + "\t\t[-a|--imgformat PNG]\n" + "\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n" + "\t\t[-W|--watermark string]\n" + "\t\t[DEF:vname=rrd:ds-name:CF]\n"); char help_graph3[] = N_("\t\t[CDEF:vname=rpn-expression]\n" - "\t\t[VDEF:vdefname=rpn-expression]\n" - "\t\t[PRINT:vdefname:format]\n" - "\t\t[GPRINT:vdefname:format]\n" - "\t\t[COMMENT:text]\n" - "\t\t[SHIFT:vname:offset]\n" - "\t\t[TICK:vname#rrggbb[aa][:[fraction][:legend]]]\n" - "\t\t[HRULE:value#rrggbb[aa][:legend]]\n" - "\t\t[VRULE:value#rrggbb[aa][:legend]]\n" - "\t\t[LINE[width]:vname[#rrggbb[aa][:[legend][:STACK]]]]\n" - "\t\t[AREA:vname[#rrggbb[aa][:[legend][:STACK]]]]\n" - "\t\t[PRINT:vname:CF:format] (deprecated)\n" - "\t\t[GPRINT:vname:CF:format] (deprecated)\n" - "\t\t[STACK:vname[#rrggbb[aa][:legend]]] (deprecated)\n\n"); + "\t\t[VDEF:vdefname=rpn-expression]\n" + "\t\t[PRINT:vdefname:format]\n" "\t\t[GPRINT:vdefname:format]\n" + "\t\t[COMMENT:text]\n" "\t\t[SHIFT:vname:offset]\n" + "\t\t[TICK:vname#rrggbb[aa][:[fraction][:legend]]]\n" + "\t\t[HRULE:value#rrggbb[aa][:legend]]\n" + "\t\t[VRULE:value#rrggbb[aa][:legend]]\n" + "\t\t[LINE[width]:vname[#rrggbb[aa][:[legend][:STACK]]]]\n" + "\t\t[AREA:vname[#rrggbb[aa][:[legend][:STACK]]]]\n" + "\t\t[PRINT:vname:CF:format] (deprecated)\n" + "\t\t[GPRINT:vname:CF:format] (deprecated)\n" + "\t\t[STACK:vname[#rrggbb[aa][:legend]]] (deprecated)\n\n"); char help_tune1[] = N_(" * tune - Modify some basic properties of an RRD\n\n" - "\trrdtool tune filename\n" - "\t\t[--heartbeat|-h ds-name:heartbeat]\n" - "\t\t[--data-source-type|-d ds-name:DST]\n" - "\t\t[--data-source-rename|-r old-name:new-name]\n" - "\t\t[--minimum|-i ds-name:min] [--maximum|-a ds-name:max]\n" - "\t\t[--deltapos scale-value] [--deltaneg scale-value]\n" - "\t\t[--failure-threshold integer]\n" - "\t\t[--window-length integer]\n" - "\t\t[--alpha adaptation-parameter]\n"); + "\trrdtool tune filename\n" + "\t\t[--heartbeat|-h ds-name:heartbeat]\n" + "\t\t[--data-source-type|-d ds-name:DST]\n" + "\t\t[--data-source-rename|-r old-name:new-name]\n" + "\t\t[--minimum|-i ds-name:min] [--maximum|-a ds-name:max]\n" + "\t\t[--deltapos scale-value] [--deltaneg scale-value]\n" + "\t\t[--failure-threshold integer]\n" + "\t\t[--window-length integer]\n" + "\t\t[--alpha adaptation-parameter]\n"); char help_tune2[] = N_(" * tune - Modify some basic properties of an RRD\n\n" - "\t\t[--beta adaptation-parameter]\n" - "\t\t[--gamma adaptation-parameter]\n" - "\t\t[--gamma-deviation adaptation-parameter]\n" - "\t\t[--aberrant-reset ds-name]\n\n"); + "\t\t[--beta adaptation-parameter]\n" + "\t\t[--gamma adaptation-parameter]\n" + "\t\t[--gamma-deviation adaptation-parameter]\n" + "\t\t[--aberrant-reset ds-name]\n\n"); char help_resize[] = N_(" * resize - alter the length of one of the RRAs in an RRD\n\n" - "\trrdtool resize filename rranum GROW|SHRINK rows\n\n"); + "\trrdtool resize filename rranum GROW|SHRINK rows\n\n"); char help_xport[] = N_("* xport - generate XML dump from one or several RRD\n\n" - "\trrdtool xport [-s|--start seconds] [-e|--end seconds]\n" - "\t\t[-m|--maxrows rows]\n" - "\t\t[--step seconds]\n" - "\t\t[--enumds]\n" - "\t\t[DEF:vname=rrd:ds-name:CF]\n" - "\t\t[CDEF:vname=rpn-expression]\n" "\t\t[XPORT:vname:legend]\n\n"); + "\trrdtool xport [-s|--start seconds] [-e|--end seconds]\n" + "\t\t[-m|--maxrows rows]\n" + "\t\t[--step seconds]\n" + "\t\t[--enumds]\n" + "\t\t[DEF:vname=rrd:ds-name:CF]\n" + "\t\t[CDEF:vname=rpn-expression]\n" + "\t\t[XPORT:vname:legend]\n\n"); char help_quit[] = - N_(" * quit - closing a session in remote mode\n\n" "\trrdtool quit\n\n"); + N_(" * quit - closing a session in remote mode\n\n" + "\trrdtool quit\n\n"); char help_ls[] = N_(" * ls - lists all *.rrd files in current directory\n\n" - "\trrdtool ls\n\n"); + "\trrdtool ls\n\n"); char help_cd[] = N_(" * cd - changes the current directory\n\n" - "\trrdtool cd new directory\n\n"); + "\trrdtool cd new directory\n\n"); char help_mkdir[] = N_(" * mkdir - creates a new directory\n\n" - "\trrdtool mkdir newdirectoryname\n\n"); + "\trrdtool mkdir newdirectoryname\n\n"); char help_pwd[] = N_(" * pwd - returns the current working directory\n\n" - "\trrdtool pwd\n\n"); + "\trrdtool pwd\n\n"); char help_lic[] = N_("RRDtool is distributed under the Terms of the GNU General\n" - "Public License Version 2. (www.gnu.org/copyleft/gpl.html)\n\n" - "For more information read the RRD manpages\n\n"); + "Public License Version 2. (www.gnu.org/copyleft/gpl.html)\n\n" + "For more information read the RRD manpages\n\n"); enum { C_NONE, C_CREATE, C_DUMP, C_INFO, C_RESTORE, C_LAST, C_LASTUPDATE, C_FIRST, C_UPDATE, C_FETCH, C_GRAPH, C_TUNE, @@ -263,8 +264,8 @@ void PrintUsage( else if (!strcmp(cmd, "pwd")) help_cmd = C_PWD; } - fprintf (stdout, _(help_main), PACKAGE_VERSION, __DATE__, __TIME__); - fflush (stdout); + fprintf(stdout, _(help_main), PACKAGE_VERSION, __DATE__, __TIME__); + fflush(stdout); switch (help_cmd) { case C_NONE: fputs(_(help_list), stdout); @@ -379,12 +380,12 @@ int main( fpsetmask(0); #endif #ifdef HAVE_LOCALE_H - setlocale (LC_ALL, ""); + setlocale(LC_ALL, ""); #endif #ifdef HAVE_LIBINTL_H - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); + bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); #endif if (argc == 1) { PrintUsage(""); @@ -740,10 +741,11 @@ int HandleInputLine( XML_ENCODING); printf("<%s>\n", ROOT_TAG); printf(" <%s>\n", META_TAG); - printf(" <%s>%lu\n", META_START_TAG, (unsigned long) start + step, - META_START_TAG); + printf(" <%s>%lu\n", META_START_TAG, + (unsigned long) start + step, META_START_TAG); printf(" <%s>%lu\n", META_STEP_TAG, step, META_STEP_TAG); - printf(" <%s>%lu\n", META_END_TAG, (unsigned long) end, META_END_TAG); + printf(" <%s>%lu\n", META_END_TAG, (unsigned long) end, + META_END_TAG); printf(" <%s>%lu\n", META_ROWS_TAG, row_cnt, META_ROWS_TAG); printf(" <%s>%lu\n", META_COLS_TAG, col_cnt,