shithub: patch

ref: 5952c258d1d5cb943706156aac22f59659e60827
dir: /kbdfs-fshalt/

View raw version
--- //.git/fs/object/90ce513fb0df41c0d6c5cea8dbd612c1859d4392/tree/sys/src/cmd/aux/kbdfs/kbdfs.c
+++ sys/src/cmd/aux/kbdfs/kbdfs.c
@@ -348,6 +348,24 @@
 }
 
 void
+emergencywarp(void)
+{
+	int fd;
+
+	if(debug)
+		return;
+
+	if(access("#s/cwfs.cmd", AEXIST) == 0 && (fd = eopen("#s/cwfs.cmd", OWRITE)) >= 0){
+		fprint(fd, "halt\n");
+		close(fd);
+	}
+	if(access("#s/hjfs.cmd", AEXIST) == 0 && (fd = eopen("#s/hjfs.cmd", OWRITE)) >= 0){
+		fprint(fd, "halt\n");
+		close(fd);
+	}
+}
+
+void
 reboot(void)
 {
 	int fd;
@@ -440,6 +458,8 @@
 	if(scan->caps && key.r<='z' && key.r>='a')
 		key.r += 'A' - 'a';
 
+	if(scan->ctl && scan->altgr && key.r == Kdel)
+		emergencywarp();
 	if(scan->ctl && scan->alt && key.r == Kdel){
 		if(scan->shift)
 			shiftup();