shithub: patch

ref: 108080e16698fc9098656dea178a5c148275fb0f
dir: /kbdfs-fshalt/

View raw version
diff 27a63ae22975171efbee5549d100f416ccb4066a uncommitted
--- a/sys/src/cmd/aux/kbdfs/kbdfs.c
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c
@@ -366,6 +366,25 @@
 }
 
 void
+emergencywarp(void)
+{
+	int fd;
+
+	if(debug)
+		return;
+
+	if(access("/srv/cwfs.cmd", AEXIST) == 0 && (fd = eopen("/srv/cwfs.cmd", OWRITE)) >= 0){
+		fprint(fd, "halt\n");
+		close(fd);
+	}
+	if(access("/srv/hjfs.cmd", AEXIST) == 0 && (fd = eopen("/srv/hjfs.cmd", OWRITE)) >= 0){
+		fprint(fd, "halt\n");
+		close(fd);
+	}
+	reboot();
+}
+
+void
 shutdown(void)
 {
 	if(notefd >= 0)
@@ -443,6 +462,9 @@
 
 	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)