summaryrefslogtreecommitdiffstats
path: root/doc/open.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/open.n')
-rw-r--r--doc/open.n71
1 files changed, 31 insertions, 40 deletions
diff --git a/doc/open.n b/doc/open.n
index 686d8e1..f71e920 100644
--- a/doc/open.n
+++ b/doc/open.n
@@ -5,12 +5,12 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: open.n,v 1.29 2007/10/24 14:29:38 dkf Exp $
+'\" RCS: @(#) $Id: open.n,v 1.30 2007/10/26 20:11:53 dgp Exp $
'\"
.so man.macros
.TH open n 8.3 Tcl "Tcl Built-In Commands"
.BS
-.\" Note: do not modify the .SH NAME line immediately below!
+'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
open \- Open a file-based or command pipeline channel
.SH SYNOPSIS
@@ -66,7 +66,7 @@ Set the initial access position to the end of the file.
All of the legal \fIaccess\fR values above may have the character
\fBb\fR added as the second or third character in the value to
indicate that the opened channel should be configured with the
-\fB\-translation binary\fR option, making the channel suitable for
+\fB-translation binary\fR option, making the channel suitable for
reading or writing of binary data.
.VE 8.5
.PP
@@ -88,7 +88,7 @@ Set the file pointer to the end of the file prior to each write.
.VS 8.5
.TP 15
\fBBINARY\fR
-Configure the opened channel with the \fB\-translation binary\fR option.
+Configure the opened channel with the \fB-translation binary\fR option.
.VE 8.5
.TP 15
\fBCREAT\fR
@@ -119,12 +119,12 @@ If a new file is created as part of opening it, \fIpermissions\fR
(an integer) is used to set the permissions for the new file in
conjunction with the process's file mode creation mask.
\fIPermissions\fR defaults to 0666.
+
.SH "COMMAND PIPELINES"
.PP
-If the first character of \fIfileName\fR is
-.QW |
-then the remaining characters of \fIfileName\fR are treated as a list of
-arguments that describe a command pipeline to invoke, in the same style as the
+If the first character of \fIfileName\fR is ``|'' then the
+remaining characters of \fIfileName\fR are treated as a list of arguments
+that describe a command pipeline to invoke, in the same style as the
arguments for \fBexec\fR.
In this case, the channel identifier returned by \fBopen\fR may be used
to write to the command's input pipe or read from its output pipe,
@@ -162,15 +162,10 @@ This option is a set of 4 comma-separated values: the baud rate, parity,
number of data bits, and number of stop bits for this serial port. The
\fIbaud\fR rate is a simple integer that specifies the connection speed.
\fIParity\fR is one of the following letters: \fBn\fR, \fBo\fR, \fBe\fR,
-\fBm\fR, \fBs\fR; respectively signifying the parity options of
-.QW none ,
-.QW odd ,
-.QW even ,
-.QW mark ,
-or
-.QW space .
-\fIData\fR is the number of data bits and should be an integer from 5 to 8,
-while \fIstop\fR is the number of stop bits and should be the integer 1 or 2.
+\fBm\fR, \fBs\fR; respectively signifying the parity options of ``none'',
+``odd'', ``even'', ``mark'', or ``space''. \fIData\fR is the number of
+data bits and should be an integer from 5 to 8, while \fIstop\fR is the
+number of stop bits and should be the integer 1 or 2.
.TP
\fB\-handshake\fR \fItype\fR
(Windows and Unix). This option is used to setup automatic handshake
@@ -181,14 +176,14 @@ If \fItype\fR is \fBnone\fR then any handshake is switched off.
\fBrtscts\fR activates hardware handshake. Hardware handshake signals
are described below.
For software handshake \fBxonxoff\fR the handshake characters can be redefined
-with \fB\-xchar\fR.
+with \fB-xchar\fR.
An additional hardware handshake \fBdtrdsr\fR is available only under Windows.
There is no default handshake configuration, the initial value depends
on your operating system settings.
-The \fB\-handshake\fR option cannot be queried.
+The \fB-handshake\fR option cannot be queried.
.TP
\fB\-queue\fR
-(Windows and Unix). The \fB\-queue\fR option can only be queried.
+(Windows and Unix). The \fB-queue\fR option can only be queried.
It returns a list of two integers representing the current number
of bytes in the input and output queue respectively.
.TP
@@ -197,7 +192,7 @@ of bytes in the input and output queue respectively.
read operations. It specifies the maximum interval between the
reception of two bytes in milliseconds.
For Unix systems the granularity is 100 milliseconds.
-The \fB\-timeout\fR option does not affect write operations or
+The \fB-timeout\fR option does not affect write operations or
nonblocking reads.
This option cannot be queried.
.TP
@@ -211,10 +206,10 @@ The BREAK condition (see below) is enabled and disabled with \fB{BREAK 1}\fR and
It's not a good idea to change the \fBRTS\fR (or \fBDTR\fR) signal
with active hardware handshake \fBrtscts\fR (or \fBdtrdsr\fR).
The result is unpredictable.
-The \fB\-ttycontrol\fR option cannot be queried.
+The \fB-ttycontrol\fR option cannot be queried.
.TP
\fB\-ttystatus\fR
-(Windows and Unix). The \fB\-ttystatus\fR option can only be
+(Windows and Unix). The \fB-ttystatus\fR option can only be
queried. It returns the current modem status and handshake input signals
(see below).
The result is a list of signal,value pairs with a fixed order,
@@ -250,6 +245,7 @@ In case of a serial communication error, \fBread\fR or \fBputs\fR
returns a general Tcl file I/O error.
\fBfconfigure -lasterror\fR can be called to get a list of error details.
See below for an explanation of the various error codes.
+
.SH "SERIAL PORT SIGNALS"
.PP
RS-232 is the most commonly used standard electrical interface for serial
@@ -280,9 +276,8 @@ serial port is opened.
\fBData Set Ready:\fR The complement to DTR. Tells the workstation that the
modem is ready to establish a link.
.IP \fBDCD(input)\fR
-\fBData Carrier Detect:\fR This line becomes active when a modem detects a
-.QW Carrier
-signal.
+\fBData Carrier Detect:\fR This line becomes active when a modem detects
+a "Carrier" signal.
.IP \fBRI(input)\fR
\fBRing Indicator:\fR Goes active when the modem detects an incoming call.
.IP \fBBREAK\fR
@@ -292,6 +287,7 @@ milliseconds. Normally a receive or transmit data signal stays at the mark
(on=1) voltage until the next character is transferred. A BREAK is sometimes
used to reset the communications line or change the operating mode of
communications hardware.
+
.SH "ERROR CODES (Windows only)"
.PP
A lot of different errors may occur during serial read operations or during
@@ -330,10 +326,10 @@ may cause this error.
.TP 10
\fBBREAK\fR
A BREAK condition has been detected by your UART (see above).
+
.SH "PORTABILITY ISSUES"
.TP
\fBWindows \fR(all versions)
-.
Valid values for \fIfileName\fR to open a serial port are of the form
\fBcom\fIX\fB:\fR, where \fIX\fR is a number, generally from 1 to 4.
This notation only works for serial ports from 1 to 9, if the system
@@ -344,7 +340,6 @@ where X is any number that corresponds to a serial port; please note
that this method is considerably slower on Windows 95 and Windows 98.
.TP
\fBWindows NT\fR
-.
When running Tcl interactively, there may be some strange interactions
between the real console, if one is present, and a command pipeline that uses
standard input or output. If a command pipeline is opened for reading, some
@@ -359,16 +354,14 @@ is not accessing the console, or if the command pipeline does not use
standard input or output, but is redirected from or to a file, then the
above problems do not occur.
.TP
-\fBWindows 95\fR
-.
+\fBWindows 95\fR
A command pipeline that executes a 16-bit DOS application cannot be opened
for both reading and writing, since 16-bit DOS applications that receive
standard input from a pipe and send standard output to a pipe run
synchronously. Command pipelines that do not execute 16-bit DOS
applications run asynchronously and can be opened for both reading and
writing.
-.RS
-.PP
+.sp
When running Tcl interactively, there may be some strange interactions
between the real console, if one is present, and a command pipeline that uses
standard input or output. If a command pipeline is opened for reading from
@@ -381,7 +374,7 @@ console at the same time. If the command pipeline is started from a script,
so that Tcl is not accessing the console, or if the command pipeline does
not use standard input or output, but is redirected from or to a file, then
the above problems do not occur.
-.PP
+.sp
Whether or not Tcl is running interactively, if a command pipeline is opened
for reading from a 16-bit DOS application, the call to \fBopen\fR will not
return until end-of-file has been received from the command pipeline's
@@ -389,17 +382,14 @@ standard output. If a command pipeline is opened for writing to a 16-bit DOS
application, no data will be sent to the command pipeline's standard output
until the pipe is actually closed. This problem occurs because 16-bit DOS
applications are run synchronously, as described above.
-.RE
.TP
\fBUnix\fR\0\0\0\0\0\0\0
-.
Valid values for \fIfileName\fR to open a serial port are generally of the
form \fB/dev/tty\fIX\fR, where \fIX\fR is \fBa\fR or \fBb\fR, but the name
of any pseudo-file that maps to a serial port may be used.
Advanced configuration options are only supported for serial ports
when Tcl is built to use the POSIX serial interface.
-.RS
-.PP
+.sp
When running Tcl interactively, there may be some strange interactions
between the console, if one is present, and a command pipeline that uses
standard input. If a command pipeline is opened for reading, some
@@ -409,7 +399,6 @@ both Tcl and the child application are competing for the console at the
same time. If the command pipeline is started from a script, so that Tcl is
not accessing the console, or if the command pipeline does not use standard
input, but is redirected from a file, then the above problem does not occur.
-.RE
.LP
See the PORTABILITY ISSUES section of the \fBexec\fR command for additional
information not specific to command pipelines about executing
@@ -423,9 +412,11 @@ if {[catch {close $fl} err]} {
puts "ls command failed: $err"
}
.CE
+
.SH "SEE ALSO"
-chan(n), close(n), exec(n), fconfigure(n), file(n), filename(n), gets(n),
-pid(n), puts(n), read(n), fopen(3)
+file(n), close(n), filename(n), fconfigure(n), gets(n), read(n),
+puts(n), exec(n), pid(n), fopen(3)
+
.SH KEYWORDS
access mode, append, create, file, non-blocking, open, permissions,
pipeline, process, serial