home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / comm / graphic_.dif < prev    next >
Encoding:
Text File  |  1993-02-17  |  13.2 KB  |  592 lines

  1. diff -cNr czmodem/Makefile zmodem/Makefile
  2. *** czmodem/Makefile    Sun Dec 15 15:35:56 1991
  3. --- zmodem/Makefile    Fri Oct  2 14:08:36 1992
  4. ***************
  5. *** 1,7 ****
  6.   # Makefile for Unix/Xenix rz and sz programs
  7.   # the makefile is not too well tested yet
  8. ! CC=cc
  9. ! OFLAG= -O
  10.   
  11.   
  12.   ARCFILES= README rbsb.c gz *.t minirb.c zmodem.h \
  13. --- 1,7 ----
  14.   # Makefile for Unix/Xenix rz and sz programs
  15.   # the makefile is not too well tested yet
  16. ! CC=gcc
  17. ! OFLAG= -O6 -w -DHVM -DMODEM=\"/dev/ttys1\"
  18.   
  19.   
  20.   ARCFILES= README rbsb.c gz *.t minirb.c zmodem.h \
  21. ***************
  22. *** 88,133 ****
  23.   
  24.   .PRECIOUS:rz sz
  25.   
  26. ! xenix:
  27. !     $(CC) $(CFLAGS) $(OFLAG) -M0 -K -i -DTXBSIZE=16384 -DNFGVMIN -DREADCHECK sz.c -lx -o sz
  28. !     size sz
  29. !     -ln sz sb
  30. !     -ln sz sx
  31. !     -ln sz zcommand
  32. !     -ln sz zcommandi
  33. !     $(CC) $(CFLAGS) $(OFLAG) -M0 -K -i -DMD rz.c -o rz
  34. !     size rz
  35. !     -ln rz rb
  36. !     -ln rz rx
  37. !     -ln rz rc
  38. ! x386:
  39. !     $(CC) $(CFLAGS) $(OFLAG) -DMD rz.c -o rz
  40. !     size rz
  41. !     -ln rz rb
  42. !     -ln rz rx
  43. !     $(CC) $(CFLAGS) $(OFLAG) -DTXBSIZE=32768 -DNFGVMIN -DREADCHECK sz.c -lx -o sz
  44. !     size sz
  45. !     -ln sz sb
  46. !     -ln sz sx
  47. !     -ln sz zcommand
  48. !     -ln sz zcommandi
  49. ! sysv:
  50. !     $(CC) $(CFLAGS) $(OFLAG) -DMD rz.c -o rz
  51. !     size rz
  52. !     -ln rz rb
  53. !     -ln rz rx
  54. !     -ln rz rc
  55. !     $(CC) $(CFLAGS) $(OFLAG) -DSV -DTXBSIZE=32768 -DNFGVMIN sz.c -o sz
  56. !     size sz
  57. !     -ln sz sb
  58. !     -ln sz sx
  59. !     -ln sz zcommand
  60. !     -ln sz zcommandi
  61. ! sysvr3:
  62. !     $(CC) $(CFLAGS) $(OFLAG) -DMD=2 rz.c -o rz
  63.       size rz
  64.       -ln rz rb
  65.       -ln rz rx
  66. --- 88,94 ----
  67.   
  68.   .PRECIOUS:rz sz
  69.   
  70. ! sysvr3: rz
  71.       size rz
  72.       -ln rz rb
  73.       -ln rz rx
  74. ***************
  75. *** 139,224 ****
  76.       -ln sz zcommand
  77.       -ln sz zcommandi
  78.   
  79. - sysvr4:
  80. -     $(CC) $(CFLAGS) $(OFLAG) -DMD=2 rz.c -o rz
  81. -     size rz
  82. -     -ln rz rb
  83. -     -ln rz rx
  84. -     -ln rz rc
  85. -     $(CC) $(CFLAGS) $(OFLAG) -DSV -DTXBSIZE=32768 sz.c -o sz
  86. -     size sz
  87. -     -ln sz sb
  88. -     -ln sz sx
  89. -     -ln sz zcommand
  90. -     -ln sz zcommandi
  91. - odt:
  92. -     cc -Za -n -DMD=2 rz.c -o rz
  93. -     size rz
  94. -     -ln rz rb
  95. -     -ln rz rx
  96. -     -ln rz rc
  97. -     cc -Za -n -DSV -DTXBSIZE=32768 sz.c -o sz
  98. -     size sz
  99. -     -ln sz sb
  100. -     -ln sz sx
  101. -     -ln sz zcommand
  102. -     -ln sz zcommandi
  103. - bsd:
  104. -     $(CC) $(CFLAGS) $(OFLAG) -DMD=2 -Dstrchr=index -DV7 rz.c -o rz
  105. -     size rz
  106. -     -ln rz rb
  107. -     -ln rz rx
  108. -     -ln rz rc
  109. -     $(CC) $(CFLAGS) $(OFLAG) -DV7 -DTXBSIZE=32768 -DNFGVMIN sz.c -o sz
  110. -     size sz
  111. -     -ln sz sb
  112. -     -ln sz sx
  113. -     -ln sz zcommand
  114. -     -ln sz zcommandi
  115. - tandy:
  116. -     $(CC) $(CFLAGS) $(OFLAGS) -n -DMD -DT6K sz.c -lx -o sz
  117. -     size sz
  118. -     -ln sz sb
  119. -     -ln sz sx
  120. -     -ln sz zcommand
  121. -     -ln sz zcommandi
  122. -     $(CC) $(CFLAGS) $(OFLAGS) -n -DMD -DT6K rz.c -lx -o rz
  123. -     size rz
  124. -     -ln rz rb
  125. -     -ln rz rx
  126. -     -ln rz rc
  127.   
  128. ! dnix:
  129. !     $(CC) $(CFLAGS) $(OFLAG) -DMD rz.c -o rz
  130. !     size rz
  131. !     -ln rz rb
  132. !     -ln rz rx
  133. !     -ln rz rc
  134. !     $(CC) $(CFLAGS) $(OFLAG) -DSV -DTXBSIZE=32768 -DNFGVMIN -DREADCHECK sz.c -o sz
  135. !     size sz
  136. !     -ln sz sb
  137. !     -ln sz sx
  138. !     -ln sz zcommand
  139. !     -ln sz zcommandi
  140.   
  141. ! dnix5r3:
  142. !     $(CC) $(CFLAGS) $(OFLAG) -DMD=2 rz.c -o rz
  143. !     size rz
  144. !     -ln rz rb
  145. !     -ln rz rx
  146. !     -ln rz rc
  147. !     $(CC) $(CFLAGS) $(OFLAG) -DSV -DTXBSIZE=32768 -DNFGVMIN -DREADCHECK sz.c -o sz
  148. !     size sz
  149. !     -ln sz sb
  150. !     -ln sz sx
  151. !     -ln sz zcommand
  152. !     -ln sz zcommandi
  153.   
  154.   
  155.   sz: nothing
  156.   sb: nothing
  157. - rz: nothing
  158.   rb: nothing
  159. --- 100,117 ----
  160.       -ln sz zcommand
  161.       -ln sz zcommandi
  162.   
  163.   
  164. ! rz: rz.o show_info.o
  165. !     $(CC) $(CFLAGS) $(OFLAG) -o rz rz.o show_info.o -lcurses -ltermcap
  166. ! #    install -c -s rz /usr/bin
  167.   
  168. ! rz.o: rz.c rbsb.c
  169. !     $(CC) $(CFLAGS) $(OFLAG) -DDSZ -DMD=2 -c rz.c
  170.   
  171. + show_info.o: show_info.c
  172. +     $(CC) $(CFLAGS) $(OFLAG) -c show_info.c
  173.   
  174.   sz: nothing
  175.   sb: nothing
  176.   rb: nothing
  177. diff -cNr czmodem/rbsb.c zmodem/rbsb.c
  178. *** czmodem/rbsb.c    Wed Oct 30 19:59:16 1991
  179. --- zmodem/rbsb.c    Thu Oct  1 17:23:21 1992
  180. ***************
  181. *** 336,345 ****
  182.   /* Initialize tty device for serial file xfer */
  183.   inittty()
  184.   {
  185. !     Tty = open("/dev/tty", 2);
  186.       if (Tty < 0) {
  187. !         perror("/dev/tty");  exit(2);
  188.       }
  189.       Ttystream = fdopen(Tty, "w");
  190.       setbuf(Ttystream, xXbuf);        
  191.   }
  192. --- 336,349 ----
  193.   /* Initialize tty device for serial file xfer */
  194.   inittty()
  195.   {
  196. ! #ifdef HVM
  197. !     Tty = open(MODEM, 2);
  198.       if (Tty < 0) {
  199. !         perror(MODEM);  exit(2);
  200.       }
  201. + #else
  202. +     Tty = 1;
  203. + #endif
  204.       Ttystream = fdopen(Tty, "w");
  205.       setbuf(Ttystream, xXbuf);        
  206.   }
  207. ***************
  208. *** 387,393 ****
  209.   #endif
  210.           Lleft = 0;
  211.           if (Verbose>1)
  212. !             fprintf(stderr, "Readline:TIMEOUT\n");
  213.           return TIMEOUT;
  214.       }
  215.       signal(SIGALRM, alrm); alarm(n);
  216. --- 391,397 ----
  217.   #endif
  218.           Lleft = 0;
  219.           if (Verbose>1)
  220. !             zmessage("Readline:TIMEOUT");
  221.           return TIMEOUT;
  222.       }
  223.       signal(SIGALRM, alrm); alarm(n);
  224. diff -cNr czmodem/rz.c zmodem/rz.c
  225. *** czmodem/rz.c    Wed Oct 30 19:57:48 1991
  226. --- zmodem/rz.c    Fri Oct  2 13:37:12 1992
  227. ***************
  228. *** 63,72 ****
  229.   
  230.   
  231.   #define LOGFILE "/tmp/rzlog"
  232. ! #include <stdio.h>
  233.   #include <signal.h>
  234.   #include <ctype.h>
  235.   #include <errno.h>
  236.   extern int errno;
  237.   FILE *popen();
  238.   
  239. --- 63,73 ----
  240.   
  241.   
  242.   #define LOGFILE "/tmp/rzlog"
  243. ! #include <curses.h>
  244.   #include <signal.h>
  245.   #include <ctype.h>
  246.   #include <errno.h>
  247. + #include <sys/times.h>
  248.   extern int errno;
  249.   FILE *popen();
  250.   
  251. ***************
  252. *** 133,143 ****
  253. --- 134,152 ----
  254.   int errors;
  255.   int Restricted=0;    /* restricted; no /.. or ../ in filenames */
  256.   
  257. + #define TDIS 30
  258. + long btime, ttime;
  259. + char sdummy[80];
  260. + struct tms tdummy;
  261. + WINDOW *win, *bwin;
  262. + char version[15]="version 0.2";
  263.   #define DEFBYTL 2000000000L    /* default rx file size */
  264.   long Bytesleft;        /* number of bytes of incoming file left */
  265.   long Modtime;        /* Unix style mod time for incoming file */
  266.   int Filemode;        /* Unix style mode for incoming file */
  267.   long Totalleft;
  268. + long GTotalleft = 0;
  269.   long Filesleft;
  270.   char Pathname[PATHLEN];
  271.   char *Progname;        /* the name by which we were called */
  272. ***************
  273. *** 172,178 ****
  274.   
  275.   int tryzhdrtype=ZRINIT;    /* Header type to send corresponding to Last rx close */
  276.   
  277.   /* called by signal interrupt or terminate to clean things up */
  278.   bibi(n)
  279.   {
  280. --- 181,186 ----
  281. ***************
  282. *** 246,257 ****
  283.       if (Batch && npats)
  284.           usage();
  285.       if (Verbose) {
  286.           if (freopen(LOGFILE, "a", stderr)==NULL) {
  287.               printf("Can't open log file %s\n",LOGFILE);
  288.               exit(2);
  289.           }
  290.           setbuf(stderr, NULL);
  291. !         fprintf(stderr, "argv[0]=%s Progname=%s\n", virgin, Progname);
  292.       }
  293.       vfile("%s %s for %s\n", Progname, VERSION, OS);
  294.       mode(1);
  295. --- 254,276 ----
  296.       if (Batch && npats)
  297.           usage();
  298.       if (Verbose) {
  299. + #ifndef HVM
  300.           if (freopen(LOGFILE, "a", stderr)==NULL) {
  301.               printf("Can't open log file %s\n",LOGFILE);
  302.               exit(2);
  303.           }
  304. + #endif
  305.           setbuf(stderr, NULL);
  306. !         initscr();
  307. !         win = newwin(18, 54, 4, 12);
  308. !         bwin = newwin(18, 55, 4, 12);
  309. !         leaveok(win, FALSE);
  310. ! /*        cbreak();*/
  311. !         noecho();
  312. !         nonl();
  313. !         mvwprintw(win, 13, 10, "argv[0]=%s Progname=%s\n", virgin, Progname);
  314.       }
  315.       vfile("%s %s for %s\n", Progname, VERSION, OS);
  316.       mode(1);
  317. ***************
  318. *** 271,278 ****
  319.           canit();
  320.       if (endmsg[0])
  321.           printf("  %s: %s\r\n", Progname, endmsg);
  322. !     printf("%s %s finished.\r\n", Progname, VERSION);
  323.       fflush(stdout);
  324.       exit(exitcode != 0);
  325.   }
  326.   
  327. --- 290,301 ----
  328.           canit();
  329.       if (endmsg[0])
  330.           printf("  %s: %s\r\n", Progname, endmsg);
  331. !     zmessage("Transfer complete");
  332.       fflush(stdout);
  333. +     wrefresh(win);
  334. +     move(1, 1);
  335. +     refresh();
  336. +     endwin();
  337.       exit(exitcode != 0);
  338.   }
  339.   
  340. ***************
  341. *** 311,317 ****
  342.   
  343.       if (Batch || argc==0) {
  344.           Crcflg=1;
  345. !         fprintf(stderr, rbmsg, Progname, Nozmodem?"sb":"sz");
  346.           if (c=tryz()) {
  347.               if (c == ZCOMPL)
  348.                   return OK;
  349. --- 334,341 ----
  350.   
  351.       if (Batch || argc==0) {
  352.           Crcflg=1;
  353. !         sprintf(sdummy, rbmsg, Progname, Nozmodem?"sb":"sz");
  354. !         zmessage(sdummy);
  355.           if (c=tryz()) {
  356.               if (c == ZCOMPL)
  357.                   return OK;
  358. ***************
  359. *** 574,586 ****
  360.           sscanf(p, "%ld%lo%o%lo%d%ld%d%d",
  361.             &Bytesleft, &Modtime, &Filemode,
  362.             &dummy, &Filesleft, &Totalleft, &dummy, &dummy);
  363.           if (Filemode & UNIXFILE)
  364.               ++Thisbinary;
  365. -         if (Verbose) {
  366. -             fprintf(stderr,  "Incoming: %s %ld %lo %o\n",
  367. -               name, Bytesleft, Modtime, Filemode);
  368. -             fprintf(stderr,  "YMODEM header: %s\n", p);
  369. -         }
  370.       }
  371.   
  372.   
  373. --- 598,607 ----
  374.           sscanf(p, "%ld%lo%o%lo%d%ld%d%d",
  375.             &Bytesleft, &Modtime, &Filemode,
  376.             &dummy, &Filesleft, &Totalleft, &dummy, &dummy);
  377. +         if (GTotalleft < Totalleft)
  378. +           GTotalleft = Totalleft;
  379.           if (Filemode & UNIXFILE)
  380.               ++Thisbinary;
  381.       }
  382.   
  383.   
  384. ***************
  385. *** 811,821 ****
  386.   zperr(s,p,u)
  387.   char *s, *p, *u;
  388.   {
  389.       if (Verbose <= 0)
  390.           return;
  391. !     fprintf(stderr, "Retry %d: ", errors);
  392. !     fprintf(stderr, s, p, u);
  393. !     fprintf(stderr, "\n");
  394.   }
  395.   
  396.   report(sct)
  397. --- 832,845 ----
  398.   zperr(s,p,u)
  399.   char *s, *p, *u;
  400.   {
  401. +   char sdummy2[80];
  402. +   
  403.       if (Verbose <= 0)
  404.           return;
  405. !   sprintf(sdummy, "Retry %d: ", errors);
  406. !   sprintf(sdummy2, s, p, u);
  407. !   strcat(sdummy, sdummy2);
  408. !   zmessage(sdummy);
  409.   }
  410.   
  411.   report(sct)
  412. ***************
  413. *** 988,993 ****
  414. --- 1012,1019 ----
  415.   {
  416.       register c;
  417.   
  418. +     ttime = times(&tdummy);
  419.       for (;;) {
  420.           switch (c = rzfile()) {
  421.           case ZEOF:
  422. ***************
  423. *** 1016,1029 ****
  424. --- 1042,1099 ----
  425.   rzfile()
  426.   {
  427.       register c, n;
  428. +     char Fname[40];
  429.   
  430.       Eofseen=FALSE;
  431.       n = 20; rxbytes = 0l;
  432.   
  433. +     btime = times(&tdummy);
  434. +     wclear(win);
  435. + /*    box(bwin, '|', '-');*/
  436. +     box(bwin, '.', '.');
  437. +     zmessage("Waiting for file");    
  438. +     wrefresh(win);
  439. +     wrefresh(bwin);
  440.       if (c = procheader(secbuf)) {
  441.           return (tryzhdrtype = c);
  442.       }
  443.   
  444. +     if (strlen(secbuf) > 14) {
  445. +       strncpy(Fname, secbuf, 11);
  446. +       Fname[11] = NULL;
  447. +       strcat(Fname, "...");
  448. +     }
  449. +     else
  450. +       strcpy(Fname, secbuf);
  451. +     mvwprintw(win, 1, 2, "This File: %s", Fname);
  452. +     mvwaddstr(win, 2, 4, "Received:");
  453. +     mvwprintw(win, 3, 4, "Expected: %dk", Bytesleft/1024);
  454. +     mvwaddstr(win, 4, 4, "Percent :");
  455. +     mvwaddstr(win, 5, 4, "T. Elpsd:");
  456. +     mvwaddstr(win, 6, 4, "T. Left :");
  457. +     mvwaddstr(win, 7, 4, "Thruput :");
  458. +     mvwaddstr(win, 16, 2, "Messages:");
  459. +     mvwprintw(win, 1, TDIS+2, "Total: %d files left", Filesleft);
  460. +     mvwaddstr(win, 2, TDIS+4, "Received:");
  461. +     mvwprintw(win, 3, TDIS+4, "Expected: %dk", GTotalleft/1024);
  462. +     mvwaddstr(win, 4, TDIS+4, "Percent :");
  463. +     mvwaddstr(win, 5, TDIS+4, "T. Elpsd:");
  464. +     mvwaddstr(win, 6, TDIS+4, "T. Left :");
  465. +     mvwaddstr(win, 7, TDIS+4, "Thruput :");
  466. +     
  467. +     mvwaddstr(win, 9, 2, "This File:");
  468. +     mvwaddstr(win, 10, 2, "+-----------+------------+------------+-----------+");
  469. +     mvwaddstr(win, 11, 2, "0%         25%          50%          75%       100%");
  470. +     mvwaddstr(win, 12, 2, "Total:");
  471. +     mvwaddstr(win, 13, 2, "+-----------+------------+------------+-----------+");
  472. +     mvwaddstr(win, 14, 2, "0%         25%          50%          75%       100%");
  473. +     wmove(win, 1, 1);
  474. +     wrefresh(win);
  475.       for (;;) {
  476.   #ifdef SEGMENTS
  477.           chinseg = 0;
  478. ***************
  479. *** 1120,1127 ****
  480.               }
  481.   moredata:
  482.               if (Verbose>1)
  483. !                 fprintf(stderr, "\r%7ld ZMODEM%s    ",
  484. !                   rxbytes, Crc32r?" CRC-32":"");
  485.   #ifdef SEGMENTS
  486.               if (chinseg >= (1024 * SEGMENTS)) {
  487.                   putsec(secbuf, chinseg);
  488. --- 1190,1197 ----
  489.               }
  490.   moredata:
  491.               if (Verbose>1)
  492. !               show_info();
  493.   #ifdef SEGMENTS
  494.               if (chinseg >= (1024 * SEGMENTS)) {
  495.                   putsec(secbuf, chinseg);
  496. diff -cNr czmodem/show_info.c zmodem/show_info.c
  497. *** czmodem/show_info.c
  498. --- zmodem/show_info.c    Fri Oct  2 11:20:14 1992
  499. ***************
  500. *** 0 ****
  501. --- 1,72 ----
  502. + #include <curses.h>
  503. + #include <sys/times.h>
  504. + extern int Crc32r;
  505. + extern long rxbytes, Bytesleft, Filesleft, Totalleft, GTotalleft;
  506. + extern long btime, ttime;
  507. + extern WINDOW *win;
  508. + int show_info()
  509. + {
  510. +   long rxtotal, curtime;
  511. +   long btelpsd, btleft, ttelpsd, ttleft;
  512. +   int perc, tperc, bytesthru, totalthru;
  513. +   int i;
  514. +   struct tms tdummy;
  515. + #define DIS 10
  516. + #define TDIS 30
  517. +   rxtotal = GTotalleft-Totalleft+rxbytes;
  518. +   perc = 100*rxbytes/Bytesleft;
  519. +   tperc = 100*rxtotal/GTotalleft;
  520. +   curtime = times(&tdummy);
  521. +   btelpsd = (curtime-btime)>100 ? (curtime-btime)/100 : 1;
  522. +   ttelpsd = (curtime-ttime)>100 ? (curtime-ttime)/100 : 1;
  523. +   btleft = rxbytes>100 ? (Bytesleft-rxbytes)*1.0/rxbytes*btelpsd : 0 ;
  524. +   ttleft = rxtotal>100 ? (Totalleft-rxbytes)*1.0/rxtotal*ttelpsd : 0 ;
  525. +   bytesthru = rxbytes/btelpsd;
  526. +   totalthru = rxtotal/ttelpsd;
  527. + /*  wstandout(win);*/
  528. +   mvwprintw(win, 2, 4+DIS, "%dk  ", rxbytes/1024);
  529. +   mvwprintw(win, 4, 4+DIS, "%d%%  ", perc);
  530. +   mvwprintw(win, 5, 4+DIS, "%02d\:%02d", btelpsd/60, btelpsd%60);
  531. +   mvwprintw(win, 6, 4+DIS, "%02d\:%02d", btleft/60, btleft%60);
  532. +   mvwprintw(win, 7, 4+DIS, "%d cps ", bytesthru);
  533. +   mvwprintw(win, 2, TDIS+4+DIS, "%dk  ", rxtotal/1024);
  534. +   mvwprintw(win, 4, TDIS+4+DIS, "%d%%  ", tperc);
  535. +   mvwprintw(win, 5, TDIS+4+DIS, "%02d\:%02d", ttelpsd/60, ttelpsd%60);
  536. +   mvwprintw(win, 6, TDIS+4+DIS, "%02d\:%02d", ttleft/60, ttleft%60);
  537. +   mvwprintw(win, 7, TDIS+4+DIS, "%d cps ", totalthru);
  538. + /*  wstandend(win);*/
  539. +   wstandout(win);
  540. +   for(i=0; i<=perc/2; i++)
  541. +     mvwaddstr(win, 10, 2+i, " ");
  542. +   for(i=0; i<=tperc/2; i++)
  543. +     mvwaddstr(win, 13, 2+i, " ");
  544. +   wstandend(win);  
  545. +   zmessage("Receiving file OK");
  546. +   
  547. + /*mvwprintw(win, 3, 1, "\r< %d%% >< %dk of %dk >< %df = %dk >< %s >      \r",
  548. +           100*rxbytes/Bytesleft, rxbytes/1024, Bytesleft/1024,
  549. +           Filesleft, Totalleft/1024, Crc32r?"CRC-32":"");*/
  550. +   wmove(win, 1, 1);
  551. +   wrefresh(win);
  552. + }
  553. + zmessage(msg)
  554. + char *msg;
  555. + {
  556. +   if (strlen(msg) > 40)
  557. +     msg[40] = NULL;
  558. +   wmove(win, 16, 12);
  559. +   wclrtoeol(win);
  560. +   waddstr(win, msg);
  561. +   wrefresh(win);
  562. + }
  563.