#ifdef	STS
#include <sys/types.h>
#include <stropts.h>
#include <sys/conf.h>

/*
 * This is the best I could do on short notice with no documentation..
 * Truss and adb are very useful tools..
 */

#define	STSGETEXTCTL	0x40445415
#define	STSSETEXTCTL	0x80445414

struct stsinfo {
    char fill1[3];
    char baudext;
    char fill2[64];
};

#define	EXTBITS		0xf0
#define	EXTSHIFT	4
#define EXTMIN		0
#define EXTMAX		15

stsbaudext(fd, ext)
int fd;
int ext;
{
    struct stsinfo sinfo;
    struct strioctl si;

    if (ext < EXTMIN || ext > EXTMAX)
	return;

    si.ic_cmd = STSGETEXTCTL;
    si.ic_timout = 0;
    si.ic_len = sizeof(sinfo);
    si.ic_dp = (char *)&sinfo;
    if (ioctl(fd, I_STR, &si) < 0)
	return -1;

    sinfo.baudext = (sinfo.baudext & ~EXTBITS)
		  | ((ext << EXTSHIFT) & EXTBITS);

    si.ic_cmd = STSSETEXTCTL;
    si.ic_timout = 0;
    si.ic_len = sizeof(sinfo);
    si.ic_dp = (char *)&sinfo;

    if (ioctl(fd, I_STR, &si) < 0)
	return -1;
    return 0;
}
#endif
