OSDN Git Service

76ccc82f6b6144ff43acb01828236111648f0c34
[linuxjm/LDP_man-pages.git] / draft / man3 / termios.3
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1993 Michael Haardt
4 .\" (michael@moria.de)
5 .\" Fri Apr  2 11:32:09 MET DST 1993
6 .\"
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.
11 .\"
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.
16 .\"
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.
21 .\"
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,
25 .\" USA.
26 .\"
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
34 .\" 2006-12-28, mtk:
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().
39 .\"     Document CMSPAR.
40 .\"
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
52 .\"
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      機能検査マクロ
60 .\"
61 .TH TERMIOS 3 2010-06-20 "Linux" "Linux Programmer's Manual"
62 .\"O .SH NAME
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
66 .SH 名前
67 termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow,
68 cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, cfsetspeed \-
69 ターミナル属性の取得・設定、ライン制御、ボーレートの取得・設定
70 .\"O .SH SYNOPSIS
71 .SH 書式
72 .nf
73 .B #include <termios.h>
74 .br
75 .B #include <unistd.h>
76 .sp
77 .BI "int tcgetattr(int " fd ", struct termios *" termios_p );
78 .sp
79 .BI "int tcsetattr(int " fd ", int " optional_actions ,
80 .BI "              const struct termios *" termios_p );
81 .sp
82 .BI "int tcsendbreak(int " fd ", int " duration );
83 .sp
84 .BI "int tcdrain(int " fd );
85 .sp
86 .BI "int tcflush(int " fd ", int " queue_selector );
87 .sp
88 .BI "int tcflow(int " fd ", int " action );
89 .sp
90 .BI "void cfmakeraw(struct termios *" termios_p );
91 .sp
92 .BI "speed_t cfgetispeed(const struct termios *" termios_p );
93 .sp
94 .BI "speed_t cfgetospeed(const struct termios *" termios_p );
95 .sp
96 .BI "int cfsetispeed(struct termios *" termios_p ", speed_t " speed );
97 .sp
98 .BI "int cfsetospeed(struct termios *" termios_p ", speed_t " speed );
99 .sp
100 .BI "int cfsetspeed(struct termios *" termios_p ", speed_t " speed );
101 .fi
102 .sp
103 .in -4n
104 .\"O Feature Test Macro Requirements for glibc (see
105 .\"O .BR feature_test_macros (7)):
106 glibc 向けの機能検査マクロの要件
107 .RB ( feature_test_macros (7)
108 参照):
109 .in
110 .sp
111 .BR cfsetspeed (),
112 .BR cfmakeraw ():
113 _BSD_SOURCE
114 .\"O .SH DESCRIPTION
115 .SH 説明
116 .\"O The termios functions describe a general terminal interface that is
117 .\"O provided to control asynchronous communications ports.
118 termios 関数群は、非同期通信ポートを制御するための汎用
119 ターミナルインタフェースである。
120 .\"O .SS "The termios structure"
121 .SS "termios 構造体"
122 .LP
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 この構造体には少なくとも以下に示すメンバが含まれる:
129 .sp
130 .in +4n
131 .nf
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 */
137 .fi
138 .in
139 .PP
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 必要な機能検査マクロは角括弧 ("[]") 内に書かれている。
152 .PP
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 拡張で
160 規定されていることを意味する。
161 .PP
162 .\"O \fIc_iflag\fP flag constants:
163 \fIc_iflag\fP フラグには以下の要素を指定できる:
164 .TP
165 .B IGNBRK
166 .\"O Ignore BREAK condition on input.
167 入力中の BREAK 信号を無視する。
168 .TP
169 .B BRKINT
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 のシーケンスとして
187 読み込む。
188 .TP
189 .B IGNPAR
190 .\"O Ignore framing errors and parity errors.
191 フレームエラーおよびパリティエラーを無視する。
192 .TP
193 .B PARMRK
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
198 .\"O as \\0.
199 \fBIGNPAR\fP が設定されていない場合、パリティエラーあるいはフレームエラー
200 の発生した文字の前に \\377 \\0 を付加する。\fBIGNPAR\fP も \fBPARMRK\fP も
201 設定されていない場合、パリティエラーあるいはフレームエラーの発生した文字を
202 \\0 として読み込む。
203 .TP
204 .B INPCK
205 .\"O Enable input parity checking.
206 入力のパリティチェックを有効にする。
207 .TP
208 .B ISTRIP
209 .\"O Strip off eighth bit.
210 8 ビット目を落とす。
211 .TP
212 .B INLCR
213 .\"O Translate NL to CR on input.
214 入力の NL (New Line: 改行文字) を CR (Carriage Return: 復帰文字) に
215 置き換える。
216 .TP
217 .B IGNCR
218 .\"O Ignore carriage return on input.
219 入力の CR を無視する。
220 .TP
221 .B ICRNL
222 .\"O Translate carriage return to newline on input (unless \fBIGNCR\fP is set).
223 (\fBIGNCR\fP が設定されていない場合) 入力の CR を NL に置き換える。
224 .TP
225 .B IUCLC
226 .\"O (not in POSIX) Map uppercase characters to lowercase on input.
227 (POSIX にはない) 入力の大文字を小文字に置き換える。
228 .TP
229 .B IXON
230 .\"O Enable XON/XOFF flow control on output.
231 出力の XON/XOFF フロー制御を有効にする。
232 .TP
233 .B IXANY
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 文字でのみ出力が再開される)。
238 .TP
239 .B IXOFF
240 .\"O Enable XON/XOFF flow control on input.
241 入力の XON/XOFF フロー制御を有効にする。
242 .TP
243 .B IMAXBEL
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 ではこのビットは実装されておらず、
248 常にセットされているかのように振舞う。
249 .TP
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) を
256 正しく機能させることができる。
257 .PP
258 .\"O \fIc_oflag\fP flag constants defined in POSIX.1:
259 POSIX.1 で定義されている \fIc_oflag\fP フラグを以下に示す:
260 .TP
261 .B OPOST
262 .\"O Enable implementation-defined output processing.
263 実装に依存した出力処理を有効にする。
264 .PP
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 で定義されている。
268 .TP
269 .B OLCUC
270 .\"O (not in POSIX) Map lowercase characters to uppercase on output.
271 (POSIX にはない) 出力時に小文字を大文字に変換する。
272 .TP
273 .B ONLCR
274 .\"O (XSI) Map NL to CR-NL on output.
275 (XSI) 出力の NL を CR-NL に置き換える。
276 .TP
277 .B OCRNL
278 .\"O Map CR to NL on output.
279 出力の CR を NL に置き換える。
280 .TP
281 .B ONOCR
282 .\"O Don't output CR at column 0.
283 0 桁目で CR を出力しない。
284 .TP
285 .B ONLRET
286 .\"O Don't output CR.
287 CR を出力しない。
288 .TP
289 .B OFILL
290 .\"O Send fill characters for a delay, rather than using a timed delay.
291 転送時間を遅らせるのではなく、補填文字 (fill character) を送る。
292 (訳注:特定の文字に対して、端末側の処理を待つために転送を一定時間
293 遅らせることができる。また、 \fBOFILL\fP を指定すると
294 転送を遅らせる代わりに補填文字を送る。)
295 .TP
296 .B OFDEL
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) になる。
302 (Linux では実装されていない)
303 .TP
304 .B NLDLY
305 .\"O Newline delay mask.
306 .\"O Values are \fBNL0\fP and \fBNL1\fP.
307 .\"O [requires
308 .\"O .B _BSD_SOURCE
309 .\"O or
310 .\"O .B _SVID_SOURCE
311 .\"O or
312 .\"O .BR _XOPEN_SOURCE ]
313 NL の遅延を設定する。値は \fBNL0\fP (遅延なし) および \fBNL1\fP である。
314 .RB [ _BSD_SOURCE
315
316 .B _SVID_SOURCE
317
318 .B _XOPEN_SOURCE
319 が必要]
320 .TP
321 .B CRDLY
322 .\"O Carriage return delay mask.
323 .\"O Values are \fBCR0\fP, \fBCR1\fP, \fBCR2\fP, or \fBCR3\fP.
324 .\"O [requires
325 .\"O .B _BSD_SOURCE
326 .\"O or
327 .\"O .B _SVID_SOURCE
328 .\"O or
329 .\"O .BR _XOPEN_SOURCE ]
330 CR の遅延を設定する。値は \fBCR0\fP (遅延なし),
331 \fBCR1\fP, \fBCR2\fP,\fBCR3\fP である。
332 .RB [ _BSD_SOURCE
333
334 .B _SVID_SOURCE
335
336 .B _XOPEN_SOURCE
337 が必要]
338 .TP
339 .B TABDLY
340 .\"O Horizontal tab delay mask.
341 .\"O Values are \fBTAB0\fP, \fBTAB1\fP, \fBTAB2\fP, \fBTAB3\fP (or \fBXTABS\fP).
342 .\"O [requires
343 .\"O .B _BSD_SOURCE
344 .\"O or
345 .\"O .B _SVID_SOURCE
346 .\"O or
347 .\"O .BR _XOPEN_SOURCE ]
348 水平タブ (horizontal tab) の遅延を設定する。
349 値は \fBTAB0\fP (遅延なし),
350 \fBTAB1\fP, \fBTAB2\fP, \fBTAB3\fP (\fBXTABS\fP) である。
351 .RB [ _BSD_SOURCE
352
353 .B _SVID_SOURCE
354
355 .B _XOPEN_SOURCE
356 が必要]
357 .\"O A value of TAB3, that is, XTABS, expands tabs to spaces
358 .\"O (with tab stops every eight columns).
359 XTAB3 (これは XTABS と同じである) の値はタブをスペース何個に変換するかを示す
360 (タブは 8 桁毎に止まる)。
361 .TP
362 .B BSDLY
363 .\"O Backspace delay mask.
364 .\"O Values are \fBBS0\fP or \fBBS1\fP.
365 .\"O (Has never been implemented.)
366 .\"O [requires
367 .\"O .B _BSD_SOURCE
368 .\"O or
369 .\"O .B _SVID_SOURCE
370 .\"O or
371 .\"O .BR _XOPEN_SOURCE ]
372 後退 (backspace) の遅延を設定する。
373 値は \fBBS0\fP (遅延なし) あるいは \fBBS1\fP である。
374 (実装されたことはない)
375 .RB [ _BSD_SOURCE
376
377 .B _SVID_SOURCE
378
379 .B _XOPEN_SOURCE
380 が必要]
381 .TP
382 .B VTDLY
383 .\"O Vertical tab delay mask.
384 .\"O Values are \fBVT0\fP or \fBVT1\fP.
385 垂直タブ (vertical tab) の遅延を設定する。
386 値は \fBVT0\fP (遅延なし) あるいは \fBVT1\fP である。
387 .TP
388 .B FFDLY
389 .\"O Form feed delay mask.
390 .\"O Values are \fBFF0\fP or \fBFF1\fP.
391 .\"O [requires
392 .\"O .B _BSD_SOURCE
393 .\"O or
394 .\"O .B _SVID_SOURCE
395 .\"O or
396 .\"O .BR _XOPEN_SOURCE ]
397 頁送り (form feed) の遅延を設定する。
398 値は \fBFF0\fP (遅延なし) あるいは \fBFF1\fP である。
399 .RB [ _BSD_SOURCE
400
401 .B _SVID_SOURCE
402
403 .B _XOPEN_SOURCE
404 が必要]
405 .PP
406 .\"O \fIc_cflag\fP flag constants:
407 \fIc_cflag\fP フラグは以下の通り:
408 .TP
409 .B CBAUD
410 .\"O (not in POSIX) Baud speed mask (4+1 bits).
411 .\"O [requires
412 .\"O .B _BSD_SOURCE
413 .\"O or
414 .\"O .BR _SVID_SOURCE ]
415 (POSIX にはない) ボーレートマスク (4+1 ビット)。
416 .RB [ _BSD_SOURCE
417
418 .B _SVID_SOURCE
419 が必要]
420 .TP
421 .B CBAUDEX
422 .\"O (not in POSIX) Extra baud speed mask (1 bit), included in
423 .\"O .BR CBAUD .
424 .\"O [requires
425 .\"O .B _BSD_SOURCE
426 .\"O or
427 .\"O .BR _SVID_SOURCE ]
428 (POSIX にはない) 追加のボーレートマスク (1 ビット)。
429 .B CBAUD
430 に含まれている。
431 .RB [ _BSD_SOURCE
432
433 .B _SVID_SOURCE
434 が必要]
435 .sp
436 .\"O (POSIX says that the baud speed is stored in the
437 .\"O .I termios
438 .\"O structure without specifying where precisely, and provides
439 .\"O .BR cfgetispeed ()
440 .\"O and
441 .\"O .BR cfsetispeed ()
442 .\"O for getting at it.
443 .\"O Some systems use bits selected by
444 .\"O .B CBAUD
445 .\"O in
446 .\"O .IR c_cflag ,
447 .\"O other systems use separate fields, for example,
448 .\"O .I sg_ispeed
449 .\"O and
450 .\"O .IR sg_ospeed .)
451 (POSIX では、
452 .I termios
453 構造体に格納されたボーレートは正確なものではなく、
454 ボーレートを操作するために
455 .BR cfgetispeed ()
456
457 .BR cfsetispeed ()
458 が提供されている。
459 .I c_cflag
460 内の
461 .B CBAUD
462 で選択されたビットを使うシステムもあれば、
463 .I sg_ispeed
464
465 .I sg_ospeed
466 といった独立したフィールドを使うものもある。)
467 .TP
468 .B CSIZE
469 .\"O Character size mask.
470 .\"O Values are \fBCS5\fP, \fBCS6\fP, \fBCS7\fP, or \fBCS8\fP.
471 文字サイズを設定する。
472 値は \fBCS5\fP, \fBCS6\fP, \fBCS7\fP, \fBCS8\fP である。
473 .TP
474 .B CSTOPB
475 .\"O Set two stop bits, rather than one.
476 ストップビットを 1 ではなく 2 にする。
477 .TP
478 .B CREAD
479 .\"O Enable receiver.
480 受信を有効にする。
481 .TP
482 .B PARENB
483 .\"O Enable parity generation on output and parity checking for input.
484 出力にパリティを付加し、入力のパリティチェックを行う。
485 .TP
486 .B PARODD
487 .\"O If set, then parity for input and output is odd;
488 .\"O otherwise even parity is used.
489 設定されると、入力および出力に対するパリティが奇数パリティとなる。
490 設定されない場合、偶数パリティが使用される。
491 .TP
492 .B HUPCL
493 .\"O Lower modem control lines after last process closes the device (hang up).
494 最後のプロセスがデバイスをクローズした後、モデムの制御線を low にする
495 (切断する)。
496 .TP
497 .B CLOCAL
498 .\"O Ignore modem control lines.
499 モデムの制御線を無視する。
500 .TP
501 .B LOBLK
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 では実装されていない)
506 .TP
507 .B CIBAUD
508 .\"O (not in POSIX) Mask for input speeds.
509 .\"O The values for the
510 .\"O .B CIBAUD
511 .\"O bits are
512 .\"O the same as the values for the
513 .\"O .B CBAUD
514 .\"O bits, shifted left
515 .\"O .B IBSHIFT
516 .\"O bits.
517 .\"O [requires
518 .\"O .B _BSD_SOURCE
519 .\"O or
520 .\"O .BR _SVID_SOURCE ]
521 .\"O (Not implemented on Linux.)
522 (POSIX にはない) 入力速度のマスク。
523 .B CIBAUD
524 ビットのための値は
525 .B CBAUD
526 ビットのための値と同じであり、
527 左に
528 .B IBSHIFT
529 ビットシフトしたものである。
530 .RB [ _BSD_SOURCE
531
532 .B _SVID_SOURCE
533 が必要]
534 (Linux では実装されていない)
535 .TP
536 .B CMSPAR
537 .\"O (not in POSIX)
538 .\"O Use "stick" (mark/space) parity (supported on certain serial
539 .\"O devices): if
540 .\"O .B PARODD
541 .\"O is set, the parity bit is always 1; if
542 .\"O .B PARODD
543 .\"O is not set, then the parity bit is always 0).
544 .\"O [requires
545 .\"O .B _BSD_SOURCE
546 .\"O or
547 .\"O .BR _SVID_SOURCE ]
548 (POSIX にはない)
549 (一部のシリアルデバイスでサポートされている)
550 「スティック (stick)」パリティ (マーク/スペース パリティ)を使用する。
551 .B PARODD
552 が設定された場合パリティビットは常に 1 となり、
553 設定されない場合は常に 0 となる。
554 .RB [ _BSD_SOURCE
555
556 .B _SVID_SOURCE
557 が必要]
558 .TP
559 .B CRTSCTS
560 .\"O (not in POSIX) Enable RTS/CTS (hardware) flow control.
561 .\"O [requires
562 .\"O .B _BSD_SOURCE
563 .\"O or
564 .\"O .BR _SVID_SOURCE ]
565 (POSIX にはない) RTS/CTS (ハードウェア) フロー制御を有効にする。
566 .RB [ _BSD_SOURCE
567
568 .B _SVID_SOURCE
569 が必要]
570 .PP
571 .\"O \fIc_lflag\fP flag constants:
572 \fIc_lflag\fP フラグは以下の通り:
573 .TP
574 .B ISIG
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 の文字を受信した時、対応するシグナルを
578 発生させる。
579 .TP
580 .B ICANON
581 .\"O Enable canonical mode (described below).
582 カノニカルモードを有効にする (下記参照)。
583 .TP
584 .B XCASE
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
596 .RB [ _BSD_SOURCE
597
598 .B _SVID_SOURCE
599
600 .B _XOPEN_SOURCE
601 が必要]
602 .\" 以下はおそらく glibc の間違いであろう。
603 .\"O .\" Define
604 .\"O .\" .B _XOPEN_SOURCE
605 .\"O .\" to expose
606 .\"O .\" .BR XCASE .
607 .\" .B XCASE
608 .\" を公開するには
609 .\" .B _XOPEN_SOURCE
610 .\" を定義すること。
611 .TP
612 .B ECHO
613 .\"O Echo input characters.
614 入力された文字をエコーする。
615 .TP
616 .B ECHOE
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 文字は前の文字を削除し、
620 WERASE 文字は前の単語を削除する。
621 .TP
622 .B ECHOK
623 .\"O If \fBICANON\fP is also set, the KILL character erases the current line.
624 \fBICANON\fP も同時に設定された場合、KILL 文字は現在の行を削除する。
625 .TP
626 .B ECHONL
627 .\"O If \fBICANON\fP is also set, echo the NL character even if ECHO is not set.
628 \fBICANON\fP も同時に設定された場合、
629 ECHO が設定されていなくても NL 文字をエコーする。
630 .TP
631 .B ECHOCTL
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.
638 .\"O [requires
639 .\"O .B _BSD_SOURCE
640 .\"O or
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 とエコーされる。
646 .RB [ _BSD_SOURCE
647
648 .B _SVID_SOURCE
649 が必要]
650 .TP
651 .B ECHOPRT
652 .\"O (not in POSIX) If \fBICANON\fP and \fBIECHO\fP are also set, characters
653 .\"O are printed as they are being erased.
654 .\"O [requires
655 .\"O .B _BSD_SOURCE
656 .\"O or
657 .\"O .BR _SVID_SOURCE ]
658 (POSIX にはない) \fBICANON\fP および \fBIECHO\fP が同時に設定されている場合、
659 削除された文字も表示される。
660 .RB [ _BSD_SOURCE
661
662 .B _SVID_SOURCE
663 が必要]
664 .TP
665 .B ECHOKE
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.
668 .\"O [requires
669 .\"O .B _BSD_SOURCE
670 .\"O or
671 .\"O .BR _SVID_SOURCE ]
672 (POSIX にはない) \fBICANON\fP も設定された場合、
673 KILL が行の各文字を消去する代わりにエコーされる。
674 これは \fBECHOE\fP および \fBECHOPRT\fP を指定することと等しい。
675 .RB [ _BSD_SOURCE
676
677 .B _SVID_SOURCE
678 が必要]
679 .TP
680 .B DEFECHO
681 .\"O (not in POSIX) Echo only when a process is reading.
682 .\"O (Not implemented on Linux.)
683 (POSIX にはない) プロセスが読み込んだときにだけエコーする。
684 (Linux では実装されていない)
685 .TP
686 .B FLUSHO
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.
691 .\"O [requires
692 .\"O .B _BSD_SOURCE
693 .\"O or
694 .\"O .BR _SVID_SOURCE ]
695 (POSIX にはない; Linux では対応していない)
696 出力をフラッシュする。このフラグは DISCARD 文字を入力することで切替えられる。
697 .RB [ _BSD_SOURCE
698
699 .B _SVID_SOURCE
700 が必要]
701 .TP
702 .B NOFLSH
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 入力・出力キューのフラッシュを無効にする。
708 .TP
709 .B TOSTOP
710 .\"O Send the
711 .\"O .B SIGTTOU
712 .\"O signal to the process group of a background process
713 .\"O which tries to write to its controlling terminal.
714 バックグラウンドプロセスのプロセスグループで制御端末へ
715 文字を出力しようとしているプロセスに対して
716 .B SIGTTOU
717 シグナルを送る。
718 .TP
719 .B PENDIN
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.
723 .\"O .RB ( bash (1)
724 .\"O handles typeahead this way.)
725 .\"O [requires
726 .\"O .B _BSD_SOURCE
727 .\"O or
728 .\"O .BR _SVID_SOURCE ]
729 (POSIX にはない; Linux では対応していない)
730 次の文字を読み込んだ時、入力キュー中の全文字を再表示する。
731 .RB ( bash (1)
732 は入力行をこのように処理している。)
733 .RB [ _BSD_SOURCE
734
735 .B _SVID_SOURCE
736 が必要]
737 .TP
738 .B IEXTEN
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.
743 実装依存の入力処理を有効にする。
744 このフラグは、特殊文字である EOL2, LNEXT, REPRINT, WERASE や、
745 \fBIUCLC\fP フラグを有効にするために必要である。
746 .PP
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 シンボルの一覧 (初期値) と意味は以下の通り。
751 .TP
752 .B VINTR
753 .\"O (003, ETX, Ctrl-C, or also 0177, DEL, rubout)
754 .\"O Interrupt character.
755 .\"O Send a
756 .\"O .B SIGINT
757 .\"O signal.
758 .\"O Recognized when
759 .\"O .B ISIG
760 .\"O is set, and then not passed as input.
761 (003, ETX, Ctrl-C か 0177, DEL, rubout)
762 割り込み文字。
763 .B SIGINT
764 シグナルを送る。
765 .B ISIG
766 がセットされている場合に認識し、入力には渡されない。
767 .TP
768 .B VQUIT
769 .\"O (034, FS, Ctrl-\e)
770 .\"O Quit character.
771 .\"O Send
772 .\"O .B SIGQUIT
773 .\"O signal.
774 .\"O Recognized when
775 .\"O .B ISIG
776 .\"O is set, and then not passed as input.
777 (034, FS, Ctrl-\e)
778 終了文字。
779 .B SIGQUIT
780 シグナルを送る。
781 .B ISIG
782 がセットされている場合に認識し、入力には渡されない。
783 .TP
784 .B VERASE
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.
789 .\"O Recognized when
790 .\"O .B ICANON
791 .\"O is set, and then not passed as input.
792 (0177, DEL, rubout か 010, BS, Ctrl-H か #)
793 消去文字。これにより、直前の未消去文字を消去する。
794 しかし、EOF や行頭を超えては消去しない。
795 .B ICANON
796 がセットされている場合に認識し、入力には渡されない。
797 .TP
798 .B VKILL
799 .\"O (025, NAK, Ctrl-U, or Ctrl-X, or also @)
800 .\"O Kill character.
801 .\"O This erases the input since the last EOF or beginning-of-line.
802 .\"O Recognized when
803 .\"O .B ICANON
804 .\"O is set, and then not passed as input.
805 (025, NAK, Ctrl-U か Ctrl-X か @)
806 完全消去文字。直前の EOF か行頭以降の全ての入力を消去する。
807 .B ICANON
808 がセットされている場合に認識し、入力には渡されない。
809 .TP
810 .B VEOF
811 .\"O (004, EOT, Ctrl-D)
812 .\"O End-of-file character.
813 (004, EOT, Ctrl-D)
814 ファイル終端文字。
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
819 .\"O .BR read (2)
820 .\"O in the
821 .\"O user program returns 0, which signifies end-of-file.
822 これが行の最初の文字だった場合、ユーザープログラムの
823 .BR read (2)
824 は 0 を
825 返し、ファイル終端であることを知らせる。
826 .\"O Recognized when
827 .\"O .B ICANON
828 .\"O is set, and then not passed as input.
829 .B ICANON
830 がセットされている場合に認識し、入力には渡されない。
831 .TP
832 .B VMIN
833 .\"O Minimum number of characters for noncanonical read.
834 非カノニカル読み込み時の最小文字数。
835 .TP
836 .B VEOL
837 (0, NUL)
838 .\"O Additional end-of-line character.
839 .\"O Recognized when
840 .\"O .B ICANON
841 .\"O is set.
842 追加の行末文字。
843 .B ICANON
844 がセットされている場合に認識する。
845 .TP
846 .B VTIME
847 .\"O Timeout in deciseconds for noncanonical read.
848 非カノニカル読み込み時のタイムアウト時間 (1/10 秒単位)。
849 .TP
850 .B VEOL2
851 .\"O (not in POSIX; 0, NUL)
852 (POSIX にはない; 0, NUL)
853 .\"O Yet another end-of-line character.
854 .\"O Recognized when
855 .\"O .B ICANON
856 .\"O is set.
857 追加の行末文字。
858 .B ICANON
859 がセットされている場合に認識する。
860 .TP
861 .B VSWTCH
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 でのみ用いられる)。
867 .TP
868 .B VSTART
869 (021, DC1, Ctrl-Q)
870 .\"O Start character.
871 .\"O Restarts output stopped by the Stop character.
872 .\"O Recognized when
873 .\"O .B IXON
874 .\"O is set, and then not passed as input.
875 開始文字。停止文字で停止した出力を再開する。
876 .B IXON
877 がセットされている場合に認識し、入力には渡されない。
878 .TP
879 .B VSTOP
880 (023, DC3, Ctrl-S)
881 .\"O Stop character.
882 .\"O Stop output until Start character typed.
883 .\"O Recognized when
884 .\"O .B IXON
885 .\"O is set, and then not passed as input.
886 停止文字。開始文字が入力されるまで出力を停止する。
887 .B IXON
888 が設定されている場合に認識し、入力には渡されない。
889 .TP
890 .B VSUSP
891 (032, SUB, Ctrl-Z)
892 .\"O Suspend character.
893 .\"O Send
894 .\"O .B SIGTSTP
895 .\"O signal.
896 .\"O Recognized when
897 .\"O .B ISIG
898 .\"O is set, and then not passed as input.
899 中断文字。
900 .B SIGTSTP
901 シグナルを送る。
902 .B ISIG
903 がセットされている場合に認識し、入力には渡されない。
904 .TP
905 .B VDSUSP
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:
909 .\"O send
910 .\"O .B SIGTSTP
911 .\"O signal when the character is read by the user program.
912 .\"O Recognized when
913 .\"O .B IEXTEN
914 .\"O and
915 .\"O .B ISIG
916 .\"O are set, and the system supports
917 .\"O job control, and then not passed as input.
918 遅延中断文字。ユーザープログラムから文字が読み込まれた時に
919 .B SIGTSTP
920 シグナルを送る。
921 .B IEXTEN
922
923 .B ISIG
924 がセットされていて、システムがジョブ制御に対応している場合に
925 認識し、入力には渡されない。
926 .TP
927 .B VLNEXT
928 .\"O (not in POSIX; 026, SYN, Ctrl-V)
929 (POSIX にはない; 026, SYN Ctrl-V)
930 .\"O Literal next.
931 .\"O Quotes the next input character, depriving it of
932 .\"O a possible special meaning.
933 .\"O Recognized when
934 .\"O .B IEXTEN
935 .\"O is set, and then not passed as input.
936 リテラル。次の入力文字をエスケープし、特別な意味があっても解釈しない。
937 .B IEXTEN
938 がセットされている場合に認識し、入力には渡されない。
939 .TP
940 .B VWERASE
941 .\"O (not in POSIX; 027, ETB, Ctrl-W)
942 (POSIX にはない; 027, ETB, Ctrl-W)
943 .\"O Word erase.
944 単語消去。
945 .\"O Recognized when
946 .\"O .B ICANON
947 .\"O and
948 .\"O .B IEXTEN
949 .\"O are set, and then not passed as input.
950 .B ICANON
951
952 .B IEXTEN
953 がセットされている場合に認識し、入力には渡されない。
954 .TP
955 .B VREPRINT
956 .\"O (not in POSIX; 022, DC2, Ctrl-R)
957 (POSIX にはない; 022, DC2, Ctrl-R)
958 .\"O Reprint unread characters.
959 まだ読み込んでいない文字列を再表示する。
960 .\"O Recognized when
961 .\"O .B ICANON
962 .\"O and
963 .\"O .B IEXTEN
964 .\"O are set, and then not passed as input.
965 .B ICANON
966
967 .B IEXTEN
968 がセットされている場合に認識し、入力には渡されない。
969 .TP
970 .B VDISCARD
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 未送信バッファの内容の破棄/保存を切り替える。
975 .\"O Recognized when
976 .\"O .B IEXTEN
977 .\"O is set, and then not passed as input.
978 .B IEXTEN
979 がセットされている場合に認識し、入力には渡されない。
980 .TP
981 .B VSTATUS
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)
986 .LP
987 .\"O These symbolic subscript values are all different, except that
988 .\"O .BR VTIME ,
989 .\"O .B VMIN
990 .\"O may have the same value as
991 .\"O .BR VEOL ,
992 .\"O .BR VEOF ,
993 .\"O respectively.
994 これらのシンボルの示す値は全て異なる。
995 ただし、
996 .BR VTIME ,
997 .B VMIN
998 はそれぞれ
999 .BR VEOL ,
1000 .B VEOF
1001 と同じ値である。
1002 .\"O In noncanonical mode the special character meaning is replaced
1003 .\"O by the timeout meaning.
1004 .\"O For an explanation of
1005 .\"O .B VMIN
1006 .\"O and
1007 .\"O .BR VTIME ,
1008 .\"O see the description of
1009 .\"O noncanonical mode below.
1010 非カノニカルモードでは、特殊文字の意味はタイムアウトの意味に変わる。
1011 .B VMIN
1012
1013 .B VTIME
1014 の説明については、下記の非カノニカルモードの説明を参照のこと。
1015 .\"O .SS "Retrieving and changing terminal settings"
1016 .SS "端末の設定の取得と変更"
1017 .PP
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.
1025 .BR tcgetattr ()
1026 は \fIfd\fP に関するパラメータを取得し、\fItermios_p\fP が参照する構
1027 造体 \fItermios\fP に設定する。この関数はバックグラウンドプロセスから
1028 呼ばれることもあるが、この場合、端末の属性はフォアグラウンドプロセス
1029 によって変化することもある。
1030 .LP
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:
1036 .BR tcsetattr ()
1037 は端末に関連したパラメータを設定する (ハードウェアの設定に必要で、ここで
1038 設定できないものを除く)。設定には \fItermios_p\fP が参照する
1039 \fItermios\fP 構造体を用いる。
1040 \fIoptional_actions\fP には変更が有効となるタイミングを設定する:
1041 .IP \fBTCSANOW\fP
1042 .\"O the change occurs immediately.
1043 ただちに変更が有効となる。
1044 .IP \fBTCSADRAIN\fP
1045 .\"O the change occurs after all output written to
1046 .\"O .I fd
1047 .\"O has been transmitted.
1048 .\"O This function should be used when changing
1049 .\"O parameters that affect output.
1050 .I fd
1051 への出力がすべて転送された後に変更が有効になる。この機能は
1052 出力に影響するパラメータを変更する時に使用するべきである。
1053 .IP \fBTCSAFLUSH\fP
1054 .\"O the change occurs after all output written to the object referred by
1055 .\"O .I fd
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.
1058 パラメータを変更する前に、
1059 .I fd
1060 への出力がすべて転送され、受信したがまだ読み込んでいないすべての
1061 入力が破棄される。
1062 .\"O .SS "Canonical and noncanonical mode"
1063 .SS "カノニカルモードと非カノニカルモード"
1064 .\"O The setting of the
1065 .\"O .B ICANON
1066 .\"O canon flag in
1067 .\"O .I c_lflag
1068 .\"O determines whether the terminal is operating in canonical mode
1069 .\"O .RB ( ICANON
1070 .\"O set) or
1071 .\"O noncanonical mode
1072 .\"O .RB ( ICANON
1073 .\"O unset).
1074 .\"O By default,
1075 .\"O .B ICANON
1076 .\"O set.
1077 .I c_lflag
1078
1079 .B ICANON
1080 フラグの設定により、端末がカノニカルモードで動作するかが決定される。
1081 .B ICANON
1082 がセットされた場合、カノニカルモード (canonical mode) となり、
1083 セットされない場合、非カノニカルモード (noncanonical mode) となる。
1084 デフォルトでは、
1085 .B ICANON
1086 はセットされる。
1087
1088 .\"O In canonical mode:
1089 カノニカルモードでは、以下のような動作となる。
1090 .IP * 2
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
1096 .\"O .BR read (2).
1097 入力は行単位に行われる。
1098 行区切り文字が打ち込まれた時点で、入力行が利用可能となる。
1099 行区切り文字は NL, EOL, EOL2 および行頭での EOF である。
1100 EOF 以外の場合、
1101 .BR read (2)
1102 が返すバッファに行区切り文字も含められる。
1103 .IP * 2
1104 .\"O Line editing is enabled (ERASE, KILL;
1105 .\"O and if the
1106 .\"O .B IEXTEN
1107 .\"O flag is set: WERASE, REPRINT, LNEXT).
1108 .\"O A
1109 .\"O .BR read (2)
1110 .\"O returns at most one line of input; if the
1111 .\"O .BR read (2)
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
1115 .\"O .BR read (2).
1116 行編集が有効となる (ERASE, KILL が効果を持つ。
1117 .B IEXTEN
1118 フラグが設定された場合は、
1119 WERASE, REPRINT, LNEXT も効果を持つ)。
1120 .BR read (2)
1121 は最大でも 1行の入力しか返さない。
1122 .BR read (2)
1123 が要求したバイト数が現在の入力行のバイト数よりも少ない場合、
1124 要求したのと同じバイト数だけが読み込まれ、
1125 残りの文字は次回の
1126 .BR read (2)
1127 で読み込まれる。
1128 .PP
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] )
1134 .\"O and TIME
1135 .\"O .RI ( c_cc[VTIME] )
1136 .\"O determine the circumstances in which a
1137 .\"O .BR read (2)
1138 .\"O completes; there are four distinct cases:
1139 非カノニカルモードでは、入力は即座に利用可能となり
1140 (ユーザは行区切り文字を打ち込む必要はない)、
1141 行編集は無効となる。
1142 MIN
1143 .RI ( c_cc[VMIN] )
1144 と TIME
1145 .RI ( c_cc[VTIME] )
1146 の設定により、
1147 .BR read (2)
1148 が完了する条件が決定される。4種類の場合がある:
1149 .IP * 2
1150 MIN == 0; TIME == 0:
1151 .\"O If data is available,
1152 .\"O .BR read (2)
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,
1156 .\"O .BR read (2)
1157 .\"O returns 0.
1158 データが利用可能であれば、
1159 .BR read (2)
1160 はすぐに返る。このときの返り値は、そのとき利用可能なバイト数か
1161 .BR read (2)
1162 の要求バイト数のうち小さい方となる。
1163 利用可能なデータがない場合
1164 .BR read (2)
1165 は 0 を返す。
1166 .IP * 2
1167 MIN > 0; TIME == 0:
1168 .\"O .BR read (2)
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.
1171 .BR read (2)
1172 は、利用可能なデータが MIN バイトか要求バイト数のいずれかに達するまで
1173 停止する。返り値は、MIN か要求バイト数の小さい方となる。
1174 .IP * 2
1175 MIN == 0; TIME > 0:
1176 .\"O TIME specifies the limit for a timer in tenths of a second.
1177 .\"O The timer is started when
1178 .\"O .BR read (2)
1179 .\"O is called.
1180 .\"O .BR read (2)
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,
1184 .\"O .BR read (2)
1185 .\"O returns 0.
1186 TIME はタイマの上限を規定し、単位は 1/10 秒である。
1187 タイマは
1188 .BR read (2)
1189 が呼ばれた時点で開始される。
1190 .BR read (2)
1191 が返るのは、少なくとも 1バイトのデータが利用可能となった時点、
1192 またはタイマが時間切れとなった時点である。
1193 入力が全くなくタイマが時間切れとなった場合、
1194 .BR read (2)
1195 は 0 を返す。
1196 .IP * 2
1197 MIN > 0; TIME > 0:
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.
1201 .\"O .BR read (2)
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バイト受信する度にタイマがリセットされる。
1210 .BR read (2)
1211 が返るのは、MIN バイトか要求バイト数のうち少ない方まで読み出された時点か、
1212 バイト間タイマが時間切れとなった時点である。
1213 は最初のバイトが利用可能にならないとタイマは開始されないので、
1214 少なくとも 1バイトは読み込まれる。
1215 .SS "Raw mode"
1216 .LP
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:
1224 .BR cfmakeraw ()
1225 は、端末を昔の Version 7 端末ドライバの
1226 "raw" モードのように設定する。
1227 入力は文字単位に可能であり、エコーが無効となり、
1228 端末の入出力文字に対する特殊処理はすべて無効となる。
1229 端末の属性は以下のように設定される:
1230 .nf
1231
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;
1238 .fi
1239 .\"O .SS "Line control"
1240 .SS "ライン制御"
1241 .LP
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
1245 .\"O transmission.
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.
1250 .BR tcsendbreak ()
1251 は端末が非同期のシリアルデータ転送を用いている場合に、
1252 連続した0のビット列を一定間隔で転送する。
1253 \fIduration\fP が 0 の場合は、0 のビットを 0.25 秒以上、
1254 0.5 秒以下の間隔で転送する。 \fIduration\fP が 0 でない場合は、
1255 0 のビットを実装依存の時間間隔で送る。
1256 .LP
1257 .\"O If the terminal is not using asynchronous serial data transmission,
1258 .\"O .BR tcsendbreak ()
1259 .\"O returns without taking any action.
1260 端末が非同期のシリアルデータ転送モードでない場合、
1261 .BR tcsendbreak ()
1262 は何も行わずに戻る。
1263 .LP
1264 .\"O .BR tcdrain ()
1265 .\"O waits until all output written to the object referred to by
1266 .\"O .I fd
1267 .\"O has been transmitted.
1268 .BR tcdrain ()
1269
1270 .I fd
1271 が行っている出力の転送が完了するまで待つ。
1272 .LP
1273 .\"O .BR tcflush ()
1274 .\"O discards data written to the object referred to by
1275 .\"O .I fd
1276 .\"O but not transmitted, or data received but not read, depending on the
1277 .\"O value of
1278 .\"O .IR queue_selector :
1279 .BR tcflush ()
1280
1281 .I fd
1282 が行っているデータの出力でまだ転送されていないもの、あるいは受信し
1283 たがまだ入力していないものを破棄する。いずれを行うかは
1284 .I queue_selector
1285 の値で定める:
1286 .\"??nakano flush == discard?
1287 .IP \fBTCIFLUSH\fP
1288 .\"O flushes data received but not read.
1289 受信したが読んでいないデータをフラッシュする。
1290 .IP \fBTCOFLUSH\fP
1291 .\"O flushes data written but not transmitted.
1292 書いたが送信していないデータをフラッシュする。
1293 .IP \fBTCIOFLUSH\fP
1294 .\"O flushes both data received but not read, and data written but not
1295 .\"O transmitted.
1296 受信したが読んでいないデータ・書いたが送信していないデータ両方
1297 をフラッシュする。
1298 .LP
1299 .\"O .BR tcflow ()
1300 .\"O suspends transmission or reception of data on the object referred to by
1301 .\"O .IR fd ,
1302 .\"O depending on the value of
1303 .\"O .IR action :
1304 .BR tcflow ()
1305
1306 .I fd
1307 で指定されたオブジェクトにおけるデータの送信あるいは受信を一時的に中断する。
1308 送信と受信のどちらかは、
1309 .IR action で決まる:
1310 .IP \fBTCOOFF\fP
1311 .\"O suspends output.
1312 出力の中断。
1313 .IP \fBTCOON\fP
1314 .\"O restarts suspended output.
1315 中断した出力の再開。
1316 .IP \fBTCIOFF\fP
1317 .\"O transmits a STOP character, which stops the terminal device from
1318 .\"O transmitting data to the system.
1319 STOP 文字の送信。
1320 STOP 文字は端末デバイスからシステムへのデータ送信を停止する。
1321 .IP \fBTCION\fP
1322 .\"O transmits a START character, which starts the terminal device
1323 .\"O transmitting data to the system.
1324 START 文字の送信。
1325 START 文字は端末デバイスからシステムへのデータ送信を開始する。
1326 .LP
1327 .\"O The default on open of a terminal file is that neither its input nor its
1328 .\"O output is suspended.
1329 端末ファイルがオープンされたときのデフォルトでは、
1330 入力も出力も中断されていない。
1331 .\"O .SS "Line speed"
1332 .SS "ライン速度"
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
1336 .\"O until
1337 .\"O .BR tcsetattr ()
1338 .\"O is successfully called.
1339 ボーレート関数は \fItermios\fP 構造体中の入出力ボーレートを
1340 取得、設定するために提供される。
1341 設定された値は
1342 .BR tcsetattr ()
1343 の呼び出しが成功するまでは有効ではない。
1344
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 に該当する実際のビットレートは
1350 .BR setserial (8)
1351
1352 変更できる。
1353 .LP
1354 .\"O The input and output baud rates are stored in the \fItermios\fP
1355 .\"O structure.
1356 入力および出力ボーレートは \fItermios\fP 構造体に格納される。
1357 .LP
1358 .\"O .BR cfgetospeed ()
1359 .\"O returns the output baud rate stored in the \fItermios\fP structure
1360 .\"O pointed to by
1361 .\"O .IR termios_p .
1362 .BR cfgetospeed ()
1363
1364 .I termios_p
1365 が示している \fItermios\fP 構造体に格納されている
1366 出力ボーレートを返す。
1367 .LP
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:
1371 .BR cfsetospeed ()
1372 は \fItermios_p\fP で示されている \fItermios\fP 構造体中の出力ボーレートを
1373 \fIspeed\fP に設定する。値は以下のいずれかでなければならない:
1374 .nf
1375
1376 .ft B
1377         B0
1378         B50
1379         B75
1380         B110
1381         B134
1382         B150
1383         B200
1384         B300
1385         B600
1386         B1200
1387         B1800
1388         B2400
1389         B4800
1390         B9600
1391         B19200
1392         B38400
1393         B57600
1394         B115200
1395         B230400
1396 .ft P
1397
1398 .fi
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が指定された場合、モデムの制御線は使用されない状態になり、一般にはこれで
1408 接続が切断される。
1409 \fBCBAUDEX\fP はPOSIX.1で定義されている速度の範囲外 (57600 およびそれ以上)
1410 を設定する。すなわち例えば \fBB57600\fP & \fBCBAUDEX\fP は 0 でない。
1411 .LP
1412 .\"O .BR cfgetispeed ()
1413 .\"O returns the input baud rate stored in the \fItermios\fP structure.
1414 .BR cfgetispeed ()
1415 は \fItermios\fP 構造体中の入力ボーレートを返す。
1416 .LP
1417 .\"O .BR cfsetispeed ()
1418 .\"O sets the input baud rate stored in the \fItermios\fP structure to
1419 .\"O .IR speed ,
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.
1424 .BR cfsetispeed ()
1425 は \fItermios\fP 構造体中の入力ボーレートを
1426 .I speed
1427 に設定する。
1428 .I speed
1429 には、上述の
1430 .BR cfsetospeed ()
1431 のボーレート定数 \fBBnnn\fP のいずれか一つを指定しなければならない。
1432 入力ボーレートが 0 に設定された場合、入力ボーレートは出力ボーレート
1433 と同じ値となる。
1434 .LP
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.
1440 .BR cfsetspeed ()
1441 は 4.4BSD による拡張である。この関数は
1442 .BR cfsetispeed ()
1443 と同じ引き数をとり、入出力両方の速度を設定する。
1444 .\"O .SH "RETURN VALUE"
1445 .SH 返り値
1446 .LP
1447 .\"O .BR cfgetispeed ()
1448 .\"O returns the input baud rate stored in the
1449 .\"O \fItermios\fP
1450 .\"O structure.
1451 .BR cfgetispeed ()
1452 は \fItermios\fP 構造体中の入力ボーレートを返す。
1453 .LP
1454 .\"O .BR cfgetospeed ()
1455 .\"O returns the output baud rate stored in the \fItermios\fP structure.
1456 .BR cfgetospeed ()
1457 は \fItermios\fP 構造体中の出力ボーレートを返す。
1458 .LP
1459 .\"O All other functions return:
1460 他のすべての関数の戻り値:
1461 .IP 0
1462 .\"O on success.
1463 実行成功。
1464 .IP \-1
1465 .\"O on failure and set
1466 .\"O .I errno
1467 .\"O to indicate the error.
1468 実行失敗。
1469 .I errno
1470 がエラーの種類を示す。
1471 .LP
1472 .\"O Note that
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.
1480 .BR tcsetattr ()
1481 は \fIなんらかの\fP 変更要求が成功した場合に成功を返すことに注意。
1482 従って、複数の変更を行った場合には、引き続いて
1483 .BR tcgetattr ()
1484 を呼び出して全ての変更が実行されているかを確認する必要があるかもしれない。
1485 .\"O .SH CONFORMING TO
1486 .SH 準拠
1487 .BR tcgetattr (),
1488 .BR tcsetattr (),
1489 .BR tcsendbreak (),
1490 .BR tcdrain (),
1491 .BR tcflush (),
1492 .BR tcflow (),
1493 .BR cfgetispeed (),
1494 .BR cfgetospeed (),
1495 .BR cfsetispeed (),
1496 .\"O and
1497 .BR cfsetospeed ()
1498 .\"O are specified in POSIX.1-2001.
1499 は POSIX.1-2001 で規定されている。
1500
1501 .\"O .BR cfmakeraw ()
1502 .\"O and
1503 .\"O .BR cfsetspeed ()
1504 .\"O are nonstandard, but available on the BSDs.
1505 .BR cfmakeraw ()
1506
1507 .BR cfsetspeed ()
1508 は非標準だが、BSD では利用可能である。
1509 .\"O .SH NOTES
1510 .SH 注意
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 つを
1517 追加している。
1518 多くのシステムではさらに高速なボーレートのためにリストを拡張している。
1519 .LP
1520 .\"O The effect of a nonzero \fIduration\fP with
1521 .\"O .BR tcsendbreak ()
1522 .\"O varies.
1523 .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.
1528 SunOS は
1529 .IB duration * N
1530 秒のブレークを規定している。ここで \fIN\fP は 0.25 以上 0.5 未満である。
1531 .\"O Linux, AIX, DU, Tru64 send a break of
1532 .\"O .I duration
1533 .\"O milliseconds.
1534 Linux, AIX, DU, Tru64 は
1535 .I duration
1536 ミリ秒のブレークを送信する。
1537 .\"O FreeBSD and NetBSD and HP-UX and MacOS ignore the value of
1538 .\"O .IR duration .
1539 FreeBSD, NetBSD, HP-UX, MacOS は
1540 .I duration
1541 の値を無視する。
1542 .\"O Under Solaris and UnixWare,
1543 .\"O .BR tcsendbreak ()
1544 .\"O with nonzero
1545 .\"O .I duration
1546 .\"O behaves like
1547 .\"O .BR tcdrain ().
1548 Solaris と UnixWare では、非ゼロの
1549 .I duration
1550 を指定した
1551 .BR tcsendbreak ()
1552 の振る舞いは
1553 .BR tcdrain ()
1554 と同様である。
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
1559 .\"O .SH "SEE ALSO"
1560 .SH 関連項目
1561 .BR stty (1),
1562 .BR console_ioctl (4),
1563 .BR tty_ioctl (4),
1564 .BR setserial (8)