shithub: patch

ref: 25c260fde5a5ee9ca01bd805e88e89f0f508f803
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();