I figure I'm not the only person on this list who would find a newer copy of 
sam for Windows useful...
I know there's acme-sac, but I still find myself using the 9pm version of sam 
for remote connections and such.
So, I've been working on and off trying to get sam from plan9port going on 
Windows.  Currently, I'm using the Inferno hosted environment to do the port.  
That may or may not have been a good idea.  I'm now stuck at the function 
bootterm, in io.c.  Code below.  I'm stuck at the point where sam forks (or 
proc's) to launch samterm, since Windows provides neither.  emu uses Windows' 
CreateThread in it's kproc code.  I'm wondering what the best approach here 
would be, but in the style of some of the other ported Inferno tools, I'm 
leaning toward implementing the required functions in a "Nt.c" file and 
building it in.  Using libkern and a few other bits from draterm might work 
too...

Thanks!
-Ben


void
bootterm(char *machine, char **argv)
{
    int ph2t[2], pt2h[2];

    if(machine){
        dup(remotefd0, 0);
        dup(remotefd1, 1);
        close(remotefd0);
        close(remotefd1);
        argv[0] = "samterm";
        execvp(samterm, argv);
        fprint(2, "can't exec %s: %r\n", samterm);
        _exits("damn");
    }
    if(pipe(ph2t)==-1 || pipe(pt2h)==-1)
        panic("pipe");
    switch(fork()){
    case 0:
        dup(ph2t[0], 0);
        dup(pt2h[1], 1);
        close(ph2t[0]);
        close(ph2t[1]);
        close(pt2h[0]);
        close(pt2h[1]);
        argv[0] = "samterm";
        execvp(samterm, argv);
        fprint(2, "can't exec: ");
        perror(samterm);
        _exits("damn");
    case -1:
        panic("can't fork samterm");
    }
    dup(pt2h[0], 0);
    dup(ph2t[1], 1);
    close(ph2t[0]);
    close(ph2t[1]);
    close(pt2h[0]);
    close(pt2h[1]);
}

<<winmail.dat>>

Reply via email to