'uutraf' - better (?) format
Bud Hovell
bbh at whizz.uucp
Tue Nov 14 06:23:15 AEST 1989
We are using the 'uutraf' program recently provided by Greg Hackney
<hack at texbell>, and like it very well. I did make a few minor changes
to the format, which (IMJHO):
1. Improves overall appearance and balance of the output.
2. Reduces the somewhat excessive level of precision in
some items, in preference to improved readability.
3. Changes some terminology, and eliminates some of the minor
inconsistencies of labeling in the original.
All *very* tiny flaws - hardly even big enough to call "nits" (Jan :-)
Other than format changes (plus a patch recently posted to handle an
overlooked initialization), no other alterations were made to the
original code.
Judge for yourself - patch follows after this example:
Remote -----------K-Bytes----------- ----Hours---- --Avg CPS-- --Files--
Host Recv Sent Total Recv Sent Recv Sent Recv Sent
------ --------- --------- --------- ------ ------ ----- ----- ---- ----
site-a 932.2 0.9 933.1 2.5 0.0 104 98 46 2
site-b 3.7 859.3 862.9 0.0 2.2 77 110 7 42
site-c 0.0 51.4 51.4 0.0 0.1 0 110 0 2
site-d 31.2 6.9 38.1 0.1 0.0 100 131 16 18
site-e 26.9 7.0 33.9 0.1 0.0 89 110 34 4
site-f 0.0 27.7 27.7 0.0 0.1 0 113 0 16
-------------SUMMARY-------------
Total active uucp sites: 6
Total files recv: 103
Total files sent: 84
Total files: 187
Total hours recv: 2.7
Total hours sent: 2.4
Total hours: 5.1
Total K-bytes recv: 994
Total K-bytes sent: 953
Total K-bytes: 1,947
------- chop -------------------- chop ---------------------- chop --------
*** uutraf.c.orig Mon Nov 13 08:56:36 1989
--- uutraf.c Mon Nov 13 10:11:40 1989
***************
*** 257,263
printrun()
{
LINK *work;
! int count;
printf("%-8s ", "Remote");
printf("%9s ", "K-Bytes");
--- 257,263 -----
printrun()
{
LINK *work;
! int count = 0;
printf("%-8s ", "\nRemote ");
printf("%26s ", "-----------K-Bytes-----------");
***************
*** 259,274
LINK *work;
int count;
! printf("%-8s ", "Remote");
! printf("%9s ", "K-Bytes");
! printf("%9s ", "K-Bytes");
! printf("%9s ", "K-Bytes");
! printf("%6s ", "Hours");
! printf("%6s ", "Hours");
! printf("%5s ", "AvCPS");
! printf("%5s ", "AvCPS");
! printf("%4s ", "#");
! printf("%4s\n", "#");
printf("%-8s ", "SiteName");
printf("%9s ", "Recv");
--- 259,269 -----
LINK *work;
int count = 0;
! printf("%-8s ", "\nRemote ");
! printf("%26s ", "-----------K-Bytes-----------");
! printf("%12s ", "----Hours----");
! printf("%10s ", "--Avg CPS--");
! printf("%8s ", "--Files--\n");
printf("%-7s ", "Host ");
printf("%9s ", "Recv");
***************
*** 270,276
printf("%4s ", "#");
printf("%4s\n", "#");
! printf("%-8s ", "SiteName");
printf("%9s ", "Recv");
printf("%9s ", "Xmit");
printf("%9s ", "Total");
--- 265,271 -----
printf("%10s ", "--Avg CPS--");
printf("%8s ", "--Files--\n");
! printf("%-7s ", "Host ");
printf("%9s ", "Recv");
printf("%9s ", "Sent");
printf("%9s ", "Total");
***************
*** 272,278
printf("%-8s ", "SiteName");
printf("%9s ", "Recv");
! printf("%9s ", "Xmit");
printf("%9s ", "Total");
printf("%6s ", "Recv");
printf("%6s ", "Xmit");
--- 267,273 -----
printf("%-7s ", "Host ");
printf("%9s ", "Recv");
! printf("%9s ", "Sent");
printf("%9s ", "Total");
printf("%6s ", "Recv");
printf("%6s ", "Sent");
***************
*** 275,281
printf("%9s ", "Xmit");
printf("%9s ", "Total");
printf("%6s ", "Recv");
! printf("%6s ", "Xmit");
printf("%5s ", "Recv");
printf("%5s ", "Xmit");
printf("%4s ", "Recv");
--- 270,276 -----
printf("%9s ", "Sent");
printf("%9s ", "Total");
printf("%6s ", "Recv");
! printf("%6s ", "Sent");
printf("%5s ", "Recv");
printf("%5s ", "Sent");
printf("%4s ", "Recv");
***************
*** 277,283
printf("%6s ", "Recv");
printf("%6s ", "Xmit");
printf("%5s ", "Recv");
! printf("%5s ", "Xmit");
printf("%4s ", "Recv");
printf("%4s\n", "Xmit");
--- 272,278 -----
printf("%6s ", "Recv");
printf("%6s ", "Sent");
printf("%5s ", "Recv");
! printf("%5s ", "Sent");
printf("%4s ", "Recv");
printf("%4s\n", "Sent");
***************
*** 279,285
printf("%5s ", "Recv");
printf("%5s ", "Xmit");
printf("%4s ", "Recv");
! printf("%4s\n", "Xmit");
printf("%s ", "--------");
printf("%s ", "---------");
--- 274,280 -----
printf("%5s ", "Recv");
printf("%5s ", "Sent");
printf("%4s ", "Recv");
! printf("%4s\n", "Sent");
printf("%s ", "------ ");
printf("%s ", "---------");
***************
*** 281,287
printf("%4s ", "Recv");
printf("%4s\n", "Xmit");
! printf("%s ", "--------");
printf("%s ", "---------");
printf("%s ", "---------");
printf("%s ", "---------");
--- 276,282 -----
printf("%4s ", "Recv");
printf("%4s\n", "Sent");
! printf("%s ", "------ ");
printf("%s ", "---------");
printf("%s ", "---------");
printf("%s ", "---------");
***************
*** 297,303
strncpy(buf, work->sysname, 9);
buf[9]='\0';
printf("%-9s", buf);
! sprintf(buf, "%.3f", work->recv / 1000);
printf("%9s ", buf);
sprintf(buf, "%.3f", work->xmit / 1000);
printf("%9s ", buf);
--- 292,298 -----
strncpy(buf, work->sysname, 9);
buf[9]='\0';
printf("%-9s", buf);
! sprintf(buf, "%.1f", work->recv / 1000);
printf("%9s ", buf);
sprintf(buf, "%.1f", work->xmit / 1000);
printf("%9s ", buf);
***************
*** 299,305
printf("%-9s", buf);
sprintf(buf, "%.3f", work->recv / 1000);
printf("%9s ", buf);
! sprintf(buf, "%.3f", work->xmit / 1000);
printf("%9s ", buf);
sprintf(buf, "%.3f", (work->xmit + work->recv) / 1000);
printf("%9s ", buf);
--- 294,300 -----
printf("%-9s", buf);
sprintf(buf, "%.1f", work->recv / 1000);
printf("%9s ", buf);
! sprintf(buf, "%.1f", work->xmit / 1000);
printf("%9s ", buf);
sprintf(buf, "%.1f", (work->xmit + work->recv) / 1000);
printf("%9s ", buf);
***************
*** 301,307
printf("%9s ", buf);
sprintf(buf, "%.3f", work->xmit / 1000);
printf("%9s ", buf);
! sprintf(buf, "%.3f", (work->xmit + work->recv) / 1000);
printf("%9s ", buf);
sprintf(buf, "%.2f", work->recv_time / 3600);
printf("%6s ", buf);
--- 296,302 -----
printf("%9s ", buf);
sprintf(buf, "%.1f", work->xmit / 1000);
printf("%9s ", buf);
! sprintf(buf, "%.1f", (work->xmit + work->recv) / 1000);
printf("%9s ", buf);
sprintf(buf, "%.1f", work->recv_time / 3600);
printf("%6s ", buf);
***************
*** 303,309
printf("%9s ", buf);
sprintf(buf, "%.3f", (work->xmit + work->recv) / 1000);
printf("%9s ", buf);
! sprintf(buf, "%.2f", work->recv_time / 3600);
printf("%6s ", buf);
sprintf(buf, "%.2f", work->xmit_time / 3600);
printf("%6s ", buf);
--- 298,304 -----
printf("%9s ", buf);
sprintf(buf, "%.1f", (work->xmit + work->recv) / 1000);
printf("%9s ", buf);
! sprintf(buf, "%.1f", work->recv_time / 3600);
printf("%6s ", buf);
sprintf(buf, "%.1f", work->xmit_time / 3600);
printf("%6s ", buf);
***************
*** 305,311
printf("%9s ", buf);
sprintf(buf, "%.2f", work->recv_time / 3600);
printf("%6s ", buf);
! sprintf(buf, "%.2f", work->xmit_time / 3600);
printf("%6s ", buf);
if (work->recv_time != 0.0) { /* divide by zero ? */
sprintf(buf, "%5.0f", work->recv / work->recv_time);
--- 300,306 -----
printf("%9s ", buf);
sprintf(buf, "%.1f", work->recv_time / 3600);
printf("%6s ", buf);
! sprintf(buf, "%.1f", work->xmit_time / 3600);
printf("%6s ", buf);
if (work->recv_time != 0.0) { /* divide by zero ? */
sprintf(buf, "%5.0f", work->recv / work->recv_time);
***************
*** 324,331
work = work->next;
}
/* summary statement at the end */
! printf("\n-----<Summary>-----\n");
! printf("Total active uucp sites: ");
sprintf(buf,"%d",count); comma_fy();
printf("%8s\n\n",buf);
--- 319,326 -----
work = work->next;
}
/* summary statement at the end */
! printf("\n -------------SUMMARY-------------\n");
! printf(" Total active uucp sites:");
sprintf(buf,"%d",count); comma_fy();
printf("%7s\n",buf);
***************
*** 327,333
printf("\n-----<Summary>-----\n");
printf("Total active uucp sites: ");
sprintf(buf,"%d",count); comma_fy();
! printf("%8s\n\n",buf);
/* total files */
printf("Total files rec'd: ");
--- 322,328 -----
printf("\n -------------SUMMARY-------------\n");
printf(" Total active uucp sites:");
sprintf(buf,"%d",count); comma_fy();
! printf("%7s\n",buf);
/* total files */
printf(" Total files recv: ");
***************
*** 330,336
printf("%8s\n\n",buf);
/* total files */
! printf("Total files rec'd: ");
sprintf(buf,"%ld",num_recv); comma_fy();
printf("%15s\n",buf);
printf("Total files xmit: ");
--- 325,331 -----
printf("%7s\n",buf);
/* total files */
! printf(" Total files recv: ");
sprintf(buf,"%ld",num_recv); comma_fy();
printf("%12s\n",buf);
printf(" Total files sent: ");
***************
*** 332,339
/* total files */
printf("Total files rec'd: ");
sprintf(buf,"%ld",num_recv); comma_fy();
! printf("%15s\n",buf);
! printf("Total files xmit: ");
sprintf(buf,"%ld",num_xmit); comma_fy();
printf("%15s\n",buf);
printf("Total files: ");
--- 327,334 -----
/* total files */
printf(" Total files recv: ");
sprintf(buf,"%ld",num_recv); comma_fy();
! printf("%12s\n",buf);
! printf(" Total files sent: ");
sprintf(buf,"%ld",num_xmit); comma_fy();
printf("%12s\n",buf);
printf(" Total files: ");
***************
*** 335,342
printf("%15s\n",buf);
printf("Total files xmit: ");
sprintf(buf,"%ld",num_xmit); comma_fy();
! printf("%15s\n",buf);
! printf("Total files: ");
sprintf(buf,"%ld",num_xmit + num_recv); comma_fy();
printf("%15s\n\n",buf);
--- 330,337 -----
printf("%12s\n",buf);
printf(" Total files sent: ");
sprintf(buf,"%ld",num_xmit); comma_fy();
! printf("%12s\n",buf);
! printf(" Total files: ");
sprintf(buf,"%ld",num_xmit + num_recv); comma_fy();
printf("%12s\n",buf);
***************
*** 338,344
printf("%15s\n",buf);
printf("Total files: ");
sprintf(buf,"%ld",num_xmit + num_recv); comma_fy();
! printf("%15s\n\n",buf);
/* total time */
printf("Total hours in recv: ");
--- 333,339 -----
printf("%12s\n",buf);
printf(" Total files: ");
sprintf(buf,"%ld",num_xmit + num_recv); comma_fy();
! printf("%12s\n",buf);
/* total time */
printf(" Total hours recv: ");
***************
*** 341,355
printf("%15s\n\n",buf);
/* total time */
! printf("Total hours in recv: ");
! sprintf(buf,"%.2f",sec_recv / 3600);
! printf("%14s\n",buf);
! printf("Total hours in xmit: ");
! sprintf(buf,"%.2f",sec_xmit / 3600);
! printf("%14s\n",buf);
! printf("Total modem hours: ");
! sprintf(buf,"%.2f",(sec_recv + sec_xmit) / 3600);
! printf("%15s\n\n",buf);
/* total bytes */
printf("Total bytes rec'd: ");
--- 336,350 -----
printf("%12s\n",buf);
/* total time */
! printf(" Total hours recv: ");
! sprintf(buf,"%.1f",sec_recv / 3600);
! printf("%12s\n",buf);
! printf(" Total hours sent: ");
! sprintf(buf,"%.1f",sec_xmit / 3600);
! printf("%12s\n",buf);
! printf(" Total hours: ");
! sprintf(buf,"%.1f",(sec_recv + sec_xmit) / 3600);
! printf("%12s\n",buf);
/* total bytes */
printf(" Total K-bytes recv: ");
***************
*** 352,366
printf("%15s\n\n",buf);
/* total bytes */
! printf("Total bytes rec'd: ");
! sprintf(buf,"%.0f",bytes_recv); comma_fy();
! printf("%15s\n",buf);
! printf("Total bytes xmit: ");
! sprintf(buf,"%.0f",bytes_xmit); comma_fy();
! printf("%15s\n",buf);
! printf("Total bytes: ");
! sprintf(buf,"%.0f",bytes_xmit + bytes_recv); comma_fy();
! printf("%15s\n\n",buf);
}
--- 347,361 -----
printf("%12s\n",buf);
/* total bytes */
! printf(" Total K-bytes recv: ");
! sprintf(buf,"%.0f",bytes_recv / 1000); comma_fy();
! printf("%10s\n",buf);
! printf(" Total K-bytes sent: ");
! sprintf(buf,"%.0f",bytes_xmit / 1000); comma_fy();
! printf("%10s\n",buf);
! printf(" Total K-bytes: ");
! sprintf(buf,"%.0f",(bytes_xmit + bytes_recv) / 1000); comma_fy();
! printf("%10s\n\n",buf);
}
***************
*** 481,484
fprintf(stderr,"%s\n",usage);
exit(1);
}
-
--- 476,478 -----
fprintf(stderr,"%s\n",usage);
exit(1);
}
Bud
________________________________________________________________________
UUCP: ...{tektronix|sun}!nosun!whizz!bbh (Just another unix pilgrim :-)
MOTD: "Capitalism is the exploitation of man by man.
Communism is just the opposite." - Soviet comedian.
More information about the Alt.sources
mailing list