send.n
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:4k
- '"
- '" Copyright (c) 1990-1994 The Regents of the University of California.
- '" Copyright (c) 1994-1996 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: send.n,v 1.3.20.1 2004/10/28 12:25:22 dkf Exp $
- '"
- .so man.macros
- .TH send n 4.0 Tk "Tk Built-In Commands"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- send - Execute a command in a different application
- .SH SYNOPSIS
- fBsend ?fIoptionsfR? fIapp cmd fR?fIarg arg ...fR?
- .BE
- .SH DESCRIPTION
- .PP
- This command arranges for fIcmdfR (and fIargfRs) to be executed in the
- application named by fIappfR. It returns the result or
- error from that command execution.
- fIAppfR may be the name of any application whose main window is
- on the display containing the sender's main window; it need not
- be within the same process.
- If no fIargfR arguments are present, then the command to be executed is
- contained entirely within the fIcmdfR argument. If one or
- more fIargfRs are present, they are concatenated to form the
- command to be executed, just as for the fBevalfR command.
- .PP
- If the initial arguments of the command begin with ``-''
- they are treated as options. The following options are
- currently defined:
- .TP
- fB-asyncfR
- Requests asynchronous invocation. In this case the fBsendfR
- command will complete immediately without waiting for fIcmdfR
- to complete in the target application; no result will be available
- and errors in the sent command will be ignored.
- If the target application is in the same process as the sending
- application then the fB-asyncfR option is ignored.
- .TP
- fB-displayoffR fIpathNamefR
- Specifies that the target application's main window is on the display
- of the window given by fIpathNamefR, instead of the display containing
- the application's main window.
- .TP
- fB-|-fR
- Serves no purpose except to terminate the list of options. This
- option is needed only if fIappfR could contain a leading ``-''
- character.
- .SH "APPLICATION NAMES"
- .PP
- The name of an application is set initially from the name of the
- program or script that created the application.
- You can query and change the name of an application with the
- fBtk appnamefR command.
- .SH "DISABLING SENDS"
- .PP
- If the fBsendfR command is removed from an application (e.g.
- with the command fBrename send {}fR) then the application
- will not respond to incoming send requests anymore, nor will it
- be able to issue outgoing requests.
- Communication can be reenabled by invoking the fBtk appnamefR
- command.
- .SH SECURITY
- .PP
- The fBsendfR command is potentially a serious security loophole. On Unix,
- any application that can connect to your X server can send
- scripts to your applications.
- These incoming scripts can use Tcl to read and
- write your files and invoke subprocesses under your name.
- Host-based access control such as that provided by fBxhostfR
- is particularly insecure, since it allows anyone with an account
- on particular hosts to connect to your server, and if disabled it
- allows anyone anywhere to connect to your server.
- In order to provide at least a small amount of
- security, Tk checks the access control being used by the server
- and rejects incoming sends unless (a) fBxhostfR-style access control
- is enabled (i.e. only certain hosts can establish connections) and (b) the
- list of enabled hosts is empty.
- This means that applications cannot connect to your server unless
- they use some other form of authorization
- such as that provide by fBxauthfR.
- .VS
- Under Windows, fBsendfR is currently disabled. Most of the
- functionality is provided by the fBddefR command instead.
- .VE
- .SH EXAMPLE
- This script fragment can be used to make an application that only runs
- once on a particular display.
- .CS
- if {[tk appname FoobarApp] ne "FoobarApp"} {
- fBsendfR -async FoobarApp RemoteStart $argv
- exit
- }
- # The command that will be called remotely, which raises
- # the application main window and opens the requested files
- proc RemoteStart args {
- raise .
- foreach filename $args {
- OpenFile $filename
- }
- }
- .CE
- .SH KEYWORDS
- .VS
- application, dde, name, remote execution, security, send
- .VE