* telnetd improvements
@ 1995-08-14 11:57 Vadim
0 siblings, 0 replies; only message in thread
From: Vadim @ 1995-08-14 11:57 UTC (permalink / raw)
Hi -- i fixed the telnetd "line discipline" to make it more convinient
for those who telnet into a Plan 9 system (i.e. it simulates the
BSD-style kill/erase behaviour). Diffs (from 2.0 source) are:
cpu% cd /sys/src/cmd/service
cpu% diff telnetd.c.old telnetd.c
273a274,276
> #define BACKSPACE() { ECHO('\b'); ECHO(' '); ECHO('\b'); }
> #define RUBOUT(c) { BACKSPACE(); if((c)<' ' || (c)==0177) BACKSPACE(); }
>
347,350d349
< case 0x00:
< if(noproto) /* telnet ignores nulls */
< *bp++ = c;
< continue;
357c356
< if(start < bp)
---
> if(start < bp) {
359,360c358,360
< if(opt[Echo].local)
< ECHO(c);
---
> if(opt[Echo].local)
> RUBOUT(*bp);
> }
364,369c364,368
< bp = start;
< if(opt[Echo].local){
< ECHO('^');
< ECHO('U');
< ECHO('\r');
< ECHO('\n');
---
> if(opt[Echo].local) {
> while (bp > start) {
> bp--;
> RUBOUT(*bp);
> }
375,378c374
< while (--bp >= start && !alnum(*bp))
< ECHO('\b');
< while (bp >= start && alnum(*bp)) {
< ECHO('\b');
---
> while (bp > start && !alnum(bp[-1])) {
379a376
> RUBOUT(*bp);
381c378,381
< bp++;
---
> while (bp > start && alnum(bp[-1])) {
> bp--;
> BACKSPACE();
> }
386a387,389
> ECHO('\r');
> ECHO('\n');
> bp = start;
388a392,396
> case 0x00:
> if(!noproto) /* telnet ignores nulls */
> break;
> /*FALL THRU*/
>
390,391c398,405
< if(opt[Echo].local)
< ECHO(c);
---
> if(opt[Echo].local) {
> if( c >= ' ' ) {
> ECHO(c);
> } else {
> ECHO('^');
> ECHO(0x40|c);
> }
> }
cpu%
--vadim
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1995-08-14 11:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-08-14 11:57 telnetd improvements Vadim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).