about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:10:10 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:10:10 +0000
commit2a5a899a55fd2bce10efd01c75a4bec5285aa46c (patch)
tree4744bc2f1a6b86fc1b12870be94edf96fdab4879 /Src/Modules
parent9003d99d16c46b5679da7fcf1f2a41adef495ff9 (diff)
downloadzsh-2a5a899a55fd2bce10efd01c75a4bec5285aa46c.tar.gz
zsh-2a5a899a55fd2bce10efd01c75a4bec5285aa46c.tar.xz
zsh-2a5a899a55fd2bce10efd01c75a4bec5285aa46c.zip
zsh-3.1.5-pws-4 zsh-3.1.5-pws-4
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/cap.c15
-rw-r--r--Src/Modules/clone.c15
-rw-r--r--Src/Modules/example.c47
-rw-r--r--Src/Modules/files.c15
-rw-r--r--Src/Modules/stat.c14
-rw-r--r--Src/Modules/zftp.c48
6 files changed, 130 insertions, 24 deletions
diff --git a/Src/Modules/cap.c b/Src/Modules/cap.c
index 008b6932d..dfeca86ad 100644
--- a/Src/Modules/cap.c
+++ b/Src/Modules/cap.c
@@ -124,6 +124,13 @@ static struct builtin bintab[] = {
 
 /**/
 int
+setup_cap(Module m)
+{
+    return 0;
+}
+
+/**/
+int
 boot_cap(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
@@ -138,4 +145,12 @@ cleanup_cap(Module m)
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
 }
+
+/**/
+int
+finish_cap(Module m)
+{
+    return 0;
+}
+
 #endif
diff --git a/Src/Modules/clone.c b/Src/Modules/clone.c
index 11387fc90..e2cfea8d9 100644
--- a/Src/Modules/clone.c
+++ b/Src/Modules/clone.c
@@ -98,6 +98,13 @@ static struct builtin bintab[] = {
 
 /**/
 int
+setup_clone(Module m)
+{
+    return 0;
+}
+
+/**/
+int
 boot_clone(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
@@ -112,4 +119,12 @@ cleanup_clone(Module m)
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
 }
+
+/**/
+int
+finish_clone(Module m)
+{
+    return 0;
+}
+
 #endif
diff --git a/Src/Modules/example.c b/Src/Modules/example.c
index a71806c3a..95545172f 100644
--- a/Src/Modules/example.c
+++ b/Src/Modules/example.c
@@ -51,16 +51,14 @@ bin_example(char *nam, char **args, char *ops, int func)
 
 /**/
 static int
-cond_p_len(Conddef c, char **a)
+cond_p_len(char **a, int id)
 {
-    char *s1 = a[0], *s2 = a[1];
-
-    singsub(&s1);
-    untokenize(s1);
-    if (s2) {
-	singsub(&s2);
-	untokenize(s2);
-	return strlen(s1) == matheval(s2);
+    char *s1 = cond_str(a, 0);
+
+    if (a[1]) {
+	long v = cond_val(a, 1);
+
+	return strlen(s1) == v;
     } else {
 	return !s1[0];
     }
@@ -68,14 +66,10 @@ cond_p_len(Conddef c, char **a)
 
 /**/
 static int
-cond_i_ex(Conddef c, char **a)
+cond_i_ex(char **a, int id)
 {
-    char *s1 = a[0], *s2 = a[1];
+    char *s1 = cond_str(a, 0), *s2 = cond_str(a, 1);
 
-    singsub(&s1);
-    untokenize(s1);
-    singsub(&s2);
-    untokenize(s2);
     return !strcmp("example", dyncat(s1, s2));
 }
 
@@ -105,8 +99,8 @@ static struct builtin bintab[] = {
 };
 
 static struct conddef cotab[] = {
-    CONDDEF("len", 0, 1, 2, cond_p_len),
-    CONDDEF("ex", CONDF_INFIX, 0, 0, cond_i_ex),
+    CONDDEF("len", 0, cond_p_len, 1, 2, 0),
+    CONDDEF("ex", CONDF_INFIX, cond_i_ex, 0, 0, 0),
 };
 
 static struct funcwrap wrapper[] = {
@@ -115,6 +109,15 @@ static struct funcwrap wrapper[] = {
 
 /**/
 int
+setup_example(Module m)
+{
+    printf("The example module has now been set up.\n");
+    fflush(stdout);
+    return 0;
+}
+
+/**/
+int
 boot_example(Module m)
 {
     return !(addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)) |
@@ -133,4 +136,14 @@ cleanup_example(Module m)
     deletewrapper(m, wrapper);
     return 0;
 }
+
+/**/
+int
+finish_example(Module m)
+{
+    printf("Thank you for using the example module.  Have a nice day.\n");
+    fflush(stdout);
+    return 0;
+}
+
 #endif
diff --git a/Src/Modules/files.c b/Src/Modules/files.c
index 6127c5524..f52c54338 100644
--- a/Src/Modules/files.c
+++ b/Src/Modules/files.c
@@ -511,6 +511,13 @@ static struct builtin bintab[] = {
 
 /**/
 int
+setup_files(Module m)
+{
+    return 0;
+}
+
+/**/
+int
 boot_files(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
@@ -525,4 +532,12 @@ cleanup_files(Module m)
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
 }
+
+/**/
+int
+finish_files(Module m)
+{
+    return 0;
+}
+
 #endif
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index 769b42b1a..5c56be5c6 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -571,6 +571,13 @@ static struct builtin bintab[] = {
 
 /**/
 int
+setup_stat(Module m)
+{
+    return 0;
+}
+
+/**/
+int
 boot_stat(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
@@ -586,4 +593,11 @@ cleanup_stat(Module m)
     return 0;
 }
 
+/**/
+int
+finish_stat(Module m)
+{
+    return 0;
+}
+
 #endif
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index ca0843419..4bcd80c7f 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -62,9 +62,9 @@
 /* it's a TELNET based protocol, but don't think I like doing this */
 #include <arpa/telnet.h>
 
-/* bet there are machines which have neither INADDR_NONE nor in_addr_t. */
+/* pinch the definition from <netinet/in.h> for deficient headers */
 #ifndef INADDR_NONE
-#define INADDR_NONE (in_addr_t)-1
+#define INADDR_NONE 0xffffffff
 #endif
 
 /*
@@ -1354,7 +1354,11 @@ zfsenddata(char *name, int recv, int progress, long startat)
 	 * We do this here in case we needed to wait for a RETR
 	 * command to tell us how many bytes are coming.
 	 */
+	int osc = sfcontext;
+
+	sfcontext = SFC_HOOK;
 	doshfunc("zftp_progress", l, NULL, 0, 1);
+	sfcontext = osc;
 	/* Now add in the bit of the file we've got/sent already */
 	sofar = last_sofar = startat;
     }
@@ -1482,8 +1486,12 @@ zfsenddata(char *name, int recv, int progress, long startat)
 	    break;
 	if (!ret && sofar != last_sofar && progress &&
 	    (l = getshfunc("zftp_progress")) != &dummy_list) {
+	    int osc = sfcontext;
+
 	    zfsetparam("ZFTP_COUNT", &sofar, ZFPM_READONLY|ZFPM_INTEGER);
+	    sfcontext = SFC_HOOK;
 	    doshfunc("zftp_progress", l, NULL, 0, 1);
+	    sfcontext = osc;
 	    last_sofar = sofar;
 	}
     }
@@ -1650,7 +1658,7 @@ zftp_open(char *name, char **args, int flags)
 	zfsetparam("ZFTP_HOST", ztrdup(zhostp->h_name), ZFPM_READONLY);
     }
 
-    zsock.sin_port = ntohs(zservp->s_port);
+    zsock.sin_port = zservp->s_port;
     zcfd = zfmovefd(socket(zsock.sin_family, SOCK_STREAM, 0));
     if (zcfd < 0) {
 	zwarnnam(name, "socket failed: %e", NULL, errno);
@@ -2102,9 +2110,13 @@ zfgetcwd(void)
      * front end.  By putting it here, and in close when ZFTP_PWD is unset,
      * we at least cover the bases.
      */
-    if ((l = getshfunc("zftp_chpwd")) != &dummy_list)
-	doshfunc("zftp_chpwd", l, NULL, 0, 1);
+    if ((l = getshfunc("zftp_chpwd")) != &dummy_list) {
+	int osc = sfcontext;
 
+	sfcontext = SFC_HOOK;
+	doshfunc("zftp_chpwd", l, NULL, 0, 1);
+	sfcontext = osc;
+    }
     return 0;
 }
 
@@ -2303,9 +2315,13 @@ zftp_getput(char *name, char **args, int flags)
 	zsfree(ln);
 	if (progress && (l = getshfunc("zftp_progress")) != &dummy_list) {
 	    /* progress to finish: ZFTP_TRANSFER set to GF or PF */
+	    int osc = sfcontext;
+
 	    zfsetparam("ZFTP_TRANSFER", ztrdup(recv ? "GF" : "PF"),
 		       ZFPM_READONLY);
+	    sfcontext = SFC_HOOK;
 	    doshfunc("zftp_progress", l, NULL, 0, 1);
+	    sfcontext = osc;
 	}
 	if (rest) {
 	    zsfree(rest);
@@ -2428,9 +2444,13 @@ zftp_close(char *name, char **args, int flags)
 	zfunsetparam(*aptr);
 
     /* Now ZFTP_PWD is unset.  It's up to zftp_chpwd to notice. */
-    if ((l = getshfunc("zftp_chpwd")) != &dummy_list)
-	doshfunc("zftp_chpwd", l, NULL, 0, 1);
+    if ((l = getshfunc("zftp_chpwd")) != &dummy_list) {
+	int osc = sfcontext;
 
+	sfcontext = SFC_HOOK;
+	doshfunc("zftp_chpwd", l, NULL, 0, 1);
+	sfcontext = osc;
+    }
     /* tidy up status variables, because mess is bad */
     zfclosing = zfdrrrring = 0;
 
@@ -2558,6 +2578,13 @@ bin_zftp(char *name, char **args, char *ops, int func)
 
 /**/
 int
+setup_zftp(Module m)
+{
+    return 0;
+}
+
+/**/
+int
 boot_zftp(Module m)
 {
     int ret;
@@ -2593,4 +2620,11 @@ cleanup_zftp(Module m)
     return 0;
 }
 
+/**/
+int
+finish_zftp(Module m)
+{
+    return 0;
+}
+
 #endif