shithub: map

Download patch

ref: 5b8b0cbeb3461b0a710584ee77f1cb6c501a5406
parent: c6a16dc58a2cb3152cd0b08b81fbf85df713280b
author: sirjofri <sirjofri@sirjofri.de>
date: Sun Feb 9 17:11:13 EST 2025

updates to more recent version of nate, adds trap err out

--- a/map.c
+++ b/map.c
@@ -18,6 +18,8 @@
 
 Image *testimage;
 
+int debug;
+
 void
 inittestimage(void)
 {
@@ -46,6 +48,19 @@
 	exits(nil);
 }
 
+static void
+traperrout(void)
+{
+	int p[2];
+	pipe(p);
+	dup(p[0], 2);
+	int fd = create("/srv/map.errout", OWRITE|ORCLOSE, 0666);
+	if (fd < 0)
+		sysfatal("create: %r");
+	fprint(fd, "%d\n", p[1]);
+	close(p[1]);
+}
+
 void
 main(int argc, char **argv)
 {
@@ -53,9 +68,19 @@
 	int z = 0;
 	char *url;
 	
+	ARGBEGIN{
+	case 'd':
+		debug++;
+	}ARGEND;
+	
 	if (initdraw(nil, nil, "map") < 0)
 		sysfatal("%r");
 	
+	if (debug)
+		traperrout();
+	
+	nateborders = 1;
+	
 	einit(Emouse);
 	nateinit();
 	
@@ -67,10 +92,10 @@
 		New_VBox(nil)
 		->Slot(
 			New_HBox("menu")
-			->SizeToContent(1)
+			->AutoHeight(1)
 			->Slot(
 				New_Button(nil)
-				->SizeToContent(1)
+				->AutoSize(1)
 				->Border(1, display->black)
 				->Label("Exit")
 				->OnClick(exitclicked, nil)
@@ -77,7 +102,7 @@
 			)
 			->Slot(
 				New_Button(nil)
-				->SizeToContent(1)
+				->AutoSize(1)
 				->Label("Test")
 				->Border(1, display->black)
 			)