aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/mk/sh.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-04 22:41:27 +0000
committerrsc <devnull@localhost>2005-01-04 22:41:27 +0000
commit9aa1c92f743a7bf2ac0b062b0c075dc610b3e335 (patch)
treee3be39332a1893959b3257aa797a65740fc1c1ec /src/cmd/mk/sh.c
parent02f38ca68ce484b2aad15fad4d59c4d43ef7eb1b (diff)
downloadplan9port-9aa1c92f743a7bf2ac0b062b0c075dc610b3e335.tar.gz
plan9port-9aa1c92f743a7bf2ac0b062b0c075dc610b3e335.tar.bz2
plan9port-9aa1c92f743a7bf2ac0b062b0c075dc610b3e335.zip
add new | syntax.
syntax will change.
Diffstat (limited to 'src/cmd/mk/sh.c')
-rw-r--r--src/cmd/mk/sh.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/cmd/mk/sh.c b/src/cmd/mk/sh.c
index 524167a5..ba80162b 100644
--- a/src/cmd/mk/sh.c
+++ b/src/cmd/mk/sh.c
@@ -1,9 +1,5 @@
#include "mk.h"
-char *termchars = "\"'= \t"; /*used in parse.c to isolate assignment attribute*/
-char *shflags = 0;
-int IWS = ' '; /* inter-word separator in env */
-
/*
* This file contains functions that depend on the shell's syntax. Most
* of the routines extract strings observing the shell's escape conventions.
@@ -34,8 +30,8 @@ squote(char *cp, int c)
/*
* search a string for unescaped characters in a pattern set
*/
-char *
-charin(char *cp, char *pat)
+static char *
+shcharin(char *cp, char *pat)
{
Rune r;
int n, vargen;
@@ -82,8 +78,8 @@ charin(char *cp, char *pat)
* extract an escaped token. Possible escape chars are single-quote,
* double-quote,and backslash.
*/
-char*
-expandquote(char *s, Rune esc, Bufblock *b)
+static char*
+shexpandquote(char *s, Rune esc, Bufblock *b)
{
Rune r;
@@ -110,8 +106,8 @@ expandquote(char *s, Rune esc, Bufblock *b)
* Input an escaped token. Possible escape chars are single-quote,
* double-quote and backslash.
*/
-int
-escapetoken(Biobuf *bp, Bufblock *buf, int preserve, int esc)
+static int
+shescapetoken(Biobuf *bp, Bufblock *buf, int preserve, int esc)
{
int c, line;
@@ -168,8 +164,8 @@ copysingle(char *s, Rune q, Bufblock *buf)
* check for quoted strings. backquotes are handled here; single quotes above.
* s points to char after opening quote, q.
*/
-char *
-copyq(char *s, Rune q, Bufblock *buf)
+static char *
+shcopyq(char *s, Rune q, Bufblock *buf)
{
if(q == '\'' || q == '"') /* copy quoted string */
return copysingle(s, q, buf);
@@ -187,3 +183,24 @@ copyq(char *s, Rune q, Bufblock *buf)
}
return s;
}
+
+static int
+shmatchname(char *name)
+{
+ USED(name);
+
+ return 1;
+}
+
+
+Shell shshell = {
+ "sh",
+ "\"'= \t", /*used in parse.c to isolate assignment attribute*/
+ ' ', /* inter-word separator in env */
+ shcharin,
+ shexpandquote,
+ shescapetoken,
+ shcopyq,
+ shmatchname,
+};
+