georgemarselis / openlava-macosx

Automatically exported from code.google.com/p/openlava-macosx
GNU General Public License v2.0
1 stars 0 forks source link

struct indexFmt : what is that last NULL for? investigate #237

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Problem:

lshosts.c:

struct indexFmt : what is that last NULL for? investigate

 49 struct indexFmt fmt1[] = {
 50   {"r15s", "%6s", "*%4.1f", "%5.1f", 1.0},
 51   {"r1m", "%6s", "*%4.1f", "%5.1f", 1.0},
 52   {"r15m", "%6s", "*%4.1f", "%5.1f", 1.0},
 53   {"ut", "%5s", "*%3.0f%%", "%3.0f%%", 100.0},
 54   {"pg", "%6s", "*%4.1f", "%4.1f", 1.0},
 55   {"io", "%6s", "*%4.0f", "%4.0f", 1.0},
 56   {"ls", "%5s", "*%2.0f", "%2.0f", 1.0},
 57   {"it", "%5s", "*%3.0f", "%4.0f", 1.0},
 58   {"tmp", "%6s", "*%4.0fM", "%4.0fM", 1.0},
 59   {"swp", "%6s", "*%3.0fM", "%4.0fM", 1.0},
 60   {"mem", "%6s", "*%3.0fM", "%4.0fM", 1.0},
 61   {"dflt", "%7s", "*%6.1f", "%6.1f", 1.0},
 62   {NULL, "%7s", "*%6.1f", " %6.1f", 1.0}
 63 }, *fmt;

How to it: 

Re-write print_long; unroll struct indexFmt, into individual sprintf statemnts

or

prepare a buffer with the output beforehand, print.

Original issue reported on code.google.com by geo...@marsel.is on 12 Aug 2014 at 11:21