Add the #goo to allow use in C++.
Silence a few more warnings. Strip down the mkfiles more. Fix bug in X11 mouse handling, note groups.
This commit is contained in:
parent
dc13c29ed1
commit
f7012583e9
41 changed files with 300 additions and 163 deletions
|
|
@ -82,11 +82,14 @@ int
|
|||
opentemp(char *template, int mode, long perm)
|
||||
{
|
||||
int fd;
|
||||
Dir d;
|
||||
|
||||
fd = mkstemp(template);
|
||||
if(fd < 0)
|
||||
sysfatal("could not create temporary file");
|
||||
fchmod(fd, perm);
|
||||
nulldir(&d);
|
||||
d.mode = perm;
|
||||
dirfwstat(fd, &d);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ LDFLAGS=$LDFLAGS -lsec -lregexp9 -l9 -lbio -lfmt -lutf
|
|||
|
||||
<$PLAN9/src/mkmany
|
||||
|
||||
BUGGERED='CVS|oplumb|plumb|plumb2|mk|vac|9term'
|
||||
BUGGERED='CVS|oplumb|plumb|plumb2|mk|vac|9term|venti'
|
||||
DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "$BUGGERED"`
|
||||
|
||||
<$PLAN9/src/mkdirs
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ rescue(void)
|
|||
File *f;
|
||||
char *c;
|
||||
char buf[256];
|
||||
char *root;
|
||||
|
||||
if(rescuing++)
|
||||
return;
|
||||
|
|
@ -162,7 +163,10 @@ rescue(void)
|
|||
free(c);
|
||||
}else
|
||||
sprint(buf, "nameless.%d", nblank++);
|
||||
fprint(io, "#!%s '%s' $* <<'---%s'\n", SAMSAVECMD, buf, buf);
|
||||
root = getenv("PLAN9");
|
||||
if(root == nil)
|
||||
root = "/usr/local/plan9";
|
||||
fprint(io, "#!/bin/sh\n%s/bin/samsave '%s' $* <<'---%s'\n", root, buf, buf);
|
||||
addr.r.p1 = 0, addr.r.p2 = f->b.nc;
|
||||
writeio(f);
|
||||
fprint(io, "\n---%s\n", (char *)buf);
|
||||
|
|
|
|||
|
|
@ -345,7 +345,6 @@ extern char SH[];
|
|||
extern char SHPATH[];
|
||||
extern char RX[];
|
||||
extern char RXPATH[];
|
||||
extern char SAMSAVECMD[];
|
||||
|
||||
/*
|
||||
* acme globals
|
||||
|
|
|
|||
|
|
@ -38,9 +38,6 @@ Rune *right[]= { r1, r2, r3, 0};
|
|||
#ifndef RXPATHNAME
|
||||
#define RXPATHNAME "ssh"
|
||||
#endif
|
||||
#ifndef SAMSAVECMDNAME
|
||||
#define SAMSAVECMDNAME "/bin/sh\n/usr/local/plan9/bin/samsave"
|
||||
#endif
|
||||
|
||||
char RSAM[] = "sam";
|
||||
char SAMTERM[] = SAMTERMNAME;
|
||||
|
|
@ -50,7 +47,6 @@ char SH[] = SHNAME;
|
|||
char SHPATH[] = SHPATHNAME;
|
||||
char RX[] = RXNAME;
|
||||
char RXPATH[] = RXPATHNAME;
|
||||
char SAMSAVECMD[] = SAMSAVECMDNAME;
|
||||
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
/*
|
||||
* stupid little program to pipe unicode chars through
|
||||
* when converting to non-utf compilers.
|
||||
*/
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <bio.h>
|
||||
|
|
|
|||
|
|
@ -22,16 +22,21 @@ futimes(int fd, struct timeval *tv)
|
|||
int
|
||||
dirfwstat(int fd, Dir *dir)
|
||||
{
|
||||
int ret;
|
||||
struct timeval tv[2];
|
||||
|
||||
/* BUG handle more */
|
||||
if(dir->mtime == ~0ULL)
|
||||
return 0;
|
||||
|
||||
tv[0].tv_sec = dir->mtime;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = dir->mtime;
|
||||
tv[1].tv_usec = 0;
|
||||
return futimes(fd, tv);
|
||||
if(~dir->mode != 0){
|
||||
if(fchmod(fd, dir->mode) < 0)
|
||||
ret = -1;
|
||||
}
|
||||
if(~dir->mtime != 0){
|
||||
tv[0].tv_sec = dir->mtime;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = dir->mtime;
|
||||
tv[1].tv_usec = 0;
|
||||
if(futimes(fd, tv) < 0)
|
||||
ret = -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +1,22 @@
|
|||
#include <u.h>
|
||||
#define NOPLAN9DEFINES
|
||||
#include <libc.h>
|
||||
|
||||
#undef asctime
|
||||
#undef ctime
|
||||
#undef gmtime
|
||||
#undef localtime
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
|
||||
extern int _p9dir(struct stat*, char*, Dir*, char**, char*);
|
||||
|
||||
/* everyone has getdirentries, just use that */
|
||||
/* almost everyone has getdirentries, just use that */
|
||||
static int
|
||||
mygetdents(int fd, char *buf, int n)
|
||||
{
|
||||
ssize_t nn;
|
||||
#if _GETDIRENTRIES_TAKES_LONG
|
||||
long off;
|
||||
#else
|
||||
off_t off;
|
||||
#endif
|
||||
|
||||
off = seek(fd, 0, 1);
|
||||
off = p9seek(fd, 0, 1);
|
||||
nn = getdirentries(fd, buf, n, &off);
|
||||
if(nn > 0)
|
||||
seek(fd, off, 0);
|
||||
p9seek(fd, off, 0);
|
||||
return nn;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,15 @@ _initdisplay(void (*error)(Display*, char*), char *label)
|
|||
Display *d;
|
||||
Memimage *m;
|
||||
|
||||
/*
|
||||
* This rfork(RFNOTEG) isn't exactly right,
|
||||
* but we need some way to signal window
|
||||
* closes. Right now we post a hangup
|
||||
* note to the note group, which kills a whole
|
||||
* lot more than just the current program
|
||||
* if we don't do this.
|
||||
*/
|
||||
rfork(RFNOTEG);
|
||||
memimageinit();
|
||||
|
||||
d = mallocz(sizeof(Display), 1);
|
||||
|
|
|
|||
|
|
@ -190,8 +190,15 @@ xtoplan9mouse(XDisplay *xd, XEvent *e, Mouse *m)
|
|||
switch(e->type){
|
||||
case ButtonPress:
|
||||
be = (XButtonEvent*)e;
|
||||
/* Fake message, just sent to make us announce snarf. */
|
||||
if(be->send_event && be->state==~0 && be->button==~0)
|
||||
/*
|
||||
* Fake message, just sent to make us announce snarf.
|
||||
* Apparently state and button are 16 and 8 bits on
|
||||
* the wire, since they are truncated by the time they
|
||||
* get to us.
|
||||
*/
|
||||
if(be->send_event
|
||||
&& (~be->state&0xFFFF)==0
|
||||
&& (~be->button&0xFF)==0)
|
||||
return -1;
|
||||
/* BUG? on mac need to inherit these from elsewhere? */
|
||||
m->xy.x = be->x;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ static char* abspath(HConnect *cc, char *origpath, char *curdir);
|
|||
static int getc(HConnect*);
|
||||
static char* getword(HConnect*);
|
||||
static Strings parseuri(HConnect *c, char*);
|
||||
static Strings stripmagic(char*);
|
||||
static Strings stripsearch(char*);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@
|
|||
|
||||
//static Thread *runthread(Proc*);
|
||||
|
||||
#if 0
|
||||
static char *_psstate[] = {
|
||||
"Dead",
|
||||
"Running",
|
||||
"Ready",
|
||||
"Rendezvous",
|
||||
};
|
||||
#endif
|
||||
|
||||
static char*
|
||||
psstate(int s)
|
||||
|
|
|
|||
20
src/mkcommon
20
src/mkcommon
|
|
@ -6,16 +6,20 @@
|
|||
%.$O: %.s
|
||||
$AS $AFLAGS $stem.s
|
||||
|
||||
clean:V:
|
||||
y.tab.h y.tab.c: $YFILES
|
||||
$YACC $YFLAGS $prereq
|
||||
|
||||
nuke:V: nuke-common
|
||||
clean:V: clean-common
|
||||
%.clean:V: %.clean-common
|
||||
|
||||
nuke-common:V:
|
||||
rm -f *.[$OS] [$OS].out $CLEANFILES $NUKEFILES
|
||||
|
||||
clean-common:
|
||||
rm -f *.[$OS] [$OS].out $CLEANFILES
|
||||
|
||||
%.clean:V:
|
||||
%.clean-common:V:
|
||||
rm -f $stem.[$OS] [$OS].$stem $stem.acid $stem
|
||||
|
||||
nuke:V:
|
||||
rm -f *.[$OS] [$OS].out $CLEANFILES
|
||||
|
||||
Makefile:D: mkfile
|
||||
rm -f Makefile
|
||||
sh $PLAN9/src/mk2make mkfile >Makefile
|
||||
chmod 444 Makefile
|
||||
|
|
|
|||
29
src/mkhdr
29
src/mkhdr
|
|
@ -1,26 +1,25 @@
|
|||
SYSNAME=`uname`
|
||||
OBJTYPE=`uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'`
|
||||
|
||||
X11=/usr/X11R6
|
||||
CC=9c
|
||||
LD=9l
|
||||
AS=9a
|
||||
AR=9ar
|
||||
CFLAGS=
|
||||
LDFLAGS=
|
||||
AFLAGS=
|
||||
O=o
|
||||
|
||||
BIN=$PLAN9/bin
|
||||
LIBDIR=$PLAN9/lib
|
||||
|
||||
<|cat $PLAN9/src/mk.$SYSNAME-$OBJTYPE 2>/dev/null || true
|
||||
# BUG - figure this out automatically
|
||||
X11=/usr/X11R6
|
||||
|
||||
O=o
|
||||
OS=$O
|
||||
LD=9l
|
||||
LDFLAGS=$LDFLAGS -L$LIBDIR
|
||||
|
||||
CLEANFILES=*.$O
|
||||
CC=9c
|
||||
LD=9l
|
||||
AS=9a
|
||||
AR=9ar
|
||||
INSTALL=install -c
|
||||
CFLAGS=
|
||||
LDFLAGS=
|
||||
AFLAGS=
|
||||
CLEANFILES=
|
||||
NUKEFILES=
|
||||
|
||||
INSTALL=install -c
|
||||
<|cat $PLAN9/src/mk.$SYSNAME-$OBJTYPE 2>/dev/null || true
|
||||
|
||||
|
|
|
|||
57
src/mkmany
57
src/mkmany
|
|
@ -1,73 +1,26 @@
|
|||
PROGS=${TARG:%=$O.%}
|
||||
|
||||
none:VQ:
|
||||
echo usage: mk all, install, installall, '$O'.cmd, cmd.install, or cmd.installall
|
||||
|
||||
PROGS=${TARG:%=$O.%}
|
||||
|
||||
all:V: $PROGS
|
||||
|
||||
$O.%: %.$O $OFILES $LIB
|
||||
$LD -o $target $prereq $LDFLAGS
|
||||
|
||||
%.$O: $HFILES # don't combine with following %.$O rules
|
||||
|
||||
%.$O: %.c
|
||||
$CC $CFLAGS $stem.c
|
||||
|
||||
%.$O: %.s
|
||||
$AS $AFLAGS $stem.s
|
||||
|
||||
y.tab.h y.tab.c: $YFILES
|
||||
$YACC $YFLAGS $prereq
|
||||
|
||||
%.install:V: $BIN/%
|
||||
|
||||
$BIN/%: $O.%
|
||||
$INSTALL $O.$stem $BIN/$stem
|
||||
|
||||
%.installall:V:
|
||||
for (objtype in $CPUS)
|
||||
mk $stem.install
|
||||
|
||||
install:V:
|
||||
# for (i in $TARG)
|
||||
# mk $MKFLAGS $i.install
|
||||
for i in $TARG
|
||||
do
|
||||
mk $MKFLAGS $i.install
|
||||
done
|
||||
|
||||
installall:V:
|
||||
for(objtype in $CPUS)
|
||||
mk $MKFLAGS install
|
||||
CLEANFILES=$CLEANFILES $PROGS
|
||||
NUKEFILES=$NUKEFILES ${TARG:%=$BIN/%}
|
||||
|
||||
%.safeinstall:V:
|
||||
mk $O.$stem
|
||||
test -e $BIN/$stem && mv $BIN/$stem $BIN/_$stem
|
||||
mk $stem.install
|
||||
<$PLAN9/src/mkcommon
|
||||
|
||||
%.safeinstallall:V:
|
||||
for(objtype in $CPUS)
|
||||
mk $MKFLAGS $stem.safeinstall
|
||||
|
||||
safeinstall:V:
|
||||
for(i in $TARG)
|
||||
mk $MKFLAGS $i.safeinstall
|
||||
|
||||
safeinstallall:V:
|
||||
for (objtype in $CPUS)
|
||||
mk safeinstall
|
||||
|
||||
update:V:
|
||||
update $UPDATEFLAGS $UPDATE
|
||||
|
||||
nuke:V:
|
||||
rm -f *.[$OS] y.tab.? y.debug y.output [$OS].* *.acid $TARG $NUKEFILES
|
||||
|
||||
clean:V:
|
||||
rm -f *.[$OS] y.tab.? y.debug y.output [$OS].* $TARG $CLEANFILES
|
||||
|
||||
%.clean:V:
|
||||
rm -f $stem.[$OS] [$OS].$stem $stem.acid $stem
|
||||
|
||||
%.acid: %.$O $HFILES
|
||||
$CC $CFLAGS -a $stem.c >$target
|
||||
|
|
|
|||
10
src/mkmk.sh
10
src/mkmk.sh
|
|
@ -19,7 +19,7 @@ cd libutf
|
|||
9c utfrrune.c
|
||||
9c utfrune.c
|
||||
9c utfutf.c
|
||||
ar rvc ../../lib/libutf.a rune.o runestrcat.o runestrchr.o runestrcmp.o runestrcpy.o runestrdup.o runestrlen.o runestrecpy.o runestrncat.o runestrncmp.o runestrncpy.o runestrrchr.o runestrstr.o runetype.o utfecpy.o utflen.o utfnlen.o utfrrune.o utfrune.o utfutf.o
|
||||
9ar rvc ../../lib/libutf.a rune.o runestrcat.o runestrchr.o runestrcmp.o runestrcpy.o runestrdup.o runestrlen.o runestrecpy.o runestrncat.o runestrncmp.o runestrncpy.o runestrrchr.o runestrstr.o runetype.o utfecpy.o utflen.o utfnlen.o utfrrune.o utfrune.o utfutf.o
|
||||
cd ..
|
||||
cd libfmt
|
||||
9c dofmt.c
|
||||
|
|
@ -56,7 +56,7 @@ cd libfmt
|
|||
9c vsnprint.c
|
||||
9c charstod.c
|
||||
9c pow10.c
|
||||
ar rvc ../../lib/libfmt.a dofmt.o errfmt.o fltfmt.o fmt.o fmtfd.o fmtfdflush.o fmtlock.o fmtprint.o fmtquote.o fmtrune.o fmtstr.o fmtvprint.o fprint.o nan64.o print.o runefmtstr.o runeseprint.o runesmprint.o runesnprint.o runesprint.o runevseprint.o runevsmprint.o runevsnprint.o seprint.o smprint.o snprint.o sprint.o strtod.o vfprint.o vseprint.o vsmprint.o vsnprint.o charstod.o pow10.o
|
||||
9ar rvc ../../lib/libfmt.a dofmt.o errfmt.o fltfmt.o fmt.o fmtfd.o fmtfdflush.o fmtlock.o fmtprint.o fmtquote.o fmtrune.o fmtstr.o fmtvprint.o fprint.o nan64.o print.o runefmtstr.o runeseprint.o runesmprint.o runesnprint.o runesprint.o runevseprint.o runevsmprint.o runevsnprint.o seprint.o smprint.o snprint.o sprint.o strtod.o vfprint.o vseprint.o vsmprint.o vsnprint.o charstod.o pow10.o
|
||||
cd ..
|
||||
cd libbio
|
||||
9c bbuffered.c
|
||||
|
|
@ -75,7 +75,7 @@ cd libbio
|
|||
9c bwrite.c
|
||||
9c bgetrune.c
|
||||
9c bputrune.c
|
||||
ar rvc ../../lib/libbio.a bbuffered.o bfildes.o bflush.o bgetc.o bgetd.o binit.o boffset.o bprint.o bputc.o brdline.o brdstr.o bread.o bseek.o bwrite.o bgetrune.o bputrune.o
|
||||
9ar rvc ../../lib/libbio.a bbuffered.o bfildes.o bflush.o bgetc.o bgetd.o binit.o boffset.o bprint.o bputc.o brdline.o brdstr.o bread.o bseek.o bwrite.o bgetrune.o bputrune.o
|
||||
cd ..
|
||||
cd libregexp
|
||||
9c regcomp.c
|
||||
|
|
@ -86,7 +86,7 @@ cd libregexp
|
|||
9c rregaux.c
|
||||
9c rregexec.c
|
||||
9c rregsub.c
|
||||
ar rvc ../../lib/libregexp9.a regcomp.o regerror.o regexec.o regsub.o regaux.o rregaux.o rregexec.o rregsub.o
|
||||
9ar rvc ../../lib/libregexp9.a regcomp.o regerror.o regexec.o regsub.o regaux.o rregaux.o rregexec.o rregsub.o
|
||||
cd ..
|
||||
cd cmd/mk
|
||||
9c arc.c
|
||||
|
|
@ -111,6 +111,6 @@ cd cmd/mk
|
|||
9c varsub.c
|
||||
9c word.c
|
||||
9c unix.c
|
||||
9l -o o.mk arc.o archive.o bufblock.o env.o file.o graph.o job.o lex.o main.o match.o mk.o parse.o recipe.o rule.o run.o sh.o shprint.o symtab.o var.o varsub.o word.o unix.o -L../../../lib -lregexp9 -lbio -lfmt -lutf
|
||||
9l -o o.mk arc.o archive.o bufblock.o env.o file.o graph.o job.o lex.o main.o match.o mk.o parse.o recipe.o rule.o run.o sh.o shprint.o symtab.o var.o varsub.o word.o unix.o -lregexp9 -lbio -lfmt -lutf
|
||||
install -c o.mk ../../../bin/mk
|
||||
cd ..
|
||||
|
|
|
|||
35
src/mkone
35
src/mkone
|
|
@ -2,43 +2,16 @@ PROG=$O.$TARG
|
|||
|
||||
all:V: $PROG
|
||||
|
||||
$O.$TARG: $OFILES $LIB
|
||||
$PROG: $OFILES $LIB
|
||||
$LD -o $target $prereq $LDFLAGS
|
||||
|
||||
%.$O: $HFILES # don't combine with following %.$O rules
|
||||
|
||||
%.$O: %.c
|
||||
$CC $CFLAGS $stem.c
|
||||
|
||||
%.$O: %.s
|
||||
$AS $AFLAGS $stem.s
|
||||
|
||||
y.tab.h y.tab.c: $YFILES
|
||||
$YACC $YFLAGS $prereq
|
||||
|
||||
install:V: $TARG.install
|
||||
%.install:V: $BIN/%
|
||||
|
||||
$BIN/%: $O.%
|
||||
$INSTALL $O.$stem $BIN/$stem
|
||||
|
||||
%.installall:V:
|
||||
for (objtype in $CPUS)
|
||||
mk $stem.install
|
||||
NUKEFILES=$NUKEFILES $BIN/$TARG
|
||||
|
||||
install:V: $TARG.install
|
||||
<$PLAN9/src/mkcommon
|
||||
|
||||
installall:V:
|
||||
for(objtype in $CPUS)
|
||||
mk $MKFLAGS install
|
||||
|
||||
nuke:V:
|
||||
rm -f *.[$OS] y.tab.? y.debug y.output [$OS].* *.acid $TARG $NUKEFILES
|
||||
|
||||
clean:V:
|
||||
rm -f *.[$OS] y.tab.? y.debug y.output [$OS].* $TARG $CLEANFILES
|
||||
|
||||
%.clean:V:
|
||||
rm -f $stem.[$OS] [$OS].$stem $stem.acid $stem
|
||||
|
||||
%.acid: %.$O $HFILES
|
||||
$CC $CFLAGS -a $stem.c >$target
|
||||
|
|
|
|||
|
|
@ -8,4 +8,6 @@ $PLAN9/lib/$LIB:V: $OFILES # force archive even when not needed
|
|||
|
||||
all install:V: $PLAN9/lib/$LIB
|
||||
|
||||
NUKEFILES=$NUKEFILES $PLAN9/lib/$LIB
|
||||
|
||||
<$PLAN9/src/mkcommon
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue