9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Bengt Kleberg <bengt.kleberg@ericsson.com>
To: 9fans@cse.psu.edu
Subject: [9fans] plan9ports, mk, using rc as shell
Date: Tue, 27 Apr 2004 15:57:35 +0000	[thread overview]
Message-ID: <c6lvj2$81u$1@newstree.wise.edt.ericsson.se> (raw)

[-- Attachment #1: Type: text/plain, Size: 231 bytes --]

from postmaster@ethel:
The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Type: multipart/mixed;

[-- Attachment #2: file.suspect --]
[-- Type: application/octet-stream, Size: 2947 bytes --]

This is a multi-part message in MIME format.
--------------070508010706030608020407
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

greetings,

this is in case anybody is still thinking about the ''sh/rc in mk'' 
discussion some days ago.


i added an environment variable MKSHELL_RC. if set to the full path of 
rc, mk will use rc to run recipes.

note that assignments in the mkfile has not been changed. ie,

VAR = `{echo *.c}

still works. (yes, that does look like rc syntax, does it not? but it 
has ''always'' worked)

and

VAR = asd ^ 123

does not work.


bengt

--------------070508010706030608020407
Content-Type: text/plain;
 name="bfile"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="bfile"

*** unix.c	Sat Apr 24 07:03:27 2004
--- /home/eleberg/private/plan9/src/cmd/mk/unix.c	Tue Apr 27 17:40:13 2004
***************
*** 16,21 ****
--- 16,64 ----
  	fprint(2, "%s: %r\n", s);
  }
  
+ static void
+ choose_shell( char* args, int args_are_command ) {
+ 	char*	mkshell;
+ 	char*	mkshell_rc;
+ 	char*	mkshell_name;
+ 
+ 	/* if rc path is set, use it */
+ 	mkshell_rc = getenv( "MKSHELL_RC" ) ;
+ 	if (mkshell_rc) {
+ 		mkshell = mkshell_rc;
+ 		mkshell_name = "rc";
+ 	} else {
+ 		mkshell = shell;
+ 		mkshell_name = shellname;
+ 	}
+ 	if (args_are_command) {
+ 		if(shflags)
+ 			execl(mkshell, mkshell_name, shflags, "-c", args, 0);
+ 		else
+ 			execl(mkshell, mkshell_name, "-c", args, 0);
+ 	} else {
+ 		if(shflags)
+ 			execl(mkshell, mkshell_name, shflags, args, 0);
+ 		else
+ 			execl(mkshell, mkshell_name, args, 0);
+ 	}
+ 	mkperror(mkshell);
+ /* when using plan9 getenv() we need free()
+ 	if (mkshell_rc)
+ 		free(mkshell_rc);
+ */
+ }
+ 
+ static void
+ choose_execshell( char* args ) {
+ 	choose_shell( args, 0 );
+ }
+ 
+ static void
+ choose_pipeshell( char* cmd ) {
+ 	choose_shell( cmd, 1 );
+ }
+ 
  void
  readenv(void)
  {
***************
*** 131,141 ****
  			close(in[1]);
  			if (e)
  				exportenv(e);
! 			if(shflags)
! 				execl(shell, shellname, shflags, args, 0);
! 			else
! 				execl(shell, shellname, args, 0);
! 			mkperror(shell);
  			_exit(1);
  		}
  		close(out[1]);
--- 174,180 ----
  			close(in[1]);
  			if (e)
  				exportenv(e);
! 			choose_execshell( args );
  			_exit(1);
  		}
  		close(out[1]);
***************
*** 196,206 ****
  		}
  		if(e)
  			exportenv(e);
! 		if(shflags)
! 			execl(shell, shellname, shflags, "-c", cmd, 0);
! 		else
! 			execl(shell, shellname, "-c", cmd, 0);
! 		mkperror(shell);
  		_exit(1);
  	}
  	if(fd){
--- 235,241 ----
  		}
  		if(e)
  			exportenv(e);
! 		choose_pipeshell( cmd );
  		_exit(1);
  	}
  	if(fd){
***************
*** 308,310 ****
--- 343,346 ----
  
  	return st.st_mtime;
  }
+ 

--------------070508010706030608020407--

                 reply	other threads:[~2004-04-27 15:57 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='c6lvj2$81u$1@newstree.wise.edt.ericsson.se' \
    --to=bengt.kleberg@ericsson.com \
    --cc=9fans@cse.psu.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).