diff options
Diffstat (limited to 'contrib/tcl/doc/open.n')
-rw-r--r-- | contrib/tcl/doc/open.n | 136 |
1 files changed, 127 insertions, 9 deletions
diff --git a/contrib/tcl/doc/open.n b/contrib/tcl/doc/open.n index 8e6f1d3a4e298..feb7b61a4e6d9 100644 --- a/contrib/tcl/doc/open.n +++ b/contrib/tcl/doc/open.n @@ -5,10 +5,10 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) open.n 1.11 96/02/15 20:02:25 +'\" SCCS: @(#) open.n 1.16 97/01/14 18:00:35 '\" .so man.macros -.TH open n 7.5 Tcl "Tcl Built-In Commands" +.TH open n 7.6 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -24,8 +24,10 @@ open \- Open a file-based or command pipeline channel .SH DESCRIPTION .PP -This command opens a file or command pipeline and returns a channel -identifier that may be used in future invocations of commands like +.VS +This command opens a file, serial port, or command pipeline and returns a +.VE +channel identifier that may be used in future invocations of commands like \fBread\fR, \fBputs\fR, and \fBclose\fR. If the first character of \fIfileName\fR is not \fB|\fR then the command opens a file: @@ -90,7 +92,6 @@ If the file is a terminal device, this flag prevents the file from becoming the controlling terminal of the process. .TP 15 \fBNONBLOCK\fR -.VS Prevents the process from blocking while opening the file, and possibly in subsequent I/O operations. The exact behavior of this flag is system- and device-dependent; its use is discouraged @@ -98,7 +99,6 @@ this flag is system- and device-dependent; its use is discouraged in nonblocking mode). For details refer to your system documentation on the \fBopen\fR system call's \fBO_NONBLOCK\fR flag. -.VE .TP 15 \fBTRUNC\fR If the file exists it is truncated to zero length. @@ -122,10 +122,128 @@ output unless overridden by the command. If read-only access is used (e.g. \fIaccess\fR is \fBr\fR), standard input for the pipeline is taken from the current standard input unless overridden by the command. +.SH "SERIAL COMMUNICATIONS" +.VS +.PP +If \fIfileName\fR refers to a serial port, then the specified serial port +is opened and initialized in a platform-dependent manner. Acceptable +values for the \fIfileName\fR to use to open a serial port are described in +the PORTABILITY ISSUES section. -.SH "SEE ALSO" -close(n), filename(n), gets(n), read(n), puts(n) +.SH "CONFIGURATION OPTIONS" +The \fBfconfigure\fR command can be used to query and set the following +configuration option for open serial ports: +.TP +\fB\-mode \fIbaud\fB,\fIparity\fB,\fIdata\fB,\fIstop\fR +. +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 ``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. +.VE +.VS +.SH "PORTABILITY ISSUES" +.sp +.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. An +attempt to open a serial port that does not exist will fail. +.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 +of the lines entered at the console will be sent to the command pipeline and +some will be sent to the Tcl evaluator. If a command pipeline is opened for +writing, keystrokes entered into the console are not visible until the the +pipe is closed. This behavior occurs whether the command pipeline is +executing 16-bit or 32-bit applications. These problems only occur because +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 or output, but is redirected from or to a file, then the +above problems do not occur. +.TP +\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. +.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 +a 32-bit application, some of the keystrokes entered at the console will be +sent to the command pipeline and some will be sent to the Tcl evaluator. If +a command pipeline is opened for writing to a 32-bit application, no output +is visible on the console until the the pipe is closed. These problems only +occur because 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 or output, but is redirected from or to a file, then +the above problems do not occur. +.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 +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. +.TP +\fBWindows 3.X\fR +. +A command pipeline can execute 16-bit or 32-bit DOS or Windows +applications, but the call to \fBopen\fR will not return until the last +program in the pipeline has finished executing; command pipelines run +synchronously. If the pipeline is opened with write access (either just +writing or both reading and writing) the first application in the +pipeline will instead see an immediate end-of-file; any data the caller +writes to the open pipe will instead be discarded. +.sp +Since Tcl cannot be run with a real console under Windows 3.X, there are +no interactions between command pipelines and the console. +.TP +\fBMacintosh\fR +. +Opening a serial port is not currently implemented under Macintosh. +.sp +Opening a command pipeline is not supported under Macintosh, since +applications do not support the concept of standard input or output. +.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. +.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 +of the lines entered at the console will be sent to the command pipeline and +some will be sent to the Tcl evaluator. This problem only occurs because +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. +.LP +See the PORTABILITY ISSUES section of the \fBexec\fR command for additional +information not specific to command pipelines about executing +applications on the various platforms +.SH "SEE ALSO" +close(n), filename(n), gets(n), read(n), puts(n), exec(n) +.VE .SH KEYWORDS access mode, append, create, file, non-blocking, open, permissions, -pipeline, process +pipeline, process, serial |