clean up when finished.

This commit is contained in:
rsc 2004-04-19 23:03:46 +00:00
parent 98cd2746cf
commit b4a659b6cf
21 changed files with 42 additions and 83 deletions

View file

@ -7,6 +7,7 @@ cd src
make make
mk clean mk clean
mk install mk install
mk clean
echo "Set PLAN9=$PLAN9 in your profile environment." echo "Set PLAN9=$PLAN9 in your profile environment."
echo 'Add $PLAN9/bin to your PATH.' echo 'Add $PLAN9/bin to your PATH.'

View file

@ -11,6 +11,8 @@
#include <complete.h> #include <complete.h>
#include "term.h" #include "term.h"
int noecho = 0;
typedef struct Text Text; typedef struct Text Text;
typedef struct Readbuf Readbuf; typedef struct Readbuf Readbuf;

View file

@ -1,58 +1 @@
#include <u.h> #include "bsdpty.c"
#include <sys/types.h>
#include <termios.h>
#include <sys/termios.h>
#include <libutil.h>
#include <libc.h>
#include "term.h"
int
getpts(int fd[], char *slave)
{
return openpty(&fd[1], &fd[0], slave, 0, 0);
}
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[0], TIOCSWINSZ, &ws) < 0)
fprint(2, "ioctl: %r\n");
ows = ws;
}
int
israw(int fd)
{
return 0;
}
int
setecho(int fd, int on)
{
return 0;
}

View file

@ -1,9 +1,13 @@
#include <u.h> #include <u.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <grp.h> #include <grp.h>
#include <termios.h> #include <termios.h>
#include <sys/termios.h> #include <sys/termios.h>
#ifdef __linux__
#include <pty.h> #include <pty.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <libc.h> #include <libc.h>
#include "term.h" #include "term.h"
@ -30,7 +34,6 @@ getpts(int fd[], char *slave)
pty[8] = *a; pty[8] = *a;
pty[9] = *z; pty[9] = *z;
if((fd[1] = open(pty, ORDWR)) < 0){ if((fd[1] = open(pty, ORDWR)) < 0){
fprint(2, "try %s: %r\n", pty);
if(errno == ENOENT) if(errno == ENOENT)
break; break;
}else{ }else{

View file

@ -1,4 +1,3 @@
PLAN9=../../..
<$PLAN9/src/mkhdr <$PLAN9/src/mkhdr
TARG=9term win TARG=9term win
@ -13,5 +12,5 @@ SHORTLIB=complete frame draw plumb fs mux thread 9
LDFLAGS=-L$X11/lib -lX11 LDFLAGS=-L$X11/lib -lX11
Linux.$O: bsdpty.c Linux.$O FreeBSD.$O: bsdpty.c

View file

@ -1,9 +1,6 @@
#include <u.h> #include <u.h>
#include <libc.h>
#if 0
#include <sys/wait.h>
#endif
#include <signal.h> #include <signal.h>
#include <libc.h>
#include "term.h" #include "term.h"
int int
@ -37,6 +34,8 @@ rcstart(int argc, char **argv, int *pfd, int *tfd)
dup(sfd, 1); dup(sfd, 1);
dup(sfd, 2); dup(sfd, 2);
system("stty tabs -onlcr onocr icanon echo erase '^h' intr '^?'"); system("stty tabs -onlcr onocr icanon echo erase '^h' intr '^?'");
if(noecho)
system("stty -echo");
for(i=3; i<100; i++) for(i=3; i<100; i++)
close(i); close(i);
execvp(argv[0], argv); execvp(argv[0], argv);

View file

@ -5,3 +5,4 @@ extern int rcfd;
extern int rcstart(int, char*[], int*, int*); extern int rcstart(int, char*[], int*, int*);
extern int isecho(int); extern int isecho(int);
extern int setecho(int, int); extern int setecho(int, int);
extern int noecho;

View file

@ -5,6 +5,8 @@
#include <fs.h> #include <fs.h>
#include "term.h" #include "term.h"
int noecho = 1;
#define EVENTSIZE 256 #define EVENTSIZE 256
#define STACK 32768 #define STACK 32768

View file

@ -112,10 +112,12 @@ main(int argc, char *argv[])
l = look("acidmap"); l = look("acidmap");
if(l && l->proc) { if(l && l->proc) {
n = an(ONAME, ZN, ZN); if(setjmp(err) == 0){
n->sym = l; n = an(ONAME, ZN, ZN);
n = an(OCALL, n, ZN); n->sym = l;
execute(n); n = an(OCALL, n, ZN);
execute(n);
}
} }
interactive = 1; interactive = 1;
@ -146,12 +148,14 @@ main(int argc, char *argv[])
static int static int
attachfiles(int argc, char **argv) attachfiles(int argc, char **argv)
{ {
int pid;
char *s; char *s;
int i, omode; int i, omode;
Fhdr *hdr; Fhdr *hdr;
Lsym *l; Lsym *l;
Value *v; Value *v;
pid = 0;
interactive = 0; interactive = 0;
if(setjmp(err)) if(setjmp(err))
return -1; return -1;

View file

@ -18,7 +18,6 @@ OFILES=$UOFILES y.tab.$O
YFILES=dbg.y YFILES=dbg.y
HFILES=acid.h HFILES=acid.h
BIN=/home/rsc/bin
SHORTLIB=mach regexp9 bio 9 SHORTLIB=mach regexp9 bio 9

View file

@ -51,8 +51,7 @@ sproc(int xpid)
int int
nproc(char **argv) nproc(char **argv)
{ {
char buf[128]; int pid, i;
int pid, i, fd;
pid = fork(); pid = fork();
switch(pid) { switch(pid) {

View file

@ -11,7 +11,7 @@ OFILES=\
HFILES=\ HFILES=\
dat.h\ dat.h\
../../libmach/mach.h\ $PLAN9/include/mach.h\
../../libmach/elf.h\ ../../libmach/elf.h\
../../libmach/dwarf.h\ ../../libmach/dwarf.h\
../../libmach/stabs.h\ ../../libmach/stabs.h\

View file

@ -55,6 +55,8 @@ void get(Text*, Text*, Text*, int, int, Rune*, int);
void put(Text*, Text*, Text*, int, int, Rune*, int); void put(Text*, Text*, Text*, int, int, Rune*, int);
void putfile(File*, int, int, Rune*, int); void putfile(File*, int, int, Rune*, int);
void fontx(Text*, Text*, Text*, int, int, Rune*, int); void fontx(Text*, Text*, Text*, int, int, Rune*, int);
#undef isalnum
#define isalnum acmeisalnum
int isalnum(Rune); int isalnum(Rune);
void execute(Text*, uint, uint, int, Text*); void execute(Text*, uint, uint, int, Text*);
int search(Text*, Rune*, uint); int search(Text*, Rune*, uint);

View file

@ -1,6 +1,5 @@
# Acme is up-to-date w.r.t. sources as of 29 February 2004 # Acme is up-to-date w.r.t. sources as of 29 February 2004
PLAN9=../../..
<$PLAN9/src/mkhdr <$PLAN9/src/mkhdr
TARG=acme TARG=acme

View file

@ -1,4 +1,3 @@
PLAN9=../../../..
<$PLAN9/src/mkhdr <$PLAN9/src/mkhdr
OFILES=\ OFILES=\

View file

@ -1,4 +1,3 @@
PLAN9=../../..
<$PLAN9/src/mkhdr <$PLAN9/src/mkhdr
OFILES= OFILES=

View file

@ -104,7 +104,7 @@ rundiff(char *arg1, char *arg2, int outfd)
Waitmsg *w; Waitmsg *w;
narg = 0; narg = 0;
arg[narg++] = "/bin/diff"; arg[narg++] = "diff";
arg[narg++] = "-n"; arg[narg++] = "-n";
if(diffbflag) if(diffbflag)
arg[narg++] = "-b"; arg[narg++] = "-b";
@ -121,7 +121,7 @@ rundiff(char *arg1, char *arg2, int outfd)
case 0: case 0:
dup(outfd, 1); dup(outfd, 1);
close(0); close(0);
exec("/bin/diff", arg); exec("diff", arg);
sysfatal("exec: %r"); sysfatal("exec: %r");
default: default:
@ -143,7 +143,7 @@ runcmd(char *cmd)
int narg, pid, wpid; int narg, pid, wpid;
narg = 0; narg = 0;
arg[narg++] = "/bin/rc"; arg[narg++] = "rc";
arg[narg++] = "-c"; arg[narg++] = "-c";
arg[narg++] = cmd; arg[narg++] = cmd;
arg[narg] = nil; arg[narg] = nil;
@ -153,7 +153,7 @@ runcmd(char *cmd)
sysfatal("fork: %r"); sysfatal("fork: %r");
case 0: case 0:
exec("/bin/rc", arg); exec("rc", arg);
sysfatal("exec: %r"); sysfatal("exec: %r");
default: default:

View file

@ -3,6 +3,13 @@
#include <bio.h> #include <bio.h>
/* Macros for Rune support of ctype.h-like functions */ /* Macros for Rune support of ctype.h-like functions */
#undef isupper
#undef islower
#undef isalpha
#undef isdigit
#undef isalnum
#undef isspace
#undef tolower
#define isupper(r) (L'A' <= (r) && (r) <= L'Z') #define isupper(r) (L'A' <= (r) && (r) <= L'Z')
#define islower(r) (L'a' <= (r) && (r) <= L'z') #define islower(r) (L'a' <= (r) && (r) <= L'z')
#define isalpha(r) (isupper(r) || islower(r)) #define isalpha(r) (isupper(r) || islower(r))

View file

@ -1,4 +1,3 @@
PLAN9=../..
<$PLAN9/src/mkhdr <$PLAN9/src/mkhdr
TARG=`ls *.c | sed 's/\.c//'` TARG=`ls *.c | sed 's/\.c//'`
@ -7,7 +6,7 @@ SHORTLIB=sec fs mux regexp9 draw thread bio 9
<$PLAN9/src/mkmany <$PLAN9/src/mkmany
BUGGERED='CVS|faces|factotum|htmlfmt|mk|upas|vac|venti' BUGGERED='CVS|faces|factotum|mk|upas|vac|venti'
DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "^($BUGGERED)$"` DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "^($BUGGERED)$"`
<$PLAN9/src/mkdirs <$PLAN9/src/mkdirs

View file

@ -10,6 +10,8 @@ Biobuf fout;
#define BUFSIZE 70 #define BUFSIZE 70
void stringit(char *); void stringit(char *);
#undef isprint
#define isprint risprint
int isprint(Rune); int isprint(Rune);
void void

View file

@ -1,6 +1,6 @@
<mkhdr <mkhdr
BUGGERED='9p|fmt|html|httpd|ip|utf|venti' BUGGERED='9p|fmt|httpd|ip|utf|venti'
LIBDIRS=`ls -ld lib* | sed -n 's/^d.* //p' |egrep -v "^lib($BUGGERED)$"` LIBDIRS=`ls -ld lib* | sed -n 's/^d.* //p' |egrep -v "^lib($BUGGERED)$"`
DIRS=\ DIRS=\