quitting in the terminal

wizard zines

@b0rk Great work! I never digged into why Ctrl-D works and this explains it well!

Though I am confused about the description that terminal sends SIGINT for ctrl-C because C is the third letter in the alphabet. That doesn't happen to any other letters. For example, Ctrl-A doesn't generate a signal

@lesley yeah Ctrl-A sends the number `1` to the OS terminal driver but `1` isn't translated into a signal the way `3` is, `3` is special.

`1` is just passed through to the program, so if you type Ctrl-A the program will just get a `1` byte.

@b0rk @lesley You probably know this or saw it while making this page, but I just learned: that ^C = 3 = SIGINT = exit doesn't mean anything, it's just a random reuse of the ETX code started by DEC (although: "citation needed") https://en.wikipedia.org/wiki/End-of-Text_character

^D = EOT = End Of Transmission seems more logical! https://en.wikipedia.org/wiki/C0_and_C1_control_codes

End-of-Text character - Wikipedia

@ednl interesting, what do you mean by โ€œdoesn't mean anything"?

Iโ€™d assume that 3 = SIGINT is standardized somewhere (maybe POSIX???) though I don't know where

@b0rk That there is no, or doesn't seem to be, a semantic meaning, it was just a random pairing. Except maybe it *was* logical to DEC (on the PDP-11 presumably?) but I couldn't find that.

@ednl I guess I don't really understand how the number 3 could have a semantic meaning?

like choosing what 3 should do seems arbitrary in the first place and I don't understand why what "3" does on my computer today would necessarily be related to what a different arbitrary standard from the past decided "3" should mean

(probably what's going on is that there's some "important" standard here that I don't realize is important)

@ednl oh I get it, I think you're saying that a lot of control characters in ASCII have a name, and a lot of the time the name is related to what it does today (like "bell" or "line feed") but also sometimes it doesn't

sorry I'm slow :)

@b0rk Yes. I mean no, you're not slow :) I was too concise! The name is the most obvious logical connection, but also I think the first reply you replied to was looking for a deeper meaning of the number 3 "why would that be a SIGINT?" But there just doesn't seem to be a logical or semantic connection, it randomly came together (and apparently at DEC).

I always thought C stood for Cancel but that's probably an explanation after the fact. My own folk etymology!