Example #1
0
/* stack: ( speed termios - ) */
void mu_set_termios_speed()
{
    struct termios *pti = (struct termios *) TOP;

#define BPS(x)  case x: ST1 = B ## x; break

    switch(ST1)
    {
        BPS(  4800);
        BPS(  9600);
        BPS( 19200);
        BPS( 38400);
        BPS( 57600);
        BPS(115200);
        BPS(230400);
    default:
        return abort_zmsg("Unsupported speed");
    }

#ifdef __CYGWIN__
    /* Cygwin lacks cfsetspeed, so do it by hand. */
    pti->c_ospeed = pti->c_ispeed = ST1;
#else
    cfsetspeed(pti, ST1);
#endif
    DROP(2);
}
Example #2
0
void mu_create_file()       /* C-string-name - fd */
{
    int fd;
    char pathbuf[1024];
    char *path = abs_path((char *)TOP, pathbuf, 1024);

    if (path == NULL)
        return abort_zmsg("path too long");

    fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0666);
    if (fd == -1)
        return abort_strerror();

    TOP = fd;
}
Example #3
0
static void mu_open_file()     /* C-string-name flags - fd */
{
    int fd;
    char pathbuf[1024];
    char *path = abs_path((char *)ST1, pathbuf, 1024);

    if (path == NULL)
        return abort_zmsg("path too long");

    fd = open(path, TOP);
    if (fd == -1)
        return abort_strerror();

    DROP(1);
    TOP = fd;
}
Example #4
0
void mu_stat_file()         /* C-string-name - mode-bits -1 | strerror 0 */
{
    struct stat s;
    char pathbuf[PATH_MAX];
    char *path = abs_path(pathbuf, PATH_MAX, (char *)TOP);

    if (path == NULL)
        return abort_zmsg("path too long");

    DROP(-1);
    if (stat(path, &s) == -1)
    {
        ST1 = (addr)strerror(errno);
        TOP = 0;        /* failure */
    }
    else
    {
        ST1 = s.st_mode;
        TOP = -1;       /* success */
    }
}
Example #5
0
/* We're going to assume that in every case that complain is called, that
 * there is a token ( a u) on the stack. So complain will do a 2drop.
 */
void mu_complain()
{
    DROP(2);
    abort_zmsg("isn't defined");
}