* sam -r <machine> *
@ 1993-07-07 16:01 mhw
0 siblings, 0 replies; only message in thread
From: mhw @ 1993-07-07 16:01 UTC (permalink / raw)
To: sam-fans
I've always found it strange that ``sam -r machine'' was mutually
exclusive with ``sam [option ...] [files].'' A quick look at the
source revealed that it could easily be changed to allow the -r
option to pass the list of files to sam on the remote machine.
Here's the patch:
diff -C 2 -r old.sam/sam/io.c new.sam/sam/io.c
*** old.sam/sam/io.c Wed Jul 7 13:34:43 1993
--- new.sam/sam/io.c Wed Jul 7 15:44:21 1993
***************
*** 215,221 ****
void
! connectto(char *machine)
{
int p1[2], p2[2];
if(pipe(p1)<0 || pipe(p2)<0){
--- 215,222 ----
void
! connectto(char *machine, int fargc, char **fargv)
{
int p1[2], p2[2];
+ char **nargv, **fp, **tp;
if(pipe(p1)<0 || pipe(p2)<0){
***************
*** 227,230 ****
--- 228,239 ----
switch(fork()){
case 0:
+ tp = nargv = emalloc((4+fargc)*sizeof(char *));
+ *tp++ = RX;
+ *tp++ = machine;
+ *tp++ = rsamname;
+ *tp++ = "-R";
+ fp = fargv;
+ while (*tp++ = *fp++)
+ ;
dup(p2[0], 0);
dup(p1[1], 1);
***************
*** 233,237 ****
close(p2[0]);
close(p2[1]);
! execl(RXPATH, RX, machine, rsamname, "-R", (char*)0);
dprint("can't exec %s\n", RXPATH);
exits("exec");
--- 242,246 ----
close(p2[0]);
close(p2[1]);
! exec(RXPATH, nargv);
dprint("can't exec %s\n", RXPATH);
exits("exec");
***************
*** 246,253 ****
void
! startup(char *machine, int Rflag, char **argv, char **end)
{
if(machine)
! connectto(machine);
if(!Rflag)
bootterm(machine, argv, end);
--- 255,262 ----
void
! startup(char *machine, int Rflag, char **argv, char **end, int fargc, char **fargv)
{
if(machine)
! connectto(machine, fargc, fargv);
if(!Rflag)
bootterm(machine, argv, end);
diff -C 2 -r old.sam/sam/sam.c new.sam/sam/sam.c
*** old.sam/sam/sam.c Wed Jul 7 13:35:03 1993
--- new.sam/sam/sam.c Wed Jul 7 15:28:01 1993
***************
*** 95,99 ****
home = "/";
if(!dflag)
! startup(machine, Rflag, arg, ap);
Fstart();
notify(notifyf);
--- 95,99 ----
home = "/";
if(!dflag)
! startup(machine, Rflag, arg, ap, argc, argv);
Fstart();
notify(notifyf);
diff -C 2 -r old.sam/sam/sam.h new.sam/sam/sam.h
*** old.sam/sam/sam.h Wed Jul 7 13:35:05 1993
--- new.sam/sam/sam.h Wed Jul 7 15:30:18 1993
***************
*** 286,290 ****
void snarf(File*, Posn, Posn, Buffer*, int);
void sortname(File*);
! void startup(char*, int, char**, char**);
void state(File*, int);
int statfd(int, ulong*, ulong*, long*, long*);
--- 286,290 ----
void snarf(File*, Posn, Posn, Buffer*, int);
void sortname(File*);
! void startup(char*, int, char**, char**, int, char**);
void state(File*, int);
int statfd(int, ulong*, ulong*, long*, long*);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1993-07-07 15:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-07-07 16:01 sam -r <machine> * mhw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).