Commit Diff


commit - b829c3547001eb2a3cf846410deb15ddd7349b96
commit + 67e4fce4f5b62cf5f9e6b4b7b59ff2b2818d21f5
blob - 2a1b168a6d2da02915de04bf32e93c569f232058
blob + 89c3f850185c8bdd24667e99d9af010cf4582175
--- include/mach.h
+++ include/mach.h
@@ -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);
blob - 8fff13f8a3d0e4f655b2e1388ddd4050b6ab44e0
blob + eec79c286b4360f3f20ac5f3478d7b949e150ddf
--- src/cmd/9term/Darwin.c
+++ src/cmd/9term/Darwin.c
@@ -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"
blob - 8c0bf2c3aef8f7480512ab360436717c2e981338
blob + b5e09195fa989a598cea0d184cf80c28602f1aeb
--- src/cmd/9term/bsdpty.c
+++ src/cmd/9term/bsdpty.c
@@ -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>
blob - acfd0b3ef4ac4271229401aaf8081fba59f62a99
blob + 1c93f471aeab17fe201e8e7f42f132f6625bb67a
--- src/cmd/9term/mkfile
+++ src/cmd/9term/mkfile
@@ -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
 
blob - abcb761f9f5d15213edcdc091bbb73d665f2a1a3
blob + 4f60dccc914aceffba0f0464990d94ee3f01382a
--- src/cmd/plot/libplot/machdep.c
+++ src/cmd/plot/libplot/machdep.c
@@ -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
blob - 99e27efd1951de61725d0af92abfd068f413313b
blob + ee924dde5ebb70fa915322a87852559c25dc9d20
--- src/cmd/plot/libplot/mplot.h
+++ src/cmd/plot/libplot/mplot.h
@@ -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
  */
blob - 479790b9d820f266c7c5433147fd1b27496cd27d
blob + fee57dfc77709a9dbefb2aeee8005d4791e437cc
--- src/cmd/plot/libplot/sbox.c
+++ src/cmd/plot/libplot/sbox.c
@@ -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;
blob - 1407ba7260ae2a8ecbb4140bafe6e1fbf4a65c3e
blob + 2a601800ceba19d4cfc37bd018d2e82eb35d4ba3
--- src/libmach/nosys.c
+++ src/libmach/nosys.c
@@ -6,6 +6,8 @@
 #include <libc.h>
 #include <mach.h>
 
+Mach *machcpu = &mach386;
+
 void
 unmapproc(Map *m)
 {
@@ -46,7 +48,7 @@ ctlproc(int pid, char *msg)
 {
 	USED(pid);
 	USED(msg);
-	werrstr("ctlproc not implemented');
+	werrstr("ctlproc not implemented");
 	return -1;
 }
 
@@ -55,5 +57,5 @@ proctextfile(int pid)
 {
 	USED(pid);
 	werrstr("proctextfile not implemented");
-	return -1;
+	return nil;
 }