ref: 6d96112f6ce0be241bdd2e09d5c80af040852574
dir: /kbdfs-fshalt/
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)