From 098be35449c26f3f7a874110c2f185813afaa375 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 22 Nov 2023 04:58:18 -0800 Subject: [PATCH] Add how to find intr/etc. to FAQ Since some entries require intr/EOF etc. I have added to the FAQ how to find it. This was inspired by the 2005/sykes as to end the program one has to send intr. For those with grep -o it's possible to show just the output; other ways exist but those ways are more complicated and I've not gone there. --- faq.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/faq.md b/faq.md index 46aa014fd..c948db9aa 100644 --- a/faq.md +++ b/faq.md @@ -31,6 +31,8 @@ - [3.9 - How do I compile an IOCCC winner that requires (n)curses?](#faq3_9) - [3.10 - How do I compile and use on macOS, an IOCCC winner that requires sound?](#faq3_10) - [3.11 - Why do Makefiles use -Weverything with clang?](#faq3_11) +- [3.12 - How do I find out how to send interrupt/EOF etc. for entries that +require it?](#faq3_12) ## Section 4 - [Changes made to IOCCC winners](#faq4) - [4.0 - Why are some winning author remarks incongruent with the winning IOCCC code?](#faq4_0) @@ -974,6 +976,39 @@ you can get your entry to work well in `clang` it might very well be considered better than other entries. +### FAQ 3.12: How do I find out how to send interrupt/EOF etc. for entries that require it? + +For some entries one needs to send interrupt or EOF or some other signal/other +special characters. There are typical defaults like (where `^` = ctrl): + +- `^D` for EOF (`eof`) +- `^C` for interrupt (`intr`) +- `^U` for kill (`kill`) + +and various others. But if you don't know this you can find out through the +`stty(1)` command with the `-a` option. For instance with macOS you might see: + +```sh +$ stty -a +speed 9600 baud; rows 40; columns 155; +intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; [..snip..] +``` + +If you know the name you can use `grep` to find the correct line and if your +implementation of `grep(1)` has the `-o` option you can filter it. For instance +to find what the `intr` is set to: + +```sh +$ stty -a |grep -o 'intr = ^[[:alpha:]]' +intr = ^C +``` + +... assuming of course that it's a ctrl combination :-) If for some strange +reason it's not you might have to do something else including just piping it to +just `grep intr` or whatever. + + + ## Section 4: Changes made to IOCCC winners