e = cfg.environ;
e = cfg.environmt;
static void process_subneg (void) {    unsigned char b[2048], *p, *q;    int var, value, n;    char *e;    switch (sb_opt) {      case TELOPT_TSPEED:	if (sb_len == 1 && sb_buf[0] == TELQUAL_SEND) {	    char logbuf[sizeof(cfg.termspeed)+80];	    b[0] = IAC; b[1] = SB; b[2] = TELOPT_TSPEED;	    b[3] = TELQUAL_IS;	    strcpy(b+4, cfg.termspeed);	    n = 4 + strlen(cfg.termspeed);	    b[n] = IAC; b[n+1] = SE;	    s_write (b, n+2);	    lognegot("server:\tSB TSPEED SEND");	    sprintf(logbuf, "client:\tSB TSPEED IS %s", cfg.termspeed);	    lognegot (logbuf);	} else	    lognegot ("server:\tSB TSPEED <something weird>");	break;      case TELOPT_TTYPE:	if (sb_len == 1 && sb_buf[0] == TELQUAL_SEND) {	    char logbuf[sizeof(cfg.termtype)+80];	    b[0] = IAC; b[1] = SB; b[2] = TELOPT_TTYPE;	    b[3] = TELQUAL_IS;	    for (n = 0; cfg.termtype[n]; n++)		b[n+4] = (cfg.termtype[n] >= 'a' && cfg.termtype[n] <= 'z' ?			  cfg.termtype[n] + 'A'-'a' : cfg.termtype[n]);	    b[n+4] = IAC; b[n+5] = SE;	    s_write (b, n+6);	    b[n+4] = 0;	    lognegot("server:\tSB TTYPE SEND");	    sprintf(logbuf, "client:\tSB TTYPE IS %s", b+4);	    lognegot(logbuf);	} else	    lognegot("server:\tSB TTYPE <something weird>\r\n");	break;      case TELOPT_OLD_ENVIRON:      case TELOPT_NEW_ENVIRON:		p = sb_buf;	q = p + sb_len;	if (p < q && *p == TELQUAL_SEND) {	    char logbuf[50];	    p++;	    sprintf (logbuf, "server:\tSB %s SEND", telopt(sb_opt));	    lognegot (logbuf);	    if (sb_opt == TELOPT_OLD_ENVIRON) {		if (cfg.rfc_environ) {		    value = RFC_VALUE;		    var = RFC_VAR;		} else {		    value = BSD_VALUE;		    var = BSD_VAR;		}		/*		 * Try to guess the sense of VAR and VALUE.		 */		while (p < q) {		    if (*p == RFC_VAR) {			value = RFC_VALUE;			var = RFC_VAR;		    } else if (*p == BSD_VAR) {			value = BSD_VALUE;			var = BSD_VAR;		    }		    p++;		}	    } else {		/*		 * With NEW_ENVIRON, the sense of VAR and VALUE		 * isn't in doubt.		 */		value = RFC_VALUE;		var = RFC_VAR;	    }	    b[0] = IAC; b[1] = SB; b[2] = sb_opt;	    b[3] = TELQUAL_IS;	    n = 4;	    e = cfg.environ;	    while (*e) {		b[n++] = var;		while (*e && *e != '\t') b[n++] = *e++;		if (*e == '\t') e++;		b[n++] = value;		while (*e) b[n++] = *e++;		e++;	    }	    if (*cfg.username) {		b[n++] = var; b[n++] = 'U'; b[n++] = 'S';		b[n++] = 'E'; b[n++] = 'R'; b[n++] = value;		e = cfg.username;		while (*e) b[n++] = *e++;	    }	    b[n++] = IAC; b[n++] = SE;	    s_write (b, n);	    sprintf(logbuf, "client:\tSB %s IS %s", telopt(sb_opt),		    n==6 ? "<nothing>" : "<stuff>");	    lognegot (logbuf);	}	break;    }}