tmake mac work - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 67e4fce4f5b62cf5f9e6b4b7b59ff2b2818d21f5
 (DIR) parent b829c3547001eb2a3cf846410deb15ddd7349b96
 (HTM) Author: rsc <devnull@localhost>
       Date:   Mon, 19 Apr 2004 23:58:57 +0000
       
       make mac work
       
       Diffstat:
         M include/mach.h                      |       2 +-
         M src/cmd/9term/Darwin.c              |     148 +------------------------------
         M src/cmd/9term/bsdpty.c              |       1 +
         M src/cmd/9term/mkfile                |       2 +-
         M src/cmd/plot/libplot/machdep.c      |       1 +
         M src/cmd/plot/libplot/mplot.h        |       4 ++--
         M src/cmd/plot/libplot/sbox.c         |       1 +
         M src/libmach/nosys.c                 |       6 ++++--
       
       8 files changed, 12 insertions(+), 153 deletions(-)
       ---
 (DIR) diff --git a/include/mach.h b/include/mach.h
       t@@ -476,7 +476,7 @@ int                unwindframe(Map *map, Regs *regs, ulong *next);
        
        void                _addhdr(Fhdr*);
        void                _delhdr(Fhdr*);
       -Fhdr*        fhdrlist;
       +extern Fhdr*        fhdrlist;
        
        Symbol*        flookupsym(Fhdr*, char*);
        Symbol*        ffindsym(Fhdr*, Loc, uint);
 (DIR) diff --git a/src/cmd/9term/Darwin.c b/src/cmd/9term/Darwin.c
       t@@ -1,147 +1 @@
       -#include <u.h>
       -#include <sys/types.h>
       -#include <sys/ioctl.h>
       -#include <sys/stat.h>
       -#include <errno.h>
       -#include <fcntl.h>
       -#include <grp.h>
       -#include <stdlib.h>
       -#include <string.h>
       -#include <termios.h>
       -#include <unistd.h>
       -#include <libc.h>
       -#include "term.h"
       -
       -int myopenpty(int[], char*);
       -
       -int
       -getpts(int fd[], char *slave)
       -{
       -        return myopenpty(fd, slave);
       -}
       -
       -int
       -childpty(int fd[], char *slave)
       -{
       -        int sfd;
       -
       -        close(fd[1]);
       -        setsid();
       -        sfd = open(slave, ORDWR);
       -        if(sfd < 0)
       -                sysfatal("open %s: %r\n", slave);
       -        if(ioctl(sfd, TIOCSCTTY, 0) < 0)
       -                fprint(2, "ioctl TIOCSCTTY: %r\n");
       -        return sfd;
       -}
       -
       -
       -struct winsize ows;
       -
       -void
       -updatewinsize(int row, int col, int dx, int dy)
       -{
       -        struct winsize ws;
       -
       -        ws.ws_row = row;
       -        ws.ws_col = col;
       -        ws.ws_xpixel = dx;
       -        ws.ws_ypixel = dy;
       -        if(ws.ws_row != ows.ws_row || ws.ws_col != ows.ws_col)
       -        if(ioctl(rcfd, TIOCSWINSZ, &ws) < 0)
       -                fprint(2, "ioctl: %r\n");
       -        ows = ws;
       -}
       -
       -
       -
       -
       -
       -
       -
       -
       -/*-
       - * Copyright (c) 1990, 1993, 1994
       - *        The Regents of the University of California.  All rights reserved.
       - *
       - * Redistribution and use in source and binary forms, with or without
       - * modification, are permitted provided that the following conditions
       - * are met:
       - * 1. Redistributions of source code must retain the above copyright
       - *    notice, this list of conditions and the following disclaimer.
       - * 2. Redistributions in binary form must reproduce the above copyright
       - *    notice, this list of conditions and the following disclaimer in the
       - *    documentation and/or other materials provided with the distribution.
       - * 3. All advertising materials mentioning features or use of this software
       - *    must display the following acknowledgement:
       - *        This product includes software developed by the University of
       - *        California, Berkeley and its contributors.
       - * 4. Neither the name of the University nor the names of its contributors
       - *    may be used to endorse or promote products derived from this software
       - *    without specific prior written permission.
       - *
       - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
       - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
       - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
       - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
       - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
       - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
       - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
       - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
       - * SUCH DAMAGE.
       - */
       -
       -int
       -myopenpty(int fd[], char *name)
       -{
       -        char pty[] = "/dev/ptyXX";
       -        char *s, *t;
       -        struct group *gr;
       -        int ttygid;
       -
       -        if((gr = getgrnam("tty")) != NULL)
       -                ttygid = gr->gr_gid;
       -        else
       -                ttygid = -1;
       -
       -        for(s="pqrstuvw"; *s; s++)
       -        for(t="0123456789abcdef"; *t; t++){
       -                pty[5] = 'p';
       -                pty[8] = *s;
       -                pty[9] = *t;
       -                if((fd[1] = open(pty, O_RDWR)) < 0){
       -                        if(errno == ENOENT)
       -                                return -1;
       -                }else{
       -                        pty[5] = 't';
       -                        chown(pty, getuid(), ttygid);
       -                        chmod(pty, 620);
       -                        revoke(pty);
       -                        if((fd[0] = open(pty, O_RDWR)) < 0){
       -                                close(fd[1]);
       -                                continue;
       -                        }
       -                        if(name)
       -                                strcpy(name, pty);
       -                        return 0;
       -                }
       -        }
       -        errno = ENOENT;
       -        return -1;
       -
       -}
       -
       -int
       -israw(int fd)
       -{
       -        return 0;
       -}
       -
       -int
       -setecho(int fd, int on)
       -{
       -        return 0;
       -}
       -
       +#include "bsdpty.c"
 (DIR) diff --git a/src/cmd/9term/bsdpty.c b/src/cmd/9term/bsdpty.c
       t@@ -1,5 +1,6 @@
        #include <u.h>
        #include <sys/types.h>
       +#include <sys/ioctl.h>
        #include <sys/stat.h>
        #include <errno.h>
        #include <grp.h>
 (DIR) diff --git a/src/cmd/9term/mkfile b/src/cmd/9term/mkfile
       t@@ -12,5 +12,5 @@ SHORTLIB=complete frame draw plumb fs mux thread 9
        
        LDFLAGS=-L$X11/lib -lX11
        
       -Linux.$O FreeBSD.$O: bsdpty.c
       +Darwin.$O Linux.$O FreeBSD.$O: bsdpty.c
        
 (DIR) diff --git a/src/cmd/plot/libplot/machdep.c b/src/cmd/plot/libplot/machdep.c
       t@@ -1,4 +1,5 @@
        #include "mplot.h"
       +int mapminx, mapminy, mapmaxx, mapmaxy;
        Image *offscreen;
        /*
         * Clear the window from x0, y0 to x1, y1 (inclusive) to color c
 (DIR) diff --git a/src/cmd/plot/libplot/mplot.h b/src/cmd/plot/libplot/mplot.h
       t@@ -29,8 +29,8 @@ struct seg {
        /*
         * display parameters
         */
       -int clipminx, clipminy, clipmaxx, clipmaxy;        /* clipping rectangle */
       -int mapminx, mapminy, mapmaxx, mapmaxy;                /* centered square */
       +extern int clipminx, clipminy, clipmaxx, clipmaxy;        /* clipping rectangle */
       +extern int mapminx, mapminy, mapmaxx, mapmaxy;                /* centered square */
        /*
         * Prototypes
         */
 (DIR) diff --git a/src/cmd/plot/libplot/sbox.c b/src/cmd/plot/libplot/sbox.c
       t@@ -1,4 +1,5 @@
        #include "mplot.h"
       +int clipminx, clipminy, clipmaxx, clipmaxy;
        void sbox(double xx0, double yy0, double xx1, double yy1){
                int x0=SCX(xx0), y0=SCY(yy0), x1=SCX(xx1), y1=SCY(yy1);
                int t;
 (DIR) diff --git a/src/libmach/nosys.c b/src/libmach/nosys.c
       t@@ -6,6 +6,8 @@
        #include <libc.h>
        #include <mach.h>
        
       +Mach *machcpu = &mach386;
       +
        void
        unmapproc(Map *m)
        {
       t@@ -46,7 +48,7 @@ ctlproc(int pid, char *msg)
        {
                USED(pid);
                USED(msg);
       -        werrstr("ctlproc not implemented');
       +        werrstr("ctlproc not implemented");
                return -1;
        }
        
       t@@ -55,5 +57,5 @@ proctextfile(int pid)
        {
                USED(pid);
                werrstr("proctextfile not implemented");
       -        return -1;
       +        return nil;
        }