Back out changes in 2.17.3:rateup.c disabling unit abbreviation.

Thu, 04 Oct 2012 20:08:55 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Oct 2012 20:08:55 +0200
changeset 711
e5faec28ec63
parent 710
1e46ce84435a
child 712
bf4f2bc90467

Back out changes in 2.17.3:rateup.c disabling unit abbreviation.
Even when properly specifying 'kMG', the weekly, monthly, and yearly
graphs would not include abbreviated (with kMG postfix) values but
instead a very long figure such as '12000000.0 k' in the short legend.
The daily graphs don't suffer this problem, more research is needed.

mrtg/mrtg.patch file | annotate | diff | comparison | revisions
mrtg/mrtg.spec file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mrtg/mrtg.patch	Thu Oct 04 20:08:55 2012 +0200
     1.3 @@ -0,0 +1,75 @@
     1.4 +--- src/rateup.c.orig	2011-12-01 17:06:48.000000000 +0100
     1.5 ++++ src/rateup.c	2011-02-20 23:33:38.000000000 +0100
     1.6 +@@ -115,6 +115,7 @@
     1.7 + char *longup = NULL;
     1.8 + char *shortup = NULL;
     1.9 + char *pngtitle = NULL;
    1.10 ++char *pngdate = NULL;
    1.11 + char *rtimezone = NULL;
    1.12 + char weekformat = 'V';		/* strftime() fmt char for week #  */
    1.13 + 
    1.14 +@@ -487,21 +488,13 @@
    1.15 +         {
    1.16 +           short_si_out = kMG;
    1.17 +           kMGnumber = 0;
    1.18 ++	  short_si[0] = kMG;
    1.19 +           while ((short_si_out = strchr (short_si_out, ',')) != NULL)
    1.20 + 	    {
    1.21 ++	      short_si_out[0] = '\0';
    1.22 + 	      short_si_out++;
    1.23 +-              kMGnumber++;
    1.24 ++              short_si[++kMGnumber] = short_si_out;
    1.25 + 	    }
    1.26 +-          short_si = calloc(kMGnumber + 1, sizeof(*short_si));
    1.27 +-          short_si_out = kMG;
    1.28 +-          for (kMGnumber = 0; ; kMGnumber++)
    1.29 +-            {
    1.30 +-              short_si[kMGnumber] = short_si_out;
    1.31 +-             short_si_out = strchr(short_si_out, ',');
    1.32 +-              if (short_si_out == NULL) break;
    1.33 +-              short_si_out[0] = '\0';
    1.34 +-              short_si_out++;
    1.35 +-            }
    1.36 +         }
    1.37 +      }
    1.38 +   
    1.39 +@@ -1115,9 +1108,9 @@
    1.40 + 		     currdatetimepos_x, currdatetimepos_y,
    1.41 + 		     (unsigned char *)currdatetimestr, i_grid);
    1.42 +     }
    1.43 +-
    1.44 +-  snprintf(file_tmp,1000,"%s.tmp_%lu",file,(unsigned long)getpid());
    1.45 +-
    1.46 ++  file_tmp[0]=0;
    1.47 ++  strncat(file_tmp,file,1000);
    1.48 ++  strncat(file_tmp,".tmp",1000);
    1.49 +   if ((fo = fopen (file_tmp, "wb")) == NULL)
    1.50 +     {
    1.51 +       perror (program);
    1.52 +@@ -1132,9 +1125,6 @@
    1.53 +   gdImageDestroy (brush_outp);
    1.54 +   free (lhist);
    1.55 +   free (graph_label);
    1.56 +-  if (kMG)
    1.57 +-    free(short_si);
    1.58 +-
    1.59 + 
    1.60 + #ifdef WIN32
    1.61 +   /* got to remove the target under win32
    1.62 +@@ -1402,7 +1392,7 @@
    1.63 + 	       (unsigned long) now);
    1.64 +       return;
    1.65 +     }
    1.66 +-  sprintf (buf, "%s.tmp_%lu", router,(unsigned long)getpid());
    1.67 ++  sprintf (buf, "%s.tmp", router);
    1.68 +   sprintf (buf1, "%s.log", router);
    1.69 +   sprintf (buf2, "%s.old", router);
    1.70 +   if ((lhist = calloc (1, sizeof (struct HISTORY) * (MAX_HISTORY + 1))) ==
    1.71 +@@ -1802,7 +1792,6 @@
    1.72 +   if (!(cbuf = fread (buff, 1, LENGTH_OF_BUFF, fp)))
    1.73 +     {
    1.74 +       fprintf (stderr, "%s, %s ERROR: Parameters file empty\n", bufftime, program);
    1.75 +-      fclose(fp);
    1.76 +       return (1);
    1.77 +     }
    1.78 +   fclose (fp);
     2.1 --- a/mrtg/mrtg.spec	Thu Oct 04 20:04:22 2012 +0200
     2.2 +++ b/mrtg/mrtg.spec	Thu Oct 04 20:08:55 2012 +0200
     2.3 @@ -40,6 +40,7 @@
     2.4  Source2:      rc.mrtg
     2.5  Source3:      uptime.pl
     2.6  Source4:      webstat.pl
     2.7 +Patch0:       mrtg.patch
     2.8  
     2.9  #   build information
    2.10  BuildPreReq:  OpenPKG, openpkg >= 20100101, perl, zlib, gd, png
    2.11 @@ -59,6 +60,7 @@
    2.12  
    2.13  %prep
    2.14      %setup -q
    2.15 +    %patch -p0
    2.16      %{l_shtool} subst \
    2.17          -e 's;mrtg2";mrtg";g' \
    2.18          -e "s;/usr\(/bin/perl\);%{l_prefix}\1;" \

mercurial