home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The AGA Experience 2
/
agavol2.iso
/
software
/
utilities
/
comms
/
ncp
/
developer
/
source
/
s3run
/
s3run.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-23
|
860b
|
62 lines
/*
** Run a program on the S3
*/
#include <proto/dos.h>
#include <libraries/ncplib.h>
int main( int argc, char **argv )
{
int rc;
char buff[ 128 ], buff2[ 4 ];
int c = 0;
char *p;
if( argc < 2 )
{
PutStr( "Usage: S3Run remotefilename [cmdline]\n" );
return( 5 );
}
if( argc > 2 )
{
// Acceppt \xx escapes
p = argv[ 2 ];
for( c = 0; *p; )
{
if( *p == '\\' )
{
p++;
if(*p=='\\' )
buff[ c++ ] = *p++;
else
{
buff2[ 0 ] = *p++;
buff2[ 1 ] = *p++;
buff2[ 2 ] = 0;
stch_l( buff, &rc );
buff[ c++ ] = rc;
}
}
else
{
buff[ c++ ] = *p++;
}
}
}
rc = NCP_LinkRemoteRun( argv[ 1 ], buff, c );
if( !rc )
{
PutStr( "S3Run: Ok\n" );
return( 0 );
}
else
{
NCP_Fault( rc, "S3Run", buff, 128 );
Printf( "NCP returned %ld (%s)\n", rc, buff );
return( 5 );
}
}