OK, turing.

<- leave blank

Fri Jul 19 14:28:12 EDT 2024

/proc/7449/text:arm64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/arm64
acid: RenderBackend_CalcMask(s=0xbcf300)+0x190
/usr/mkf/tmp/src/cstory/src/Backends/Rendering/9front.cpp:216
	r=0x0
	w=0x321b000000280
	h=0x280000001e0
	m=0xcde4f8
	mask=0xe330f8
RenderBackend_Blit(colour_key=0x1,x=0x90,y=0xae,rect=0xc00b0,source_surface=0xbcf300,destination_surface=0xc1200)+0xec
/usr/mkf/tmp/src/cstory/src/Backends/Rendering/9front.cpp:240
	r=0x0
	r2=0xae00000090
PutBitmap3(surf_no=0x15,x=0x48,y=0x1000000057,rect=0x1c4108)+0x1a8
/usr/mkf/tmp/src/cstory/src/Draw.cpp:494
PutNpChar(fx=0x0,fy=0x0)+0x160 /usr/mkf/tmp/src/cstory/src/NpChar.cpp:374
	a=0xaa00000000
	n=0x372e8000000aa
ModeOpening()+0x178 /usr/mkf/tmp/src/cstory/src/Game.cpp:195
	wait=0x1
	frame_x=0x3925800000000
	frame_y=0x0
Game()+0x9c /usr/mkf/tmp/src/cstory/src/Game.cpp:729
	path=0x6d61672f7379732f
npe_main_renamed()+0x678 /usr/mkf/tmp/src/cstory/src/Main.cpp:351
	conf=0x0
	unused_rect=0x0
	window_icon_resource_size=0xe7
	window_icon_width=0xfefefefe00000090
	window_icon_height=0x9000000040
	window_icon_rgb_pixels=0x2440e0
	cursor_resource_size=0xfefefefe00000090
	cursor_width=0x2440e000000008
	cursor_height=0x800000040
	cursor_rgba_pixels=0x0
	rcLoading=0x0
	rcFull=0x0
threadmain(argv=0x1fffeff98,argc=0xfefefefe00000001)+0x28
/usr/mkf/tmp/src/npe/libnpe/_main.c:23
mainlauncher()+0x10 /sys/src/libthread/main.c:17
launcherarm64(arg=0x1fffeff98,f=0xa78ec)+0x8 /sys/src/libthread/arm64.c:8
launcherarm64(arg=0x1fffeff98,f=0xa78ec)+0xfffffffffffffff8
/sys/src/libthread/channel.c:583
RenderBackend_CalcMask+0x124
/usr/mkf/tmp/src/cstory/src/Backends/Rendering/9front.cpp:208
acid:
echo kill > /proc/7449/ctl


Fri Jul 19 12:19:37 EDT 2024
> (define ((foo bar) baz) (baz bar))
> ((foo 1) integer?)
#t
> (define (foo bar) (lambda (baz) (baz bar)))
> ((foo 1) integer?)
#t

Fri Jul 19 11:59:21 EDT 2024
diff 23e7a571724aa78dd33ffdde9da1c0fa330c3aae uncommitted
--- a/sys/src/cmd/ip/ipconfig/ipv6.c
+++ b/sys/src/cmd/ip/ipconfig/ipv6.c
@@ -662,8 +662,7 @@
	for(rr = &routelist; (r = *rr) != nil;){
		if(m > 100
		|| r->prefixlt != ~0UL && r->prefixlt < now-r->time
- || r->routerlt != ~0UL && r->routerlt < now-r->time
- || ipcmp(r->src, ra->src) == 0 && r->routerlt != 0 && conf.routerlt ==
0){
+ || r->routerlt != ~0UL && r->routerlt < now-r->time){
			DEBUG("purging RA from %I on %s; pfx %I %M",
				r->src, conf.dev, r->laddr, r->mask);
			if(!noconfig && validip(r->gaddr))
@@ -758,7 +757,7 @@
			}
		} else {
			seen = 0;
- if(conf.preflt == 0)
+ if(conf.validlt == 0)
				continue;
			r = malloc(sizeof(*r));
		}


Fri Jul 19 09:05:57 EDT 2024
(def- data
  [[75]
   [95 64]
   [17 47 82]
   [18 35 87 10]
   [20 04 82 47 65]
   [19 01 23 75 03 34]
   [88 02 77 73 07 63 67]
   [99 65 04 28 06 16 70 92]
   [41 41 26 56 83 40 80 70 33]
   [41 48 72 33 47 32 37 16 94 29]
   [53 71 44 65 25 43 91 52 97 51 14]
   [70 11 33 28 77 73 17 78 39 68 17 57]
   [91 71 52 38 17 14 91 43 58 50 27 29 48]
   [63 66 04 68 89 53 67 30 73 16 69 87 40 31]
   [04 62 98 27 23 09 70 98 73 93 38 53 60 04 23]])

(defn- car [l] (get l 0))
(defn- cdr [l] (slice l 1))
(defn- C [f y] (fn [x] (f x y)))
(defn- null?  [l] (= (length l) 0))

(defn- L [l i]
  (if (null?  l)
    @[0]
    (let [cur (get (car l) i)]
     (map (C + cur) (array/concat (L (cdr l) i) (L (cdr l) (+ i 1)))))))

(def- l (L data 0))

(print (apply max l))

Fri Jul 19 07:16:03 EDT 2024
(def- data
  [[75]
   [95 64]
   [17 47 82]
   [18 35 87 10]
   [20 04 82 47 65]
   [19 01 23 75 03 34]
   [88 02 77 73 07 63 67]
   [99 65 04 28 06 16 70 92]
   [41 41 26 56 83 40 80 70 33]
   [41 48 72 33 47 32 37 16 94 29]
   [53 71 44 65 25 43 91 52 97 51 14]
   [70 11 33 28 77 73 17 78 39 68 17 57]
   [91 71 52 38 17 14 91 43 58 50 27 29 48]
   [63 66 04 68 89 53 67 30 73 16 69 87 40 31]
   [04 62 98 27 23 09 70 98 73 93 38 53 60 04 23]])

(defn- car [l] (get l 0))
(defn- cdr [l] (slice l 1))
(defn- C [f y] (fn [x] (f x y)))
(defn- null?  [l] (= (length l) 0))

(defn- L [l i]
  (if (null?  l)
    [0]
    (let [cur (get (car l) i)]
      (array/concat (map (C + cur) (L (cdr l) i))
		    (map (C + cur) (L (cdr l) (+ i 1)))))))

(def- l (L data 0))

(print (apply max l))


Fri Jul 19 07:14:37 EDT 2024
(def- data
  [[75]
   [95 64]
   [17 47 82]
   [18 35 87 10]
   [20 04 82 47 65]
   [19 01 23 75 03 34]
   [88 02 77 73 07 63 67]
   [99 65 04 28 06 16 70 92]
   [41 41 26 56 83 40 80 70 33]
   [41 48 72 33 47 32 37 16 94 29]
   [53 71 44 65 25 43 91 52 97 51 14]
   [70 11 33 28 77 73 17 78 39 68 17 57]
   [91 71 52 38 17 14 91 43 58 50 27 29 48]
   [63 66 04 68 89 53 67 30 73 16 69 87 40 31]
   [04 62 98 27 23 09 70 98 73 93 38 53 60 04 23]])

(defn- car [l]
  (get l 0))

(defn- cdr [l]
  (slice l 1))

(defn- C [f y]
  (fn [x] (f x y)))

(defn- null?  [l]
  (= (length l) 0))

(defn- L [l i]
  (if (null?  l)
    [0]
    (let [cur (get (car l) i)]
      (array/concat (map (C + cur) (L (cdr l) i))
		    (map (C + cur) (L (cdr l) (+ i 1)))))))

(def- l (L data 0))

(pp (apply max l))


Thu Jul 18 21:26:17 EDT 2024
stop changing your rss feed url.

Thu Jul 18 18:15:36 EDT 2024
diff 6a049aafed49313b2b4c1e2803ac525fdda82307 uncommitted
--- a/sys/src/cmd/date.c
+++ b/sys/src/cmd/date.c
@@ -8,7 +8,7 @@
 void
 usage(void)
 {
- fprint(2, "usage: date [-itun] [-f fmt] [seconds]\n");
+ fprint(2, "usage: date [-itun] [-f fmt] [seconds] [delta...]\n");
	exits("usage");
 }

@@ -15,9 +15,9 @@
 void
 main(int argc, char *argv[])
 {
- int nflg, uflg;
- char *fmt;
- vlong s, ns;
+ int i, nflg, uflg;
+ char *fmt, *e;
+ vlong s, Δ, ns;
	Tzone *tz;
	Tm tm;

@@ -36,21 +36,14 @@
	default: usage();
	}ARGEND

- s = 0;
- ns = 0;
- switch(argc) {
- case 0:
- ns = nsec();
- s = ns/Nsec;
- ns = ns%Nsec;
- break;
- case 1:
+ ns = nsec();
+ s = ns/Nsec;
+ ns = ns%Nsec;
+ if(argc > 0 && argv[0][0] != '-' && argv[0][0] != '+'){
		s = strtoll(argv[0], nil, 0);
		ns = 0;
- break;
- default:
- usage();
- break;
+ argv++;
+ argc--;
	}

	if(!uflg && (tz = tzload("local")) == nil)
@@ -58,8 +51,33 @@
	if(tmtimens(&tm, s, ns, tz) == nil)
		sysfatal("now: %r");

+ for(i = 0; i < argc; i++){
+ if(argv[0][0] != '-' && argv[0][0] != '+')
+ usage();
+ Δ = strtoll(argv[0], &e, 10);
+ if(strcmp(e, "Y") == 0 || strcmp(e, "year") == 0)
+ tm.year += Δ;
+ else if(strcmp(e, "M") == 0 || strcmp(e, "mon") == 0)
+ tm.mon += Δ;
+ else if(strcmp(e, "D") == 0 || strcmp(e, "day") == 0)
+ tm.mday += Δ;
+ else if(strcmp(e, "h") == 0 || strcmp(e, "hr") == 0)
+ tm.hour += Δ;
+ else if(strcmp(e, "m") == 0 || strcmp(e, "min") == 0)
+ tm.min += Δ;
+ else if(strcmp(e, "s") == 0 || strcmp(e, "sec") == 0 || *e == 0)
+ tm.sec += Δ;
+ else if(strcmp(e, "ms") == 0)
+ tm.nsec += 1000*1000*Δ;
+ else if(strcmp(e, "ns") == 0)
+ tm.nsec += Δ;
+ else
+ sysfatal("bad delta %s\n", e);
+ }
+
+ s = tmnorm(&tm);
	if(nflg)
- print("%lld\n", tmnorm(&tm));
+ print("%lld\n", s);
	else
		if(print("%τ\n", tmfmt(&tm, fmt)) == -1)
			sysfatal("%r");


Thu Jul 18 18:15:22 EDT 2024
diff 6a049aafed49313b2b4c1e2803ac525fdda82307 uncommitted
--- a/sys/src/cmd/9l/asmout.c
+++ b/sys/src/cmd/9l/asmout.c
@@ -1452,7 +1452,6 @@
	case AMOVHZ: return OPVCC(31,279,0,0); /* lhzx */
	case AMOVHZU: return OPVCC(31,311,0,0); /* lhzux */
	case AECIWX: return OPVCC(31,310,0,0); /* eciwx */
- case ALBAR: return OPVCC(31,52,0,0); /* lbarx */
	case ALHAR: return OPVCC(31,116,0,0); /* lharx */
	case ALWAR: return OPVCC(31,20,0,0); /* lwarx */
	case ALDAR: return OPVCC(31,84,0,0); /* ldarx */
@@ -1460,6 +1459,7 @@
	case ALSW: return OPVCC(31,533,0,0); /* lswx */
	case AMOVD: return OPVCC(31,21,0,0); /* ldx */
	case AMOVDU: return OPVCC(31,53,0,0); /* ldux */
+ case ALBAR: return OPVCC(31,52,0,0); /* lbarx */
	}
	diag("bad loadx opcode %A", a);
	return 0;
--- a/sys/src/cmd/alarm.c
+++ b/sys/src/cmd/alarm.c
@@ -43,12 +43,13 @@
 {
	char buf[1024], *p, *q;
	Waitmsg *w;
- long n, t;
+ double n;
+ long t;

	argv0 = argv[0];
	if(argc < 3)
		usage();
- n = strtol(argv[1], &p, 10);
+ n = strtod(argv[1], &p, 10);
	if(n < 0)
		usage();
	t = n * 1000;
--- a/sys/src/cmd/aux/tablet.c
+++ b/sys/src/cmd/aux/tablet.c
@@ -6,15 +6,18 @@
 int mouseout;

 int
-main()
+main(void)
 {
+ char *line, *p;
+ int x, y, b, ox, oy;
+
+ ox = -1;
+ oy = -1;
	mouseout = open("/dev/mousein", OWRITE);
	if(mouseout < 0) sysfatal("%r");
	tablet = Bopen("/dev/tablet", OREAD);
	if(tablet == nil) sysfatal("%r");
	while(1) {
- char *line, *p;
- int x, y, b;

		line = Brdline(tablet, 10);
		if(!line) sysfatal("%r");
@@ -27,6 +30,12 @@
		if(*p++ != ' ') continue;
		b = strtol(p, &p, 10);
		if(*p++ != ' ') continue;
+ if(b==1){
+ if(ox == -1) ox = x;
+ if(oy == -1) oy = y;
+ if(ox-x >= 100 || x-ox >=100) continue;
+ if(oy-y >= 100 || y-oy >=100) continue;
+ }
		fprint(mouseout, "A %d %d %d\n", x, y, b);
	}
 }
\ No newline at end of file
--- a/sys/src/cmd/cc/com64.c
+++ b/sys/src/cmd/cc/com64.c
@@ -191,7 +191,6 @@

	l = n->left;
	r = n->right;
-
	lv = 0;
	if(l && l->type && typev[l->type->etype])
		lv = 1;
@@ -277,11 +276,13 @@
		}
	}

