プログラムが制御端末を生モードに設定するために「cfmakeraw()」を呼び出すことを確認できますか?

プログラムが制御端末を生モードに設定するために「cfmakeraw()」を呼び出すことを確認できますか?

cfmakeraw()プログラムが制御端末を生モードに設定するように呼び出されたことを確認できますか?

最初は、端末が出力に存在することをstty -a -F /dev/pts/N確認して、端末rawが生モードで実行されていることを確認できると思いました。

ただし、設定()rawを組み合わせる以外には何もありません。man stty

   raw    same as -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -icanon -opost -isig -iuclc -ixany -imaxbel -xcase min 1 time 0

そして、「入力を文字ごとに使用できるかどうか」(下記参照)は言いません。

特に、()に従って標準モード(デフォルトモードに対応)が設定されますman termios

c_lflagのICANON Canonフラグ設定は、端末が通常モード(ICANONが設定されている)または非正規モード(ICANONが設定されていない)で動作するかどうかを決定します。デフォルトでは ICANON が設定されています。

ただし、man stty定義はicanon次のとおりです。

[-]icanon
              enable special characters: erase, kill, werase, rprnt

入力が文字ごとに(生モード)または1行ずつ(標準モード)使用可能かどうかを確認するには?

man termios:

   Raw mode
       cfmakeraw() sets the terminal to something like the "raw" mode of the old Version 7 terminal driver: input is available character by character, echoing is disabled, and all special processing of terminal input and output characters  is  disabled.   The  terminal  at‐
       tributes are set as follows:

           termios_p->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
                           | INLCR | IGNCR | ICRNL | IXON);
           termios_p->c_oflag &= ~OPOST;
           termios_p->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
           termios_p->c_cflag &= ~(CSIZE | PARENB);
           termios_p->c_cflag |= CS8;

ベストアンサー1

おすすめ記事