Path: csiph.com!news.nrbbs.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.36.MISMATCH!local-2.nntp.ord.giganews.com!border-4.nntp.ord.giganews.com!nntp.giganews.com!local-4.nntp.ord.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 09 Aug 2026 21:53:32 +0000 From: steve g Newsgroups: comp.lang.lisp Subject: Re: :sbcl-posix and termios References: <87ecga94bw.fsf@gmail.com> <87se4qm0rv.fsf@gmail.com> Date: Sun, 09 Aug 2026 17:53:31 -0400 Message-ID: <87fr0nhsf8.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:zu0Z1sUyygYh9NK3jkeiQsXeIoo= MIME-Version: 1.0 Content-Type: text/plain Lines: 121 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-rcmIWDjKd+jDKLS7UYq8KCCBw/wPdHZIfBBeBdhuuteZprwQX1FHZ8W7ohMoo8rFp/hRVtqbHSAAnoM!NggO6Yi0JeWctbAHv/+MVlKsMludz6rp6jPYq5eWYgcrHWg= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Xref: csiph.com comp.lang.lisp:61347 Johann 'Myrkraverk' Oskarsson writes: > On 07/08/2026 11:02 PM, steve g wrote: >> Johann 'Myrkraverk' Oskarsson writes: > In the above line, don't you reverse the logic? Am I right, am I > wrong? correct. With terminfo you should treat it as though it were a destructive operation. > I haven't bit twiddled in Lisp for years. Shouldn't you reverse the > IGNCR with -- what was it? -- (lognot, and (logand)) the results? IGNCR wil cause the terminal to ignore Carriage Return as the end of line character. You are right. I spelled it wrong. In C it is much simpler. tcgetattr (STDIN_FILENO, &tattr); tattr.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */ tattr.c_cc[VMIN] = 1; tattr.c_cc[VTIME] = 0; tcsetattr (STDIN_FILENO, TCSAFLUSH, &tattr); (:ECHO-ON (setf (sb-posix:termios-Lflag termios) (logior (sb-posix:termios-Lflag termios) sb-posix:echo)) (debugging-motion-macros "Echo Mode enabled")) (:ECHO-OFF (debugging-motion-macros "Echo Mode disabled") (setf (sb-posix:termios-Lflag termios) (logand (sb-posix:termios-Lflag termios) (lognot sb-posix:echo)))) > Anyway, I was really hoping you'd take the weekend off. Happy > bitwise logic! I am taking the day off :) I am obiously watching HAM radio videos on utube and I have my 2 meter burning up it's power supply. >> (setf (sb-posix::termios-iflag termios) >> (logand (sb-posix:termios-iflag termios) (lognot sb-posix:IGNCR))) >> (setf (sb-posix:termios-oflag termios) >> (logand (sb-posix:termios-oflag termios) (lognot sb-posix:IGNCR)))) > Ok, and now that I see you do it here. I'm also having a time of > fun! I wonder if both of us are wrong, and you want to (setf) the > bit to one? Or are you simply using the wrong bit? like I said it was working; but even if you mess up terminal information; it hits the old termios data and resets to the defaults. It just refuses to recognize sb-posix:Iflag. The input flag and the output flag should be used to change all CR and CR/NL to NL. This would make parsing _much_ easier. > Above you test for INLCR, but unset IGNCR? Then set both IGNCR on > the iflag and oflag? this is correct. I want input to end at #\Newline and I want all output to be #\Newline. This seems like the best solution. > As I said above, happy bitwise logic, and I hope you get it right! I hate using the alien package. I am just unable to understand it. Why not just pass &void [1024] ? > > I have sometimes found it useful to create my own inspection tools, > because what I just snipped, it does not show the bitwise logic of the > termios. >> The inspector shows the Iflag correctly, but I cannot access it. dunno, >> I might just be too tired. >> I thank you for your encouragement and support. > > I wish you best of luck, and really hope you can be as happy as I am > when I struggle with bitwise logic and incomprehensible bit settings! termios shines at this. I should just use stty, but I need the file descriptor which is not as easy as it used to be. at the terminal /usr/bin/tty => /dev/tty3. under X-windows I get a pseudoterminal /usr/bin/tty => /dev/pts/1 > Happy Common Lisp! (defparameter *termios-print-string* "~&Old Flags New Flags~% ------------------------ i_flags: ~d ~I => ~d O_flags; ~d ~I => ~d C_flags; ~d => ~d L_flags; ~d => ~d") (defun tidevice-termios-display (&optional (stream t)) (let ((oldtermios (tidevice-termios-old (current-tidevice))) (newtermios (tidevice-termios-new (current-tidevice)))) (format stream *termios-print-string* (sb-posix:termios-iflag oldtermios) (sb-posix:termios-iflag newtermios) (sb-posix:termios-oflag oldtermios) (sb-posix:termios-oflag newtermios) (sb-posix:termios-cflag oldtermios) (sb-posix:termios-cflag newtermios) (sb-posix:termios-lflag oldtermios) (sb-posix:termios-lflag newtermios)))) thankx for the reply !