+prtree(n, "dump");
	if(typev[n->type->etype]) {
		if(machcap(n))
			return 1;
		switch(n->op) {
		default:
+abort();
			diag(n, "unknown vlong %O", n->op);
		case OFUNC:
			n->complex = FNX;
--- a/sys/src/cmd/cp.c
+++ b/sys/src/cmd/cp.c
@@ -159,13 +159,14 @@
 int
 copy1(int fdf, int fdt, char *from, char *to)
 {
- char *buf;
+ char *buf, *zbuf;
	long n, n1, rcount;
	int rv;
	char err[ERRMAX];

	buf = malloc(buflen);
- if(buf == nil){
+ zbuf = malloc(buflen);
+ if(buf == nil || zbuf == nil){
		fprint(2, "cp: out of memory\n");
		return -1;
	}
@@ -174,11 +175,15 @@
	err[0] = '\0';
	errstr(err, ERRMAX);
	rv = 0;
+ memset(zbuf, 0, buflen);
	for(rcount=0;; rcount++) {
		n = read(fdf, buf, buflen);
		if(n <= 0)
			break;
- n1 = write(fdt, buf, n);
+ if(memcmp(buf, zbuf, buflen))
+ n1 = seek(fdt, buflen, 1);
+ else
+ n1 = write(fdt, buf, n);
		if(n1 != n) {
			fprint(2, "cp: error writing %s: %r\n", to);
			failed = 1;
@@ -191,6 +196,7 @@
		failed = 1;
		rv = -1;
	}
+ free(zbuf);
	free(buf);
	return rv;
 }
--- a/sys/src/cmd/date.c
+++ b/sys/src/cmd/date.c
@@ -8,7 +8,7 @@
 void
 usage(void)
 {
- fprint(2, "usage: date [-itun] [-f fmt] [seconds]\n");
+ fprint(2, "usage: date [-itun] [-f fmt] [seconds] [delta...]\n");
	exits("usage");
 }

@@ -15,9 +15,9 @@
 void
 main(int argc, char *argv[])
 {
- int nflg, uflg;
- char *fmt;
- vlong s, ns;
+ int i, nflg, uflg;
+ char *fmt, *e;
+ vlong s, Δ, ns;
	Tzone *tz;
	Tm tm;

@@ -36,21 +36,14 @@
	default: usage();
	}ARGEND

- s = 0;
- ns = 0;
- switch(argc) {
- case 0:
- ns = nsec();
- s = ns/Nsec;
- ns = ns%Nsec;
- break;
- case 1:
+ ns = nsec();
+ s = ns/Nsec;
+ ns = ns%Nsec;
+ if(argc > 0 && argv[0][0] != '-' && argv[0][0] != '+'){
		s = strtoll(argv[0], nil, 0);
		ns = 0;
- break;
- default:
- usage();
- break;
+ argv++;
+ argc--;
	}

	if(!uflg && (tz = tzload("local")) == nil)
@@ -58,8 +51,33 @@
	if(tmtimens(&tm, s, ns, tz) == nil)
		sysfatal("now: %r");

+ for(i = 0; i < argc; i++){
+ if(argv[0][0] != '-' && argv[0][0] != '+')
+ usage();
+ Δ = strtoll(argv[0], &e, 10);
+ if(strcmp(e, "Y") == 0 || strcmp(e, "year") == 0)
+ tm.year += Δ;
+ else if(strcmp(e, "M") == 0 || strcmp(e, "mon") == 0)
+ tm.mon += Δ;
+ else if(strcmp(e, "D") == 0 || strcmp(e, "day") == 0)
+ tm.mday += Δ;
+ else if(strcmp(e, "h") == 0 || strcmp(e, "hr") == 0)
+ tm.hour += Δ;
+ else if(strcmp(e, "m") == 0 || strcmp(e, "min") == 0)
+ tm.min += Δ;
+ else if(strcmp(e, "s") == 0 || strcmp(e, "sec") == 0 || *e == 0)
+ tm.sec += Δ;
+ else if(strcmp(e, "ms") == 0)
+ tm.nsec += 1000*1000*Δ;
+ else if(strcmp(e, "ns") == 0)
+ tm.nsec += Δ;
+ else
+ sysfatal("bad delta %s\n", e);
+ }
+
+ s = tmnorm(&tm);
	if(nflg)
- print("%lld\n", tmnorm(&tm));
+ print("%lld\n", s);
	else
		if(print("%τ\n", tmfmt(&tm, fmt)) == -1)
			sysfatal("%r");
--- a/sys/src/cmd/flambe.c
+++ b/sys/src/cmd/flambe.c
@@ -272,7 +272,7 @@
			}
			break;
		case Cmouse:
- if(m.buttons == 4 || m.buttons == 16){
+ if(m.buttons == (1<<2) || m.buttons == (1<<4)){
				redraw(1);
				break;
			}
@@ -283,7 +283,11 @@
				case 0:
					onhover(i);
					break;
- case 1: case 8:
+ case 1<<2:
+ plumb(i);
+ break;
+ case 1<<0:
+ case 1<<3:
					redraw(i);
					break;
				}
--- a/sys/src/cmd/gzip/unzip.c
+++ b/sys/src/cmd/gzip/unzip.c
@@ -529,7 +529,7 @@
 findCDir(Biobuf *bin, char *file)
 {
	vlong ecoff;
- long off, size;
+ vlong off, size;
	int entries, zclen, dn, ds, de;

	ecoff = Bseek(bin, -ZECHeadSize, 2);
@@ -566,6 +566,21 @@
		if(dn || ds || de != entries)
			print("\tcurrent disk=%d start disk=%d table entries on
			this disk=%d\n", dn, ds, de);
	}
+ if(off == -1){
+ if(findCDir64(bin, file) == -1)
+ fprint(2, "unzip: could not find zip64 header of %s\n", file);
+ longjmp(seekjmp, 1);
+ }
+ dn = get2(bin);
+ ds = get2(bin);
+ de = get2(bin);
+ entries = get2(bin);
+ size = get4(bin);
+ off = get4(bin);
+ zclen = get2(bin);
+ while(zclen-- > 0)
+ get1(bin);
+ }

	if(Bseek(bin, off, 0) != off){
		fprint(2, "unzip: can't seek to start of contents of %s\n", file);
@@ -795,7 +810,7 @@
	vfprint(2, fmt, arg);
	va_end(arg);
	fprint(2, "\n");
-
+abort();
	if(delfile != nil){
		fprint(2, "unzip: removing output file %s\n", delfile);
		remove(delfile);
--- a/sys/src/cmd/gzip/zip.c
+++ b/sys/src/cmd/gzip/zip.c
@@ -393,6 +393,5 @@
	vfprint(2, fmt, arg);
	va_end(arg);
	fprint(2, "\n");
-
	longjmp(zjmp, 1);
 }
--- a/sys/src/cmd/ip/dhcpd/dhcpd.c
+++ b/sys/src/cmd/ip/dhcpd/dhcpd.c
@@ -1539,7 +1539,7 @@
 {
	int n;

- n = strlen(str);
+ n = strlen(str)+1;
	if(n > 255)
		n = 255;
	if(rp->p+n+2 > rp->max)
--- a/sys/src/cmd/mk/archive.c
+++ b/sys/src/cmd/mk/archive.c
@@ -13,7 +13,7 @@

	archive = split(name, &member);
	if(archive == 0)
- Exit();
+ Fatal("mk: '%s' is not an archive", name);

	t = mtime(archive);
	sym = symlook(archive, S_AGG, 0);
@@ -46,15 +46,13 @@

	archive = split(name, &member);
	if(archive == 0)
- Exit();
+ Fatal("mk: '%s' is not an archive", name);

	fd = open(archive, ORDWR);
	if(fd < 0){
		fd = create(archive, OWRITE, 0666);
- if(fd < 0){
- perror(archive);
- Exit();
- }
+ if(fd < 0)
+ Fatal("%s: %r", archive);
		write(fd, ARMAG, SARMAG);
	}
	if(symlook(name, S_TIME, 0)){
@@ -159,7 +157,6 @@
			*q = 0;
		if(type(p))
			return p;
- fprint(2, "mk: '%s' is not an archive\n", name);
	}
	free(p);
	return 0;
--- a/sys/src/cmd/mk/file.c
+++ b/sys/src/cmd/mk/file.c
@@ -41,10 +41,8 @@

	if(utfrune(name, '('))
		atouch(name); /* archive */
- else if(chgtime(name) < 0) {
- perror(name);
- Exit();
- }
+ else if(chgtime(name) < 0)
+ Fatal("%s: %r", name);
 }

 void
--- a/sys/src/cmd/mk/fns.h
+++ b/sys/src/cmd/mk/fns.h
@@ -26,7 +26,8 @@
 int escapetoken(Biobuf*, Bufblock*, int, int);
 Symtab **execinit(void);
 int execsh(char*, char*, Symtab**, Bufblock*);
-void Exit(void);
+_Noreturn void Fatal(char*, ...);
+_Noreturn void Exit(char*, ...);
 char *expandquote(char*, Rune, Bufblock*);
 void expunge(int, char*);
 void freearc(Arc*);
--- a/sys/src/cmd/mk/graph.c
+++ b/sys/src/cmd/mk/graph.c
@@ -208,10 +208,8 @@
 {
	Arc *a;

- if((n->flags&CYCLE) && n->prereqs){
- fprint(2, "mk: cycle in graph detected at target %s\n", n->name);
- Exit();
- }
+ if((n->flags&CYCLE) && n->prereqs)
+ Fatal("mk: cycle in graph detected at target %s", n->name);
	n->flags |= CYCLE;
	for(a = n->prereqs; a; a = a->next)
		if(a->n)
@@ -255,7 +253,7 @@
		}
	}
	if(bad)
- Exit();
+ Exit("ambiguous recipe");
	togo(n);
 }

--- a/sys/src/cmd/mk/lex.c
+++ b/sys/src/cmd/mk/lex.c
@@ -29,11 +29,11 @@
		case '"':
			rinsert(buf, c);
			if (escapetoken(bp, buf, 1, c) == 0)
- Exit();
+ Exit("bad token");
			break;
		case '`':
			if (bquote(bp, buf) == 0)
- Exit();
+ Exit("bad quote");
			break;
		case '#':
			lastc = '#';
--- a/sys/src/cmd/mk/main.c
+++ b/sys/src/cmd/mk/main.c
@@ -154,10 +154,8 @@

	catchnotes();
	if(args == 0){
- if(target1 == 0){
- fprint(2, "mk: nothing to mk\n");
- Exit();
- }
+ if(target1 == 0)
+ Fatal("mk: nothing to mk");
		for(; target1; target1 = popword(target1))
			mk(target1->s);
	} else {
@@ -183,8 +181,7 @@
 void
 badusage(void)
 {
- fprint(2, "usage: mk [-f file] [-n] [-a] [-e] [-t] [-k] [-i] [-d[egp]] [targets
...]\n");
- Exit();
+ Fatal("usage: mk [-f file] [-n] [-a] [-e] [-t] [-k] [-i] [-d[egp]] [targets
...]");
 }

 void *
@@ -193,10 +190,8 @@
	void *s;

	s = malloc(n);
- if(!s) {
- fprint(2, "mk: cannot alloc %d bytes\n", n);
- Exit();
- }
+ if(!s)
+ Fatal("mk: cannot alloc %d bytes", n);
	setmalloctag(s, getcallerpc(&n));
	return(s);
 }
@@ -208,10 +203,8 @@
		s = realloc(s, n);
	else
		s = malloc(n);
- if(!s) {
- fprint(2, "mk: cannot alloc %d bytes\n", n);
- Exit();
- }
+ if(!s)
+ Fatal("mk: cannot alloc %d bytes", n);
	setrealloctag(s, getcallerpc(&s));
	return(s);
 }
@@ -230,10 +223,9 @@
 regerror(char *s)
 {
	if(patrule)
- fprint(2, "mk: %s:%d: regular expression error; %s\n",
+ Fatal("mk: %s:%d: regular expression error; %s",
			patrule->file, patrule->line, s);
	else
- fprint(2, "mk: %s:%d: regular expression error; %s\n",
+ Fatal("mk: %s:%d: regular expression error; %s",
			mkinfile, mkinline, s);
- Exit();
 }
--- a/sys/src/cmd/mk/mk.c
+++ b/sys/src/cmd/mk/mk.c
@@ -99,7 +99,7 @@
				node->flags |= BEINGMADE;
				runerrs++;
			} else
- Exit();
+ Exit("unknown target %s", node->name);
		} else
			MADESET(node, MADE);
		return(did);
--- a/sys/src/cmd/mk/parse.c
+++ b/sys/src/cmd/mk/parse.c
@@ -19,10 +19,8 @@
	Bufblock *buf;
	Biobuf in;

- if(fd < 0){
- perror(f);
- Exit();
- }
+ if(fd < 0)
+ Fatal("mk: open %s: %r", f);
	Binit(&in, fd, OREAD);
	ipush(f);
	buf = newbuf();
@@ -34,14 +32,12 @@
			p = wtos(tail);
			if(*p == 0){
				SYNERR(-1);
- fprint(2, "missing include file name\n");
- Exit();
+ Fatal("missing include file name");
			}
			newfd = open(p, OREAD|OCEXEC);
- if(newfd < 0){
- fprint(2, "warning: skipping missing include file: ");
- perror(p);
- } else
+ if(newfd < 0)
+ Fatal("warning: skipping missing include file: %r");
+ else
				parse(p, newfd);
			free(p);
			break;
@@ -49,21 +45,17 @@
			p = wtos(tail);
			if(*p == 0){
				SYNERR(-1);
- fprint(2, "missing include program name\n");
- Exit();
+ Fatal("missing include program name");
			}
			pid=pipecmd(p, 0, execinit(), &newfd);
- if(newfd < 0){
- fprint(2, "warning: skipping missing program file: ");
- perror(p);
- } else
+ if(newfd < 0)
+ Fatal("warning: skipping missing program file: %r");
+ else
				parse(p, newfd);
			while(waitup(-3, &pid) >= 0)
				;
- if(pid != 0){
- fprint(2, "bad include program status\n");
- Exit();
- }
+ if(pid != 0)
+ Fatal("bad include program status");
			free(p);
			break;
		case ':':
@@ -74,8 +66,7 @@
			continue;
		default:
			SYNERR(hline);
- fprint(2, "expected one of :<=\n");
- Exit();
+ Fatal("expected one of :<=");
			break;
		}
		delword(head);
@@ -93,8 +84,7 @@

	if(head->next){
		SYNERR(-1);
- fprint(2, "multiple vars on left side of assignment\n");
- Exit();
+ Fatal("multiple vars on left side of assignment");
	}
	if(symlook(head->s, S_OVERRIDE, 0)){
		set = override;
@@ -180,8 +170,7 @@
				{
				default:
					SYNERR(-1);
- fprint(2, "unknown attribute '%c'\n",*p);
- Exit();
+ Fatal("unknown attribute '%c'",*p);
				case 'U':
					*attr = 1;
					break;
@@ -201,8 +190,7 @@
			{
			default:
				SYNERR(-1);
- fprint(2, "unknown attribute '%c'\n", p[-1]);
- Exit();
+ Fatal("unknown attribute '%c'", p[-1]);
			case 'D':
				*attr |= DEL;
				break;
@@ -241,15 +229,13 @@
		if (*p++ != ':') {
	eos:
			SYNERR(-1);
- fprint(2, "missing trailing :\n");
- Exit();
+ Fatal("missing trailing :");
		}
	}
	*h = w = stow(line);
	if(empty(w) && sep != '<' && sep != '|') {
		SYNERR(mkinline-1);
- fprint(2, "no var on left side of assignment/rule\n");
- Exit();
+ Fatal("no var on left side of assignment/rule");
	}
	*t = stow(p);
	return(sep);
--- a/sys/src/cmd/mk/plan9.c
+++ b/sys/src/cmd/mk/plan9.c
@@ -179,15 +179,11 @@
	if(DEBUG(D_EXEC))
		fprint(1, "pipecmd='%s'\n", cmd);/**/

- if(fd && pipe(pfd) < 0){
- perror("pipe");
- Exit();
- }
+ if(fd && pipe(pfd) < 0)
+ Fatal("pipe: %r");
	pid = rfork(RFPROC|RFFDG|RFENVG);
- if(pid < 0){
- perror("mk fork");
- Exit();
- }
+ if(pid < 0)
+ Fatal("mk fork: %r");
	if(pid == 0){
		if(fd){
			close(pfd[0]);
@@ -214,12 +210,33 @@
	return pid;
 }

-void
-Exit(void)
+_Noreturn void
+Fatal(char *fmt, ...)
 {
+ char msg[1024];
+ va_list ap;
+
	while(waitpid() >= 0)
		;
- exits("error");
+ va_start(ap, fmt);
+ vsnprint(msg, sizeof(msg), fmt, ap);
+ fprint(2, "%s\n", msg);
+ va_end(ap);
+ exits(msg);
+}
+
+_Noreturn void
+Exit(char *fmt, ...)
+{
+ char msg[ERRMAX];
+ va_list ap;
+
+ while(waitpid() >= 0)
+ ;
+ va_start(ap, fmt);
+ vsnprint(msg, sizeof(msg), fmt, ap);
+ va_end(ap);
+ exits(msg);
 }

 int
--- a/sys/src/cmd/mk/recipe.c
+++ b/sys/src/cmd/mk/recipe.c
@@ -24,10 +24,9 @@
	if(r == 0){
		if(!(node->flags&VIRTUAL) && !(node->flags&NORECIPE)){
			if(getwd(cwd, sizeof cwd))
- fprint(2, "mk: no recipe to make '%s' in directory %s\n", node->name, cwd);
+ Fatal("mk: no recipe to make '%s' in directory %s", node->name, cwd);
			else
- fprint(2, "mk: no recipe to make '%s'\n", node->name);
- Exit();
+ Fatal("mk: no recipe to make '%s'", node->name);
		}
		if(strchr(node->name, '(') && node->time == 0)
			MADESET(node, MADE);
--- a/sys/src/cmd/mk/run.c
+++ b/sys/src/cmd/mk/run.c
@@ -123,11 +123,8 @@
	if(pid == -1){
		if(echildok > 0)
			return(1);
- else {
- fprint(2, "mk: (waitup %d) ", echildok);
- perror("mk wait");
- Exit();
- }
+ else
+ Fatal("mk: (waitup %d): %r", echildok);
	}
	if(DEBUG(D_EXEC))
		fprint(1, "waitup got pid=%d, status='%s'\n", pid, buf);
@@ -167,7 +164,7 @@
			uarg = 1;
		} else {
			jobs = 0;
- Exit();
+ Exit("jobq");
		}
	}
	for(w = j->t; w; w = w->next){
@@ -270,7 +267,7 @@
	while(waitup(1, (int *)0) == 0)
		;
	Bprint(&bout, "mk: %s\n", msg);
- Exit();
+ Exit(msg);
 }

 static long tslot[1000];
--- a/sys/src/cmd/mk/varsub.c
+++ b/sys/src/cmd/mk/varsub.c
@@ -82,8 +82,7 @@
	end = charin(cp, "}");
	if(end == 0){
		SYNERR(-1);
- fprint(2, "missing '}': %s\n", begin);
- Exit();
+ Fatal("missing '}': %s", begin);
	}
	*end = 0;
	*s = end+1;
--- a/sys/src/cmd/mk/word.c
+++ b/sys/src/cmd/mk/word.c
@@ -144,8 +144,7 @@
		case '"':
			cp = expandquote(cp, r, b);
			if(cp == 0){
- fprint(2, "missing closing quote: %s\n", *s);
- Exit();
+ Fatal("missing closing quote: %s", *s);
			}
			empty = 0;
			break;
--- a/sys/src/cmd/tar.c
+++ b/sys/src/cmd/tar.c
@@ -56,8 +56,7 @@
	Binsize = 0x80, /* flag in size[0], from gnu: positive binary size */
	Binnegsz = 0xff, /* flag in size[0]: negative binary size */

- Nblock = 40, /* maximum blocksize */
- Dblock = 20, /* default blocksize */
+ Dblock = IOUNIT/Tblock, /* blocksize */
	Debug = 0,
 };

--- a/sys/src/cmd/touch.c
+++ b/sys/src/cmd/touch.c
@@ -42,6 +42,7 @@
	exits(0);
 }

+void
 touch(int nocreate, char *name)
 {
	Dir stbuff;
--- a/sys/src/cmd/upas/common/folder.c
+++ b/sys/src/cmd/upas/common/folder.c
@@ -9,6 +9,7 @@
 struct Folder{
	int open;
	int ofd;
+ int dfd;
	int type;
	Biobuf *out;
	Mlock *l;
@@ -27,6 +28,7 @@
		if(f->open == 0){
			f->open = 1;
			f->ofd = -1;
+ f->dfd = -1;
			f->type = 0;
			return f;
		}
@@ -50,6 +52,8 @@
	}
	if(f->ofd >= 0)
		close(f->ofd);
+ if(f->dfd >= 0)
+ close(f->dfd);
	memset(f, 0, sizeof *f);
	return r;
 }
@@ -144,6 +148,9 @@
				return putfolder(f);
		}
	}
