1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (c) 1993 Michael Haardt
5 .\" Fri Apr 2 11:32:09 MET DST 1993
7 .\" This is free documentation; you can redistribute it and/or
8 .\" modify it under the terms of the GNU General Public License as
9 .\" published by the Free Software Foundation; either version 2 of
10 .\" the License, or (at your option) any later version.
12 .\" The GNU General Public License's references to "object code"
13 .\" and "executables" are to be interpreted as the output of any
14 .\" document formatting or typesetting system, including
15 .\" intermediate and printed output.
17 .\" This manual is distributed in the hope that it will be useful,
18 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
19 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 .\" GNU General Public License for more details.
22 .\" You should have received a copy of the GNU General Public
23 .\" License along with this manual; if not, write to the Free
24 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
27 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
28 .\" Modified 1995-02-25 by Jim Van Zandt <jrv@vanzandt.mv.com>
29 .\" Modified 1995-09-02 by Jim Van Zandt <jrv@vanzandt.mv.com>
30 .\" moved to man3, aeb, 950919
31 .\" Modified 2001-09-22 by Michael Kerrisk <mtk.manpages@gmail.com>
32 .\" Modified 2001-12-17, aeb
33 .\" Modified 2004-10-31, aeb
35 .\" Added .SS headers to give some structure to this page; and a
36 .\" small amount of reordering.
37 .\" Added a section on canonical and noncanonical mode.
38 .\" Enhanced the discussion of "raw" mode for cfmakeraw().
41 .\" Japanese Version Copyright (c) 1998-1999
42 .\" Michihide Hotta and NAKANO Takeo all rights reserved.
43 .\" Translated 1998-02-02, Michihide Hotta <sim@remus.dti.ne.jp>
44 .\" Updated 1999-03-14, NAKANO Takeo <nakano@apm.seikei.ac.jp>
45 .\" Updated 2001-02-17, Kentaro Shirakata <argrath@ub32.org>
46 .\" Updated 2001-10-16, Kentaro Shirakata <argrath@ub32.org>
47 .\" Updated 2002-01-04, Kentaro Shirakata <argrath@ub32.org>
48 .\" Updated 2003-09-01, Kentaro Shirakata <argrath@ub32.org>
49 .\" Updated 2006-07-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
50 .\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
51 .\" Updated 2007-09-06, Akihiro MOTOKI, LDP v2.64
53 .\"WORD: carriage return 復帰(文字)
54 .\"WORD: new line 改行(文字)
55 .\"WORD: fill character 補填文字
56 .\"WORD: horizontal tab 水平タブ
57 .\"WORD: backspace 後退(文字)
58 .\"WORD: vertical tab 垂直タブ
59 .\"WORD: feature test macro 機能検査マクロ
61 .TH TERMIOS 3 2010-06-20 "Linux" "Linux Programmer's Manual"
63 .\"O termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow,
64 .\"O cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, cfsetspeed \-
65 .\"O get and set terminal attributes, line control, get and set baud rate
67 termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow,
68 cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, cfsetspeed \-
69 ターミナル属性の取得・設定、ライン制御、ボーレートの取得・設定
73 .B #include <termios.h>
75 .B #include <unistd.h>
77 .BI "int tcgetattr(int " fd ", struct termios *" termios_p );
79 .BI "int tcsetattr(int " fd ", int " optional_actions ,
80 .BI " const struct termios *" termios_p );
82 .BI "int tcsendbreak(int " fd ", int " duration );
84 .BI "int tcdrain(int " fd );
86 .BI "int tcflush(int " fd ", int " queue_selector );
88 .BI "int tcflow(int " fd ", int " action );
90 .BI "void cfmakeraw(struct termios *" termios_p );
92 .BI "speed_t cfgetispeed(const struct termios *" termios_p );
94 .BI "speed_t cfgetospeed(const struct termios *" termios_p );
96 .BI "int cfsetispeed(struct termios *" termios_p ", speed_t " speed );
98 .BI "int cfsetospeed(struct termios *" termios_p ", speed_t " speed );
100 .BI "int cfsetspeed(struct termios *" termios_p ", speed_t " speed );
104 .\"O Feature Test Macro Requirements for glibc (see
105 .\"O .BR feature_test_macros (7)):
107 .RB ( feature_test_macros (7)
116 .\"O The termios functions describe a general terminal interface that is
117 .\"O provided to control asynchronous communications ports.
118 termios 関数群は、非同期通信ポートを制御するための汎用
120 .\"O .SS "The termios structure"
123 .\"O Many of the functions described here have a \fItermios_p\fP argument
124 .\"O that is a pointer to a \fItermios\fP structure.
125 .\"O This structure contains at least the following members:
126 ここに示されている関数の多くは、引き数に \fItermios_p\fP を用いる。
127 この引き数は \fItermios\fP 構造体へのポインタである。
128 この構造体には少なくとも以下に示すメンバが含まれる:
132 tcflag_t c_iflag; /* input modes */
133 tcflag_t c_oflag; /* output modes */
134 tcflag_t c_cflag; /* control modes */
135 tcflag_t c_lflag; /* local modes */
136 cc_t c_cc[NCCS]; /* control chars */
140 .\"O The values that may be assigned to these fields are described below.
141 .\"O In the case of the first four bit-mask fields,
142 .\"O the definitions of some of the associated flags that may be set are
143 .\"O only exposed if a specific feature test macro (see
144 .\"O .BR feature_test_macros (7))
145 .\"O is defined, as noted in brackets ("[]").
146 以下に、これらのフィールドに割り当て可能な値について説明する。
147 最初の 4 つのビットマスクフィールドでは、
148 関係するフラグの定義のいくつかは、特定の機能検査マクロ
149 .RB ( feature_test_macros (7)
150 参照) が定義された場合にのみ公開される。
151 必要な機能検査マクロは角括弧 ("[]") 内に書かれている。
153 .\"O In the descriptions below, "not in POSIX" means that the
154 .\"O value is not specified in POSIX.1-2001,
155 .\"O and "XSI" means that the value is specified in POSIX.1-2001
156 .\"O as part of the XSI extension.
157 以下の説明で、 "POSIX にはない" は
158 その値が POSIX.1-2001 で規定されていないことを意味し、
159 "XSI" はその値が POSIX.1-2001 の XSI 拡張で
162 .\"O \fIc_iflag\fP flag constants:
163 \fIc_iflag\fP フラグには以下の要素を指定できる:
166 .\"O Ignore BREAK condition on input.
170 .\"O If \fBIGNBRK\fP is set, a BREAK is ignored.
171 .\"O If it is not set
172 .\"O but \fBBRKINT\fP is set, then a BREAK causes the input and output
173 .\"O queues to be flushed, and if the terminal is the controlling
174 .\"O terminal of a foreground process group, it will cause a
175 .\"O \fBSIGINT\fP to be sent to this foreground process group.
176 \fBIGNBRK\fP が設定されている場合は、BREAK 信号は無視される。
177 \fBIGNBRK\fP が設定されていないが、\fBBRKINT\fP が設定されている場合は、
178 BREAK 信号によって入出力キューがフラッシュされ、
179 さらに、端末がフォアグラウンドプロセスグループの制御端末の場合は、
180 フォアグラウンドプロセスグループに \fBSIGINT\fP が送られる。
181 .\"O When neither \fBIGNBRK\fP nor \fBBRKINT\fP are set, a BREAK
182 .\"O reads as a null byte (\(aq\\0\(aq), except when \fBPARMRK\fP is set,
183 .\"O in which case it reads as the sequence \\377 \\0 \\0.
184 \fBIGNBRK\fP も \fBBRKINT\fP も設定されていない場合、
185 BREAK を NULL バイト (\(aq\\0\(aq) として読み込む。
186 ただし、\fBPARMRK\fP が設定されている場合は \\377 \\0 \\0 のシーケンスとして
190 .\"O Ignore framing errors and parity errors.
191 フレームエラーおよびパリティエラーを無視する。
194 .\"O If \fBIGNPAR\fP is not set, prefix a character with a parity error or
195 .\"O framing error with \\377 \\0.
196 .\"O If neither \fBIGNPAR\fP nor \fBPARMRK\fP
197 .\"O is set, read a character with a parity error or framing error
199 \fBIGNPAR\fP が設定されていない場合、パリティエラーあるいはフレームエラー
200 の発生した文字の前に \\377 \\0 を付加する。\fBIGNPAR\fP も \fBPARMRK\fP も
201 設定されていない場合、パリティエラーあるいはフレームエラーの発生した文字を
205 .\"O Enable input parity checking.
209 .\"O Strip off eighth bit.
213 .\"O Translate NL to CR on input.
214 入力の NL (New Line: 改行文字) を CR (Carriage Return: 復帰文字) に
218 .\"O Ignore carriage return on input.
222 .\"O Translate carriage return to newline on input (unless \fBIGNCR\fP is set).
223 (\fBIGNCR\fP が設定されていない場合) 入力の CR を NL に置き換える。
226 .\"O (not in POSIX) Map uppercase characters to lowercase on input.
227 (POSIX にはない) 入力の大文字を小文字に置き換える。
230 .\"O Enable XON/XOFF flow control on output.
231 出力の XON/XOFF フロー制御を有効にする。
234 .\"O (XSI) Typing any character will restart stopped output.
235 .\"O (The default is to allow just the START character to restart output.)
236 (XSI) 任意の文字を入力すると、停止していた出力を再開する
237 (デフォルトでは、START 文字でのみ出力が再開される)。
240 .\"O Enable XON/XOFF flow control on input.
241 入力の XON/XOFF フロー制御を有効にする。
244 .\"O (not in POSIX) Ring bell when input queue is full.
245 .\"O Linux does not implement this bit, and acts as if it is always set.
246 (POSIX にはない) 入力キューが一杯の時にベルを鳴らす。
247 Linux ではこのビットは実装されておらず、
250 .\"O .BR IUTF8 " (since Linux 2.6.4)"
251 .BR IUTF8 " (Linux 2.6.4 以降)"
252 .\"O (not in POSIX) Input is UTF8;
253 .\"O this allows character-erase to be correctly performed in cooked mode.
254 (POSIX にはない) 入力が UTF8 である;
255 これにより cooked mode で文字削除 (character-erase) を
258 .\"O \fIc_oflag\fP flag constants defined in POSIX.1:
259 POSIX.1 で定義されている \fIc_oflag\fP フラグを以下に示す:
262 .\"O Enable implementation-defined output processing.
265 .\"O The remaining \fIc_oflag\fP flag constants are defined in POSIX.1-2001,
266 .\"O unless marked otherwise.
267 残りの \fIc_oflag\fP フラグは、特記のない限り POSIX.1-2001 で定義されている。
270 .\"O (not in POSIX) Map lowercase characters to uppercase on output.
271 (POSIX にはない) 出力時に小文字を大文字に変換する。
274 .\"O (XSI) Map NL to CR-NL on output.
275 (XSI) 出力の NL を CR-NL に置き換える。
278 .\"O Map CR to NL on output.
282 .\"O Don't output CR at column 0.
286 .\"O Don't output CR.
290 .\"O Send fill characters for a delay, rather than using a timed delay.
291 転送時間を遅らせるのではなく、補填文字 (fill character) を送る。
292 (訳注:特定の文字に対して、端末側の処理を待つために転送を一定時間
293 遅らせることができる。また、 \fBOFILL\fP を指定すると
297 .\"O (not in POSIX) Fill character is ASCII DEL (0177).
298 .\"O If unset, fill character is ASCII NUL (\(aq\\0\(aq).
299 .\"O (Not implemented on Linux.)
300 (POSIX にはない) 補填文字を ASCII DEL にする。
301 このフラグが設定されていない場合は ASCII NUL (\(aq\\0\(aq) になる。
305 .\"O Newline delay mask.
306 .\"O Values are \fBNL0\fP and \fBNL1\fP.
312 .\"O .BR _XOPEN_SOURCE ]
313 NL の遅延を設定する。値は \fBNL0\fP (遅延なし) および \fBNL1\fP である。
322 .\"O Carriage return delay mask.
323 .\"O Values are \fBCR0\fP, \fBCR1\fP, \fBCR2\fP, or \fBCR3\fP.
329 .\"O .BR _XOPEN_SOURCE ]
330 CR の遅延を設定する。値は \fBCR0\fP (遅延なし),
331 \fBCR1\fP, \fBCR2\fP,\fBCR3\fP である。
340 .\"O Horizontal tab delay mask.
341 .\"O Values are \fBTAB0\fP, \fBTAB1\fP, \fBTAB2\fP, \fBTAB3\fP (or \fBXTABS\fP).
347 .\"O .BR _XOPEN_SOURCE ]
348 水平タブ (horizontal tab) の遅延を設定する。
349 値は \fBTAB0\fP (遅延なし),
350 \fBTAB1\fP, \fBTAB2\fP, \fBTAB3\fP (\fBXTABS\fP) である。
357 .\"O A value of TAB3, that is, XTABS, expands tabs to spaces
358 .\"O (with tab stops every eight columns).
359 XTAB3 (これは XTABS と同じである) の値はタブをスペース何個に変換するかを示す
363 .\"O Backspace delay mask.
364 .\"O Values are \fBBS0\fP or \fBBS1\fP.
365 .\"O (Has never been implemented.)
371 .\"O .BR _XOPEN_SOURCE ]
372 後退 (backspace) の遅延を設定する。
373 値は \fBBS0\fP (遅延なし) あるいは \fBBS1\fP である。
383 .\"O Vertical tab delay mask.
384 .\"O Values are \fBVT0\fP or \fBVT1\fP.
385 垂直タブ (vertical tab) の遅延を設定する。
386 値は \fBVT0\fP (遅延なし) あるいは \fBVT1\fP である。
389 .\"O Form feed delay mask.
390 .\"O Values are \fBFF0\fP or \fBFF1\fP.
396 .\"O .BR _XOPEN_SOURCE ]
397 頁送り (form feed) の遅延を設定する。
398 値は \fBFF0\fP (遅延なし) あるいは \fBFF1\fP である。
406 .\"O \fIc_cflag\fP flag constants:
407 \fIc_cflag\fP フラグは以下の通り:
410 .\"O (not in POSIX) Baud speed mask (4+1 bits).
414 .\"O .BR _SVID_SOURCE ]
415 (POSIX にはない) ボーレートマスク (4+1 ビット)。
422 .\"O (not in POSIX) Extra baud speed mask (1 bit), included in
427 .\"O .BR _SVID_SOURCE ]
428 (POSIX にはない) 追加のボーレートマスク (1 ビット)。
436 .\"O (POSIX says that the baud speed is stored in the
438 .\"O structure without specifying where precisely, and provides
439 .\"O .BR cfgetispeed ()
441 .\"O .BR cfsetispeed ()
442 .\"O for getting at it.
443 .\"O Some systems use bits selected by
447 .\"O other systems use separate fields, for example,
450 .\"O .IR sg_ospeed .)
453 構造体に格納されたボーレートは正確なものではなく、
462 で選択されたビットを使うシステムもあれば、
466 といった独立したフィールドを使うものもある。)
469 .\"O Character size mask.
470 .\"O Values are \fBCS5\fP, \fBCS6\fP, \fBCS7\fP, or \fBCS8\fP.
472 値は \fBCS5\fP, \fBCS6\fP, \fBCS7\fP, \fBCS8\fP である。
475 .\"O Set two stop bits, rather than one.
476 ストップビットを 1 ではなく 2 にする。
479 .\"O Enable receiver.
483 .\"O Enable parity generation on output and parity checking for input.
484 出力にパリティを付加し、入力のパリティチェックを行う。
487 .\"O If set, then parity for input and output is odd;
488 .\"O otherwise even parity is used.
489 設定されると、入力および出力に対するパリティが奇数パリティとなる。
490 設定されない場合、偶数パリティが使用される。
493 .\"O Lower modem control lines after last process closes the device (hang up).
494 最後のプロセスがデバイスをクローズした後、モデムの制御線を low にする
498 .\"O Ignore modem control lines.
502 .\"O (not in POSIX) Block output from a noncurrent shell layer.
503 .\"O For use by \fBshl\fP (shell layers). (Not implemented on Linux.)
504 (POSIX にはない) 現在のシェル層以外からの出力を抑制する。
505 \fBshl\fP (シェル層) で用いられる。(Linux では実装されていない)
508 .\"O (not in POSIX) Mask for input speeds.
509 .\"O The values for the
512 .\"O the same as the values for the
514 .\"O bits, shifted left
520 .\"O .BR _SVID_SOURCE ]
521 .\"O (Not implemented on Linux.)
522 (POSIX にはない) 入力速度のマスク。
538 .\"O Use "stick" (mark/space) parity (supported on certain serial
541 .\"O is set, the parity bit is always 1; if
543 .\"O is not set, then the parity bit is always 0).
547 .\"O .BR _SVID_SOURCE ]
549 (一部のシリアルデバイスでサポートされている)
550 「スティック (stick)」パリティ (マーク/スペース パリティ)を使用する。
552 が設定された場合パリティビットは常に 1 となり、
560 .\"O (not in POSIX) Enable RTS/CTS (hardware) flow control.
564 .\"O .BR _SVID_SOURCE ]
565 (POSIX にはない) RTS/CTS (ハードウェア) フロー制御を有効にする。
571 .\"O \fIc_lflag\fP flag constants:
572 \fIc_lflag\fP フラグは以下の通り:
575 .\"O When any of the characters INTR, QUIT, SUSP, or DSUSP are received,
576 .\"O generate the corresponding signal.
577 INTR, QUIT, SUSP, DSUSP の文字を受信した時、対応するシグナルを
581 .\"O Enable canonical mode (described below).
582 カノニカルモードを有効にする (下記参照)。
585 .\"O (not in POSIX; not supported under Linux)
586 .\"O If \fBICANON\fP is also set, terminal is uppercase only.
587 .\"O Input is converted to lowercase, except for characters preceded by \\.
588 .\"O On output, uppercase characters are preceded by \\ and lowercase
589 .\"O characters are converted to uppercase.
590 (POSIX にはない; Linux では対応していない)
591 \fBICANON\fP が同時に設定された場合、端末は大文字のみが有効である。
592 入力された文字は \\ が付いた文字を除いて小文字に変換される。
593 出力時は、大文字の前に \\ が付き、小文字は大文字に変換される。
594 .\"O [requires _BSD_SOURCE or _SVID_SOURCE or _XOPEN_SOURCE]
595 .\"O .\" glibc is probably now wrong to allow
602 .\" 以下はおそらく glibc の間違いであろう。
604 .\"O .\" .B _XOPEN_SOURCE
613 .\"O Echo input characters.
617 .\"O If \fBICANON\fP is also set, the ERASE character erases the preceding
618 .\"O input character, and WERASE erases the preceding word.
619 \fBICANON\fP も同時に設定された場合、ERASE 文字は前の文字を削除し、
623 .\"O If \fBICANON\fP is also set, the KILL character erases the current line.
624 \fBICANON\fP も同時に設定された場合、KILL 文字は現在の行を削除する。
627 .\"O If \fBICANON\fP is also set, echo the NL character even if ECHO is not set.
628 \fBICANON\fP も同時に設定された場合、
629 ECHO が設定されていなくても NL 文字をエコーする。
632 .\"O (not in POSIX) If \fBECHO\fP is also set, ASCII control signals other than
633 .\"O TAB, NL, START, and STOP are echoed as \fB^X\fP,
634 .\"O where X is the character with
635 .\"O ASCII code 0x40 greater than the control signal.
636 .\"O For example, character
637 .\"O 0x08 (BS) is echoed as \fB^H\fP.
641 .\"O .BR _SVID_SOURCE ]
642 (POSIX にはない) \fBECHO\fP も同時に設定された場合、
643 TAB, NL, START, STOP の ASCII 制御文字が \fB^X\fP としてエコーされる。
644 X は制御文字より ASCII コードで 0x10 だけ大きな文字である。
645 例えば文字 0x28 (BS) は \fB^H\fP とエコーされる。
652 .\"O (not in POSIX) If \fBICANON\fP and \fBIECHO\fP are also set, characters
653 .\"O are printed as they are being erased.
657 .\"O .BR _SVID_SOURCE ]
658 (POSIX にはない) \fBICANON\fP および \fBIECHO\fP が同時に設定されている場合、
666 .\"O (not in POSIX) If \fBICANON\fP is also set, KILL is echoed by erasing
667 .\"O each character on the line, as specified by \fBECHOE\fP and \fBECHOPRT\fP.
671 .\"O .BR _SVID_SOURCE ]
672 (POSIX にはない) \fBICANON\fP も設定された場合、
673 KILL が行の各文字を消去する代わりにエコーされる。
674 これは \fBECHOE\fP および \fBECHOPRT\fP を指定することと等しい。
681 .\"O (not in POSIX) Echo only when a process is reading.
682 .\"O (Not implemented on Linux.)
683 (POSIX にはない) プロセスが読み込んだときにだけエコーする。
687 .\"O (not in POSIX; not supported under Linux)
688 .\"O Output is being flushed.
689 .\"O This flag is toggled by typing
690 .\"O the DISCARD character.
694 .\"O .BR _SVID_SOURCE ]
695 (POSIX にはない; Linux では対応していない)
696 出力をフラッシュする。このフラグは DISCARD 文字を入力することで切替えられる。
703 .\"O Disable flushing the input and output queues when generating signals for the
704 .\"O INT, QUIT, and SUSP characters.
705 .\" Stevens lets SUSP only flush the input queue
706 INT, QUIT, SUSP 文字に対応するシグナルを発生する際の
707 入力・出力キューのフラッシュを無効にする。
712 .\"O signal to the process group of a background process
713 .\"O which tries to write to its controlling terminal.
714 バックグラウンドプロセスのプロセスグループで制御端末へ
715 文字を出力しようとしているプロセスに対して
720 .\"O (not in POSIX; not supported under Linux)
721 .\"O All characters in the input queue are reprinted when
722 .\"O the next character is read.
724 .\"O handles typeahead this way.)
728 .\"O .BR _SVID_SOURCE ]
729 (POSIX にはない; Linux では対応していない)
730 次の文字を読み込んだ時、入力キュー中の全文字を再表示する。
739 .\"O Enable implementation-defined input processing.
740 .\"O This flag, as well as \fBICANON\fP must be enabled for the
741 .\"O special characters EOL2, LNEXT, REPRINT, WERASE to be interpreted,
742 .\"O and for the \fBIUCLC\fP flag to be effective.
744 このフラグは、特殊文字である EOL2, LNEXT, REPRINT, WERASE や、
745 \fBIUCLC\fP フラグを有効にするために必要である。
747 .\"O The \fIc_cc\fP array defines the special control characters.
748 .\"O The symbolic indices (initial values) and meaning are:
749 \fIc_cc\fP 配列は特殊な制御文字を定義している。
750 シンボルの一覧 (初期値) と意味は以下の通り。
753 .\"O (003, ETX, Ctrl-C, or also 0177, DEL, rubout)
754 .\"O Interrupt character.
760 .\"O is set, and then not passed as input.
761 (003, ETX, Ctrl-C か 0177, DEL, rubout)
766 がセットされている場合に認識し、入力には渡されない。
769 .\"O (034, FS, Ctrl-\e)
776 .\"O is set, and then not passed as input.
782 がセットされている場合に認識し、入力には渡されない。
785 .\"O (0177, DEL, rubout, or 010, BS, Ctrl-H, or also #)
786 .\"O Erase character.
787 .\"O This erases the previous not-yet-erased character,
788 .\"O but does not erase past EOF or beginning-of-line.
791 .\"O is set, and then not passed as input.
792 (0177, DEL, rubout か 010, BS, Ctrl-H か #)
793 消去文字。これにより、直前の未消去文字を消去する。
794 しかし、EOF や行頭を超えては消去しない。
796 がセットされている場合に認識し、入力には渡されない。
799 .\"O (025, NAK, Ctrl-U, or Ctrl-X, or also @)
801 .\"O This erases the input since the last EOF or beginning-of-line.
804 .\"O is set, and then not passed as input.
805 (025, NAK, Ctrl-U か Ctrl-X か @)
806 完全消去文字。直前の EOF か行頭以降の全ての入力を消去する。
808 がセットされている場合に認識し、入力には渡されない。
811 .\"O (004, EOT, Ctrl-D)
812 .\"O End-of-file character.
815 .\"O More precisely: this character causes the pending tty buffer to be sent
816 .\"O to the waiting user program without waiting for end-of-line.
817 より正確には、tty バッファの内容を行末を待たずにユーザープログラムに送る。
818 .\"O If it is the first character of the line, the
821 .\"O user program returns 0, which signifies end-of-file.
822 これが行の最初の文字だった場合、ユーザープログラムの
828 .\"O is set, and then not passed as input.
830 がセットされている場合に認識し、入力には渡されない。
833 .\"O Minimum number of characters for noncanonical read.
838 .\"O Additional end-of-line character.
847 .\"O Timeout in deciseconds for noncanonical read.
848 非カノニカル読み込み時のタイムアウト時間 (1/10 秒単位)。
851 .\"O (not in POSIX; 0, NUL)
853 .\"O Yet another end-of-line character.
862 .\"O (not in POSIX; not supported under Linux; 0, NUL)
863 (POSIX にはない; Linux では対応していない; 0, NUL)
864 .\"O Switch character.
865 .\"O (Used by \fBshl\fP only.)
866 スイッチ文字 (\fBshl\fP でのみ用いられる)。
870 .\"O Start character.
871 .\"O Restarts output stopped by the Stop character.
874 .\"O is set, and then not passed as input.
875 開始文字。停止文字で停止した出力を再開する。
877 がセットされている場合に認識し、入力には渡されない。
882 .\"O Stop output until Start character typed.
885 .\"O is set, and then not passed as input.
886 停止文字。開始文字が入力されるまで出力を停止する。
888 が設定されている場合に認識し、入力には渡されない。
892 .\"O Suspend character.
898 .\"O is set, and then not passed as input.
903 がセットされている場合に認識し、入力には渡されない。
906 .\"O (not in POSIX; not supported under Linux; 031, EM, Ctrl-Y)
907 (POSIX にはない; Linux では対応していない; 031, EM, Ctrl-Y)
908 .\"O Delayed suspend character:
911 .\"O signal when the character is read by the user program.
916 .\"O are set, and the system supports
917 .\"O job control, and then not passed as input.
918 遅延中断文字。ユーザープログラムから文字が読み込まれた時に
924 がセットされていて、システムがジョブ制御に対応している場合に
928 .\"O (not in POSIX; 026, SYN, Ctrl-V)
929 (POSIX にはない; 026, SYN Ctrl-V)
931 .\"O Quotes the next input character, depriving it of
932 .\"O a possible special meaning.
935 .\"O is set, and then not passed as input.
936 リテラル。次の入力文字をエスケープし、特別な意味があっても解釈しない。
938 がセットされている場合に認識し、入力には渡されない。
941 .\"O (not in POSIX; 027, ETB, Ctrl-W)
942 (POSIX にはない; 027, ETB, Ctrl-W)
949 .\"O are set, and then not passed as input.
953 がセットされている場合に認識し、入力には渡されない。
956 .\"O (not in POSIX; 022, DC2, Ctrl-R)
957 (POSIX にはない; 022, DC2, Ctrl-R)
958 .\"O Reprint unread characters.
964 .\"O are set, and then not passed as input.
968 がセットされている場合に認識し、入力には渡されない。
971 .\"O (not in POSIX; not supported under Linux; 017, SI, Ctrl-O)
972 (POSIX にはない; Linux では対応していない; 017, SI, Ctrl-O)
973 .\"O Toggle: start/stop discarding pending output.
974 未送信バッファの内容の破棄/保存を切り替える。
977 .\"O is set, and then not passed as input.
979 がセットされている場合に認識し、入力には渡されない。
982 .\"O (not in POSIX; not supported under Linux;
983 .\"O status request: 024, DC4, Ctrl-T).
984 (POSIX にはない; Linux では対応していない;
985 状態要求: 024, DC4, Ctrl-T)
987 .\"O These symbolic subscript values are all different, except that
990 .\"O may have the same value as
1002 .\"O In noncanonical mode the special character meaning is replaced
1003 .\"O by the timeout meaning.
1004 .\"O For an explanation of
1008 .\"O see the description of
1009 .\"O noncanonical mode below.
1010 非カノニカルモードでは、特殊文字の意味はタイムアウトの意味に変わる。
1014 の説明については、下記の非カノニカルモードの説明を参照のこと。
1015 .\"O .SS "Retrieving and changing terminal settings"
1018 .\"O .BR tcgetattr ()
1019 .\"O gets the parameters associated with the object referred by \fIfd\fP and
1020 .\"O stores them in the \fItermios\fP structure referenced by
1021 .\"O \fItermios_p\fP.
1022 .\"O This function may be invoked from a background process;
1023 .\"O however, the terminal attributes may be subsequently changed by a
1024 .\"O foreground process.
1026 は \fIfd\fP に関するパラメータを取得し、\fItermios_p\fP が参照する構
1027 造体 \fItermios\fP に設定する。この関数はバックグラウンドプロセスから
1028 呼ばれることもあるが、この場合、端末の属性はフォアグラウンドプロセス
1031 .\"O .BR tcsetattr ()
1032 .\"O sets the parameters associated with the terminal (unless support is
1033 .\"O required from the underlying hardware that is not available) from the
1034 .\"O \fItermios\fP structure referred to by \fItermios_p\fP.
1035 .\"O \fIoptional_actions\fP specifies when the changes take effect:
1037 は端末に関連したパラメータを設定する (ハードウェアの設定に必要で、ここで
1038 設定できないものを除く)。設定には \fItermios_p\fP が参照する
1039 \fItermios\fP 構造体を用いる。
1040 \fIoptional_actions\fP には変更が有効となるタイミングを設定する:
1042 .\"O the change occurs immediately.
1045 .\"O the change occurs after all output written to
1047 .\"O has been transmitted.
1048 .\"O This function should be used when changing
1049 .\"O parameters that affect output.
1051 への出力がすべて転送された後に変更が有効になる。この機能は
1052 出力に影響するパラメータを変更する時に使用するべきである。
1054 .\"O the change occurs after all output written to the object referred by
1056 .\"O has been transmitted, and all input that has been received but not read
1057 .\"O will be discarded before the change is made.
1060 への出力がすべて転送され、受信したがまだ読み込んでいないすべての
1062 .\"O .SS "Canonical and noncanonical mode"
1063 .SS "カノニカルモードと非カノニカルモード"
1064 .\"O The setting of the
1068 .\"O determines whether the terminal is operating in canonical mode
1071 .\"O noncanonical mode
1080 フラグの設定により、端末がカノニカルモードで動作するかが決定される。
1082 がセットされた場合、カノニカルモード (canonical mode) となり、
1083 セットされない場合、非カノニカルモード (noncanonical mode) となる。
1088 .\"O In canonical mode:
1089 カノニカルモードでは、以下のような動作となる。
1091 .\"O Input is made available line by line.
1092 .\"O An input line is available when one of the line delimiters
1093 .\"O is typed (NL, EOL, EOL2; or EOF at the start of line).
1094 .\"O Except in the case of EOF, the line delimiter is included
1095 .\"O in the buffer returned by
1098 行区切り文字が打ち込まれた時点で、入力行が利用可能となる。
1099 行区切り文字は NL, EOL, EOL2 および行頭での EOF である。
1102 が返すバッファに行区切り文字も含められる。
1104 .\"O Line editing is enabled (ERASE, KILL;
1107 .\"O flag is set: WERASE, REPRINT, LNEXT).
1110 .\"O returns at most one line of input; if the
1112 .\"O requested fewer bytes than are available in the current line of input,
1113 .\"O then only as many bytes as requested are read,
1114 .\"O and the remaining characters will be available for a future
1116 行編集が有効となる (ERASE, KILL が効果を持つ。
1119 WERASE, REPRINT, LNEXT も効果を持つ)。
1123 が要求したバイト数が現在の入力行のバイト数よりも少ない場合、
1124 要求したのと同じバイト数だけが読み込まれ、
1129 .\"O In noncanonical mode input is available immediately (without
1130 .\"O the user having to type a line-delimiter character),
1131 .\"O and line editing is disabled.
1132 .\"O The settings of MIN
1133 .\"O .RI ( c_cc[VMIN] )
1135 .\"O .RI ( c_cc[VTIME] )
1136 .\"O determine the circumstances in which a
1138 .\"O completes; there are four distinct cases:
1139 非カノニカルモードでは、入力は即座に利用可能となり
1140 (ユーザは行区切り文字を打ち込む必要はない)、
1148 が完了する条件が決定される。4種類の場合がある:
1150 MIN == 0; TIME == 0:
1151 .\"O If data is available,
1153 .\"O returns immediately, with the lesser of the number of bytes
1154 .\"O available, or the number of bytes requested.
1155 .\"O If no data is available,
1160 はすぐに返る。このときの返り値は、そのとき利用可能なバイト数か
1169 .\"O blocks until the lesser of MIN bytes or the number of bytes requested
1170 .\"O are available, and returns the lesser of these two values.
1172 は、利用可能なデータが MIN バイトか要求バイト数のいずれかに達するまで
1173 停止する。返り値は、MIN か要求バイト数の小さい方となる。
1176 .\"O TIME specifies the limit for a timer in tenths of a second.
1177 .\"O The timer is started when
1181 .\"O returns either when at least one byte of data is available,
1182 .\"O or when the timer expires.
1183 .\"O If the timer expires without any input becoming available,
1186 TIME はタイマの上限を規定し、単位は 1/10 秒である。
1191 が返るのは、少なくとも 1バイトのデータが利用可能となった時点、
1192 またはタイマが時間切れとなった時点である。
1193 入力が全くなくタイマが時間切れとなった場合、
1198 .\"O TIME specifies the limit for a timer in tenths of a second.
1199 .\"O Once an initial byte of input becomes available,
1200 .\"O the timer is restarted after each further byte is received.
1202 .\"O returns either when the lesser of the number of bytes requested or
1203 .\"O MIN byte have been read,
1204 .\"O or when the inter-byte timeout expires.
1205 .\"O Because the timer is only started after the initial byte
1206 .\"O becomes available, at least one byte will be read.
1207 TIME はタイマの上限を規定し、単位は 1/10 秒である。
1208 入力の最初のバイトが利用可能になった後は、
1209 新たに 1バイト受信する度にタイマがリセットされる。
1211 が返るのは、MIN バイトか要求バイト数のうち少ない方まで読み出された時点か、
1212 バイト間タイマが時間切れとなった時点である。
1213 は最初のバイトが利用可能にならないとタイマは開始されないので、
1217 .\"O .BR cfmakeraw ()
1218 .\"O sets the terminal to something like the
1219 .\"O "raw" mode of the old Version 7 terminal driver:
1220 .\"O input is available character by character,
1221 .\"O echoing is disabled, and all special processing of
1222 .\"O terminal input and output characters is disabled.
1223 .\"O The terminal attributes are set as follows:
1225 は、端末を昔の Version 7 端末ドライバの
1227 入力は文字単位に可能であり、エコーが無効となり、
1228 端末の入出力文字に対する特殊処理はすべて無効となる。
1232 termios_p\->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
1233 | INLCR | IGNCR | ICRNL | IXON);
1234 termios_p\->c_oflag &= ~OPOST;
1235 termios_p\->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
1236 termios_p\->c_cflag &= ~(CSIZE | PARENB);
1237 termios_p\->c_cflag |= CS8;
1239 .\"O .SS "Line control"
1242 .\"O .BR tcsendbreak ()
1243 .\"O transmits a continuous stream of zero-valued bits for a specific
1244 .\"O duration, if the terminal is using asynchronous serial data
1246 .\"O If \fIduration\fP is zero, it transmits zero-valued bits
1247 .\"O for at least 0.25 seconds, and not more that 0.5 seconds.
1248 .\"O If \fIduration\fP is not zero, it sends zero-valued bits for some
1249 .\"O implementation-defined length of time.
1251 は端末が非同期のシリアルデータ転送を用いている場合に、
1252 連続した0のビット列を一定間隔で転送する。
1253 \fIduration\fP が 0 の場合は、0 のビットを 0.25 秒以上、
1254 0.5 秒以下の間隔で転送する。 \fIduration\fP が 0 でない場合は、
1255 0 のビットを実装依存の時間間隔で送る。
1257 .\"O If the terminal is not using asynchronous serial data transmission,
1258 .\"O .BR tcsendbreak ()
1259 .\"O returns without taking any action.
1260 端末が非同期のシリアルデータ転送モードでない場合、
1265 .\"O waits until all output written to the object referred to by
1267 .\"O has been transmitted.
1271 が行っている出力の転送が完了するまで待つ。
1274 .\"O discards data written to the object referred to by
1276 .\"O but not transmitted, or data received but not read, depending on the
1278 .\"O .IR queue_selector :
1282 が行っているデータの出力でまだ転送されていないもの、あるいは受信し
1283 たがまだ入力していないものを破棄する。いずれを行うかは
1286 .\"??nakano flush == discard?
1288 .\"O flushes data received but not read.
1289 受信したが読んでいないデータをフラッシュする。
1291 .\"O flushes data written but not transmitted.
1292 書いたが送信していないデータをフラッシュする。
1294 .\"O flushes both data received but not read, and data written but not
1296 受信したが読んでいないデータ・書いたが送信していないデータ両方
1300 .\"O suspends transmission or reception of data on the object referred to by
1302 .\"O depending on the value of
1307 で指定されたオブジェクトにおけるデータの送信あるいは受信を一時的に中断する。
1311 .\"O suspends output.
1314 .\"O restarts suspended output.
1317 .\"O transmits a STOP character, which stops the terminal device from
1318 .\"O transmitting data to the system.
1320 STOP 文字は端末デバイスからシステムへのデータ送信を停止する。
1322 .\"O transmits a START character, which starts the terminal device
1323 .\"O transmitting data to the system.
1325 START 文字は端末デバイスからシステムへのデータ送信を開始する。
1327 .\"O The default on open of a terminal file is that neither its input nor its
1328 .\"O output is suspended.
1329 端末ファイルがオープンされたときのデフォルトでは、
1331 .\"O .SS "Line speed"
1333 .\"O The baud rate functions are provided for getting and setting the values
1334 .\"O of the input and output baud rates in the \fItermios\fP structure.
1335 .\"O The new values do not take effect
1337 .\"O .BR tcsetattr ()
1338 .\"O is successfully called.
1339 ボーレート関数は \fItermios\fP 構造体中の入出力ボーレートを
1343 の呼び出しが成功するまでは有効ではない。
1345 .\"O Setting the speed to \fBB0\fP instructs the modem to "hang up".
1346 .\"O The actual bit rate corresponding to \fBB38400\fP may be altered with
1347 .\"O .BR setserial (8).
1348 速度を \fBB0\fP に設定した場合、モデムは停止 (hang up) する。
1349 \fBB38400\fP に該当する実際のビットレートは
1354 .\"O The input and output baud rates are stored in the \fItermios\fP
1356 入力および出力ボーレートは \fItermios\fP 構造体に格納される。
1358 .\"O .BR cfgetospeed ()
1359 .\"O returns the output baud rate stored in the \fItermios\fP structure
1361 .\"O .IR termios_p .
1365 が示している \fItermios\fP 構造体に格納されている
1368 .\"O .BR cfsetospeed ()
1369 .\"O sets the output baud rate stored in the \fItermios\fP structure pointed
1370 .\"O to by \fItermios_p\fP to \fIspeed\fP, which must be one of these constants:
1372 は \fItermios_p\fP で示されている \fItermios\fP 構造体中の出力ボーレートを
1373 \fIspeed\fP に設定する。値は以下のいずれかでなければならない:
1399 .\"O The zero baud rate, \fBB0\fP,
1400 .\"O is used to terminate the connection.
1401 .\"O If B0 is specified, the modem control lines shall no longer be asserted.
1402 .\"O Normally, this will disconnect the line.
1403 .\"O \fBCBAUDEX\fP is a mask
1404 .\"O for the speeds beyond those defined in POSIX.1 (57600 and above).
1405 .\"O Thus, \fBB57600\fP & \fBCBAUDEX\fP is nonzero.
1406 0ボー (\fBB0\fP) は接続の中断に用いられる。
1407 B0が指定された場合、モデムの制御線は使用されない状態になり、一般にはこれで
1409 \fBCBAUDEX\fP はPOSIX.1で定義されている速度の範囲外 (57600 およびそれ以上)
1410 を設定する。すなわち例えば \fBB57600\fP & \fBCBAUDEX\fP は 0 でない。
1412 .\"O .BR cfgetispeed ()
1413 .\"O returns the input baud rate stored in the \fItermios\fP structure.
1415 は \fItermios\fP 構造体中の入力ボーレートを返す。
1417 .\"O .BR cfsetispeed ()
1418 .\"O sets the input baud rate stored in the \fItermios\fP structure to
1420 .\"O which must be specified as one of the \fBBnnn\fP constants listed above for
1421 .\"O .BR cfsetospeed ().
1422 .\"O If the input baud rate is set to zero, the input baud rate will be
1423 .\"O equal to the output baud rate.
1425 は \fItermios\fP 構造体中の入力ボーレートを
1431 のボーレート定数 \fBBnnn\fP のいずれか一つを指定しなければならない。
1432 入力ボーレートが 0 に設定された場合、入力ボーレートは出力ボーレート
1435 .\"O .BR cfsetspeed ()
1436 .\"O is a 4.4BSD extension.
1437 .\"O It takes the same arguments as
1438 .\"O .BR cfsetispeed (),
1439 .\"O and sets both input and output speed.
1441 は 4.4BSD による拡張である。この関数は
1443 と同じ引き数をとり、入出力両方の速度を設定する。
1444 .\"O .SH "RETURN VALUE"
1447 .\"O .BR cfgetispeed ()
1448 .\"O returns the input baud rate stored in the
1452 は \fItermios\fP 構造体中の入力ボーレートを返す。
1454 .\"O .BR cfgetospeed ()
1455 .\"O returns the output baud rate stored in the \fItermios\fP structure.
1457 は \fItermios\fP 構造体中の出力ボーレートを返す。
1459 .\"O All other functions return:
1465 .\"O on failure and set
1467 .\"O to indicate the error.
1473 .\"O .BR tcsetattr ()
1474 .\"O returns success if \fIany\fP of the requested changes could be
1475 .\"O successfully carried out.
1476 .\"O Therefore, when making multiple changes
1477 .\"O it may be necessary to follow this call with a further call to
1478 .\"O .BR tcgetattr ()
1479 .\"O to check that all changes have been performed successfully.
1481 は \fIなんらかの\fP 変更要求が成功した場合に成功を返すことに注意。
1482 従って、複数の変更を行った場合には、引き続いて
1484 を呼び出して全ての変更が実行されているかを確認する必要があるかもしれない。
1485 .\"O .SH CONFORMING TO
1498 .\"O are specified in POSIX.1-2001.
1499 は POSIX.1-2001 で規定されている。
1501 .\"O .BR cfmakeraw ()
1503 .\"O .BR cfsetspeed ()
1504 .\"O are nonstandard, but available on the BSDs.
1508 は非標準だが、BSD では利用可能である。
1511 .\"O UNIX V7 and several later systems have a list of baud rates
1512 .\"O where after the fourteen values B0, ..., B9600 one finds the
1513 .\"O two constants EXTA, EXTB ("External A" and "External B").
1514 .\"O Many systems extend the list with much higher baud rates.
1515 UNIX V7 とその後のいくつかのシステムでは、ボーレートの 14 個のリストである
1516 B0, ..., B9600 の後ろに EXTA, EXTB ("External A" と "External B") の 2 つを
1518 多くのシステムではさらに高速なボーレートのためにリストを拡張している。
1520 .\"O The effect of a nonzero \fIduration\fP with
1521 .\"O .BR tcsendbreak ()
1524 で \fIduration\fP に 0 以外を指定した場合の効果は様々である。
1525 .\"O SunOS specifies a break of
1526 .\"O .I "duration\ *\ N"
1527 .\"O seconds, where \fIN\fP is at least 0.25, and not more than 0.5.
1530 秒のブレークを規定している。ここで \fIN\fP は 0.25 以上 0.5 未満である。
1531 .\"O Linux, AIX, DU, Tru64 send a break of
1534 Linux, AIX, DU, Tru64 は
1537 .\"O FreeBSD and NetBSD and HP-UX and MacOS ignore the value of
1539 FreeBSD, NetBSD, HP-UX, MacOS は
1542 .\"O Under Solaris and UnixWare,
1543 .\"O .BR tcsendbreak ()
1547 .\"O .BR tcdrain ().
1548 Solaris と UnixWare では、非ゼロの
1555 .\"O .\" libc4 until 4.7.5, glibc for sysv: EINVAL for duration > 0.
1556 .\"O .\" libc4.7.6, libc5, glibc for unix: duration in ms.
1557 .\"O .\" glibc for bsd: duration in us
1558 .\"O .\" glibc for sunos4: ignore duration
1562 .BR console_ioctl (4),