/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#include "uucp.h"
#define NOSYSPART 0
#define GENSEND(f, a, b, c) {\
ASSERT(fprintf(f, "S %s %s %s -%s %s 0666 %s %s\n", a, b, User, _Statop?"o":"", c, User, _Sfile) >= 0, Ct_WRITE, "", errno);\
}
#define GENRCV(f, a, b) {\
}
}
}
static int _Statop;
void cleanup();
static void usage();
static void onintr();
/*
* uux
*/
int
int argc;
char *argv[];
char *envp[];
{
char *jid();
int pipein = 0;
int ret, i;
char *getprm();
char *ap;
/* Set locale environment variables local definitions */
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#endif
(void) textdomain(TEXT_DOMAIN);
/* we want this to run as uucp, even if the kernel doesn't */
if (Uid == 0)
/* init environment for fork-exec */
/* choose LOGFILE */
/*
* determine local system name
*/
Pchar = 'X';
Ofn = 1;
Ifn = 0;
*_Sfile = '\0';
/*
* determine id of user starting remote
* execution
*/
/*
* this is a check to see if we are using the administrator
* defined service grade. The GRADES file will determine if
* we are. If so then setup the default grade variables.
*/
Grade = 'A';
}
/*
*/
/*
* since getopt() can't handle the pipe input option '-';
* change it to "-p"
*/
argv[i] = "-p";
switch(i){
/*
* use this name in the U line
*/
case 'a':
break;
/*
* if return code non-zero, return command's input
*/
case 'b':
bringback = 1;
break;
/* do not make local copies of files to be sent (default) */
case 'c':
cflag = 0;
break;
/* make local copies of files to be sent */
case 'C':
cflag = 1;
break;
/*
* set priority of request
*/
case 'g':
if (!Sgrades) {
else {
" administrator defined service"
" grades available on this"
" machine.\n"));
" service grades range from"
" [A-Z][a-z] only.\n"));
cleanup(-1);
}
}
else {
}
break;
case 'j': /* job id */
jflag = 1;
break;
/*
* do not send failure notification to user
*/
case 'n':
nflag++;
break;
/*
* send success notification to user
*/
case 'z':
zflag++;
break;
/*
* -p or - option specifies input from pipe
*/
case 'p':
pipein = 1;
break;
/*
* do not start transfer
*/
case 'r':
startjob = 0;
break;
case 's':
_Statop++;
break;
/*
* debugging level
*/
case 'x':
if (Debug <= 0)
Debug = 1;
break;
default:
usage();
}
}
usage();
/*
* copy arguments into a buffer for later
* processing
*/
inargs[0] = '\0';
}
/*
* get working directory and change
* to spool directory
*/
if(fopt){
if(*fopt != '/') {
}
else {
"%s", fopt);
}
}
else
}
/*
* find remote system name
* remote name is first to know that
* is not > or <
*/
xsys[0] = '\0';
continue;
}
/*
* split name into system name
* and command name
*/
break;
}
if (xsys[0] == '\0')
/* get real Myname - it depends on who I'm calling--Rmtname */
/*
* check to see if system name is valid
*/
/*
* bad system name
*/
}
/*
* initialize command buffer
*/
*cmd = '\0';
/*
* generate JCL files to work from
*/
/*
* fpc is the C. file for the local site.
* collect commands into cfile.
* commit if not empty (at end).
*
* the appropriate C. file.
*/
/* set Jobid -- C.jobid */
/*
* rxfile is the X. file for the job, fprx is its stream ptr.
* if the command is to be executed locally, rxfile becomes
* a local X. file, otherwise we send it as a D. file to the
* remote site.
*/
if (zflag) {
}
if (nflag) {
} else {
}
if (bringback) {
}
if (_Statop)
}
/*
* create a JCL file to spool pipe input into
*/
if (pipein) {
/*
* fpd is the D. file into which we now read
* input from stdin
*/
/*
* read pipe to EOF
*/
}
/*
* if command is to be executed on remote
* create extra JCL
*/
}
/*
* create file for X_ commands
*/
}
/*
* parse command
*/
/*
* redirection of I/O
*/
if ( prm[0] == '<' ) {
gettext("'<<' may not be used in command\n"));
}
continue;
}
if ( prm[0] == '>' ) {
gettext("'>>' may not be used in command\n"));
}
gettext("'>|' may not be used in command\n"));
}
gettext("'>&' may not be used in command\n"));
}
continue;
}
continue;
}
/*
* some terminator
*/
continue;
}
/*
* process command or file or option
* break out system and file name and
* use default if necessary
*/
/*
* command
*/
continue;
}
if (syspart[0] == '\0') {
/*
* bad system name
*/
}
/*
* process file or option
*/
/*
* process file argument
* expand filename and create JCL card for
* redirected output
* e.g., X file sys
*/
if (rest[0] != '~')
redir = '\0';
continue;
}
/*
* if no system specified, then being
* processed locally
*/
/*
* option
*/
continue;
}
/* local xeqn + local file (!x !f) */
/*
* create JCL card
*/
/*
* JCL card for local input
* e.g., I file
*/
} else
redir = '\0';
continue;
}
/* remote xeqn + local file (sys!x !f) */
/*
* check access to local file
* if cflag is set, copy to spool directory
* otherwise, just mention it in the X. file
*/
/* see if I can read this file as read uid, gid */
}
/* XXX - doesn't check group list */
) {
}
/* D. file for sending local file */
/* make local copy */
}
/* generate 'send' entry in command file */
} else /* don't make local copy */
/*
* JCL cards for redirected input in X. file,
* e.g.
* I D.xxx
* F D.xxx
*/
/*
* don't bother making a X_RQDFILE line that
* renames stdin on the remote side, since the
* remote command can't know its name anyway
*/
} else {
/*
* generate X. JCL card that specifies
* F file
*/
}
redir = '\0';
continue;
}
/* local xeqn + remote file (!x sys!f ) */
/*
* expand receive file name
*/
/*
* strategy:
* request rest from syspart. when it arrives,
* we can run the command.
*
* tfile is command file for receive from remote.
* we defer commiting until later so
* that only one C. file is created per site.
*
* dfile is name of data file to receive into;
* we don't use it, just name it.
*
* once the data file arrives from syspart.
* arrange so that in the X. file (fprx), rest is
* required and named appropriately. this
* is handled by a hook in uuxqt that allows files
*
* pictorially:
*
* R rest D.syspart... (dfile)
*
*
*
*
*/
}
/* prepare JCL card to receive file */
if (rest[0] != '~')
/*
* generate receive entries
*/
} else {
}
redir = '\0';
continue;
}
/*
* strategy:
* request rest from syspart.
*
* set up a local X. file that will send rest to xsys,
* once it arrives from syspart.
*
* arrange so that in the xsys D. file (fated to become
* an X. file on xsys), rest is required and named.
*
* pictorially:
*
* R rest D.syspart... (dfile)
*
*
* C uucp -C rest D.syspart... (dfile)
*
* F D.syspart... rest (dfile)
* or, in the case of redir == '<'
* F D.syspart... (dfile)
* I D.syspart... (dfile)
*
* while we do push rest around a bunch,
* we use the protection scheme to good effect.
*
* we must rely on uucp's treatment of requests
* from XQTDIR to get the data file to the right
* place ultimately.
*/
/* build (or append to) C.syspart... */
}
/* name might collide with rxfile; no real danger */
/* put t2file where uuxqt can get at it */
} else {
}
redir = '\0';
continue;
}
/* remote xeqn + remote file, same remote (sys!x sys!f) */
}
else
redir = '\0';
continue;
}
/*
* place command to be executed in JCL file
*/
/* local xeqn -- use X_ file here */
/* this use of the X_ file can not collide with the earlier one */
/*
* see if -r option requested JCL to be queued only
*/
if (startjob)
} else {
/* remote xeqn -- send rxfile to remote */
/* put it in a place where cico can get at it */
/* X_ file name might collide with an earlier use, */
/* but that one lives locally, while this one gets shipped */
}
/* commit C. files for remote receive */
commitall();
/*
* has any command been placed in command JCL file
*/
if (cfileUsed) {
commitall();
/*
* see if -r option requested JCL to be queued only
*/
if (startjob)
} else
if (jflag) { /* print Jobid */
}
cleanup(0);
/* NOTREACHED */
return (0);
}
/*
* cleanup and unlink if error
* code -> exit code
* return:
* none
*/
void
int code;
{
/* prevent recursion on errors */
if (first) {
first = 0;
if (code) {
wfabort();
}
}
if (code < 0)
else
}
/*
* catch signal then cleanup and exit
*/
static void
int inter;
{
}
static void
usage()
{
" [-g GRADE] [-s FILE] [-x NUM] command-string\n"), Progname);
}