sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
From: mhw@minster.york.ac.uk
To: sam-fans@hawkwind.utcs.toronto.edu
Subject: sam -r <machine> *
Date: Wed, 7 Jul 1993 12:01:15 -0400	[thread overview]
Message-ID: <swordfish.742057355@minster.york.ac.uk> (raw)

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*);




                 reply	other threads:[~1993-07-07 15:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=swordfish.742057355@minster.york.ac.uk \
    --to=mhw@minster.york.ac.uk \
    --cc=sam-fans@hawkwind.utcs.toronto.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).