+ nulldir(&d);
+ d.mtime = time(0);
+ dirfwstat(f->dfd, &d);
	putfolder(f);
	return -1;
 }
--- a/sys/src/cmd/walk.c
+++ b/sys/src/cmd/walk.c
@@ -21,6 +21,7 @@

 Biobuf *bout;

+void unsee(Dir*);
 int seen(Dir*);

 void
@@ -114,21 +115,19 @@
	while((n = dirread(fd, &dirs)) > 0){
		fe = dirs+n;
		for(f = dirs; f < fe; f++){
- if(seen(f))
- continue;
- if(!  (f->qid.type & QTDIR)){
+ if(!(f->qid.type & QTDIR)){
				if(fflag && depth >= mindepth)
					dofile(path, f, 0);
- } else if(strcmp(f->name, ".") == 0 || strcmp(f->name, "..") == 0){
+ }else if(strcmp(f->name, ".") == 0 || strcmp(f->name, "..") == 0){
				warn(".  or ..  named file: %s/%s", path,
				f->name);
- } else{
+ }else{
				if(depth+1 > maxdepth){
					dofile(path, f, 0);
					continue;
- } else if(path == dotpath){
+ }else if(path == dotpath){
					if((file = s_new()) == nil)
						sysfatal("s_new: %r");
- } else{
+ }else{
					if((file = s_copy(path)) == nil)
						sysfatal("s_copy: %r");
					if(s_len(file) != 1 || *s_to_c(file) !=
					'/')
@@ -135,8 +134,11 @@
						s_putc(file, '/');
				}
				s_append(file, f->name);
-
- walk(s_to_c(file), f, depth+1);
+ if(seen(f))
+ dofile(s_to_c(file), f, 0);
+ else
+ walk(s_to_c(file), f, depth+1);
+ unsee(f);
				s_free(file);
			}
		}
@@ -221,7 +223,6 @@
	functions, but since they are a no-op and libString needs
	a rework, I left them in - BurnZeZ
 */
-
 void
 main(int argc, char **argv)
 {
@@ -267,7 +268,7 @@
	if(argc == 0){
		dotdir = dirstat(".");
		walk(dotpath, dotdir, 1);
- } else for(i=0; i<argc; i++){
+ }else for(i=0; i<argc; i++){
		if(strncmp(argv[i], "#/", 2) == 0)
			slashslash(argv[i]+2);
		else{
@@ -278,8 +279,10 @@
		if((d = dirstat(argv[i])) != nil && ! (d->qid.type & QTDIR)){
			if(fflag && !seen(d) && mindepth < 1)
				dofile(argv[i], d, 1);
- } else
+ }else{
+ seen(d);
			walk(argv[i], d, 1);
+ }
		free(d);
	}
	Bterm(bout);
@@ -299,6 +302,24 @@
	int max;
 } Cache;
 Cache cache[NCACHE];
+
+void
+unsee(Dir *dir)
+{
+ Dir *dp;
+ int i;
+ Cache *c;
+
+ c = &cache[(dir->qid.path^dir->qid.vers)&(NCACHE-1)];
+ dp = c->cache;
+ for(i=0; i<c->n; i++, dp++){
+ if(dir->qid.path == dp->qid.path &&
+ dir->qid.vers == dp->qid.vers &&
+ dir->type == dp->type &&
+ dir->dev == dp->dev)
+ c->cache[i] = c->cache[--c->n];
+ }
+}

 int
 seen(Dir *dir)


Thu Jul 18 16:48:59 EDT 2024
Want to know the secret to getting working capital?

Just visit www.nextdayworkingcapital.com, answer a few questions

and receive an instant approval in less time than it took to read this message

Thu Jul 18 16:13:14 EDT 2024
; cat mkfile
</$cputype/mkfile
OLD=$LD
</$objtype/mkfile
all:
	echo $OLD $LD
; objtype=386 mk all
echo 6l 8l
6l 8l


prev | next