ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/saidar/saidar.c
(Generate patch)

Comparing projects/libstatgrab/src/saidar/saidar.c (file contents):
Revision 1.5 by pajs, Thu Oct 9 16:35:24 2003 UTC vs.
Revision 1.8 by pajs, Sat Oct 18 14:08:36 2003 UTC

# Line 205 | Line 205 | void display_data(){
205          diskio_stat_t *diskio_stat_ptr;
206          network_stat_t *network_stat_ptr;
207          disk_stat_t *disk_stat_ptr;
208 +        /* Size before it will start overwriting "uptime" */
209 +        char hostname[15];
210 +        char *ptr;
211  
212          move(0,12);
213 <        printw("%s", stats.general_stats->hostname);
213 >        strncpy(hostname, stats.general_stats->hostname, (sizeof(hostname) - 1));
214 >        /* strncpy does not NULL terminate.. If only strlcpy was on all platforms :) */
215 >        hostname[14] = '\0';
216 >        ptr=strchr(hostname, '.');
217 >        /* Some hosts give back a FQDN for hostname. To avoid this, we'll
218 >         * just blank out everything after the first "."
219 >         */
220 >        if (ptr != NULL){
221 >                *ptr = '\0';
222 >        }      
223 >        printw("%s", hostname);
224          move(0,36);
225          printw("%s", hr_uptime(stats.general_stats->uptime));
226          epoc_time=time(NULL);
# Line 247 | Line 260 | void display_data(){
260          printw("%5d", stats.user_stats->num_entries);
261  
262          /* Mem */
250
263          move(6, 12);
264          printw("%7s", size_conv(stats.mem_stats->total));      
265          move(7, 12);
# Line 315 | Line 327 | void display_data(){
327                  network_stat_ptr++;
328          }
329  
330 +        /* Disk */
331          disk_stat_ptr = stats.disk_stats;
332          for(counter=0;counter<stats.disk_entries;counter++){
333                  move(13+stats.network_entries+counter, 42);
# Line 322 | Line 335 | void display_data(){
335                  move(13+stats.network_entries+counter, 62);
336                  printw("%7s", size_conv(disk_stat_ptr->avail));
337                  move(13+stats.network_entries+counter, 73);
338 <                printw("%5.2f%%", 100.00 * ((float)disk_stat_ptr->used / (float)disk_stat_ptr->size));
338 >                printw("%5.2f%%", 100.00 * ((float) (disk_stat_ptr->size - disk_stat_ptr->avail) / (float) disk_stat_ptr->size));
339                  disk_stat_ptr++;
340          }
341  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines