SMART@ditmelb.OZ.AU (Robert Smart) (06/07/88)
Preliminary comment: Is it true that there is now a two-way gateway between info-vax and the newsgroup comp.os.vms? I.e. you don't have to mail to info-vax, you can post to comp.os.vms and the mailing list recipients will also get it? Anyway I thought I'd enhance the bakwrd program recently posted. The original author did all the hard work, so he deserves the right to define the default behaviour. My extension applies when you specify "/0" on the command. It uses the ability of a VT100 to scroll the other way. I have also added the UPI SHR option so you can look at the tail of log files. Backwards scrolling is actually rather disorienting, and I'm not sure I like it. I think something simple like unix tail is probably best. My implementation is also rather gross since it assumes an 80 column screen and VT100 escape sequences. The /n option already assumes a VT100 so there is no change there. How about some expert on SMG changing bakwrd to use smg instead of assuming a vt100. And if some expert on CLI would give it a nice interface we'd have a good product. ------------ diffs for bakwrd.c --------------- ************ File DITMELBB:[SMART.TAIL]BAKWRD.C;25 23 int line = 0; 24 25 main(argc,argv)char *argv[];{ ****** File DITMELBB:[SMART.TAIL]BAKWRD.C_ORIG;1 23 main(argc,argv)char *argv[];{ ************ ************ File DITMELBB:[SMART.TAIL]BAKWRD.C;25 80 if(pergroep < 0) 81 pergroep = 1; 82 else if (pergroep>1){ 83 if(mrs<=0) ****** File DITMELBB:[SMART.TAIL]BAKWRD.C_ORIG;1 78 if(pergroep <= 0) 79 pergroep = 1; 80 else{ 81 if(mrs<=0) ************ ************ File DITMELBB:[SMART.TAIL]BAKWRD.C;25 107 if(pergroep==0){ 108 if(line>23) printf("\033[H\033M"); 109 printf("\033[1;24r\033[24H\n"); 110 } 111 }while(argc!=2); 112 } 113 114 addc(c)char c;{ 115 if(inrec==0 &&(c==' ' || c== '\t')) return; /* skip trailing blanks */ 116 rec[--jrec] = (c==delim? '\n' : c); 117 inrec++; 118 if(c == delim){ 119 if(++nline >= pergroep){ 120 if(pergroep > 1) printf("\n\033[7m group %6d \033[0m",groep++); 121 if(pergroep == 0){ register ii; 122 /* be clever. If nline<=24 then set scroll lines 1 to 123 24-nline+1 and scroll that up, then write on line 24-nline+1. 124 Otherwise leave scroll lines 1 to 24, scroll that down, and 125 write on line 1. */ 126 if( line+1+((inrec-2)/80)<24){ 127 printf("\033[1;%dr\033[%dH\n", 24-line, 24-line); 128 for( ii = 0; ii<(inrec-2)/80; ii++) printf("\n"); 129 for( ii = 0; ii<(inrec-2)/80; ii++) printf("\033M"); 130 } else { 131 if( line<24) printf("\033[1;24r\033[%dH\033[K", 24-line); 132 else printf("\033[H\033M\033[K"); 133 for( ii = 0; ii<(inrec-2)/80; ii++) printf("\033M\033[K"); 134 } 135 } 136 fwrite(rec+jrec+(pergroep==0?1:0),inrec-(pergroep==0?1:0),1,stdout); 137 line += 1+((inrec-2)/80); /* lines printed so far */ 138 inrec = nline = 0; 139 jrec = MAXREC; 140 } 141 } 142 } ****** File DITMELBB:[SMART.TAIL]BAKWRD.C_ORIG;1 105 }while(argc!=2); 106 } 107 108 addc(c)char c;{ 109 if(inrec==0 &&(c==' ' || c== '\t')) return; /* skip trailing blanks */ 110 rec[--jrec] = (c==delim? '\n' : c); 111 inrec++; 112 if(c == delim) 113 if(++nline >= pergroep){ 114 if(pergroep > 1) 115 printf("\n\033[7m group %6d \033[0m",groep++); 116 fwrite(rec+jrec,inrec,1,stdout); 117 inrec = nline = 0; 118 jrec = MAXREC; 119 } 120 } 121 ************ --------- diff for rmsio.c ----------- ************ File DITMELBB:[SMART.TAIL]RMSIO.C;6 19 fh->fab.fab$b_shr = FAB$M_UPI | FAB$M_SHRGET | FAB$M_SHRPUT; 20 fh->fab.fab$l_fna = fnam; ****** File DITMELBB:[SMART.TAIL]RMSIO.C_ORIG;1 19 fh->fab.fab$l_fna = fnam; ************