zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Cc: Xiao Ling XL Chen <chenxlxl@cn.ibm.com>,
	Kui K Zhang <kzzhang@cn.ibm.com>
Subject: Re: The request of words matter updated
Date: Tue, 27 Sep 2022 09:44:14 +0100 (BST)	[thread overview]
Message-ID: <1142471274.1562947.1664268254401@mail.virginmedia.com> (raw)
In-Reply-To: <CAH+w=7Z+PUJ9Xq64aY3ZXP=nSvRVcu5sG25yOPn2QrcW5RVUBQ@mail.gmail.com>


> On 27/09/2022 05:22 Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
>  
> On Mon, Sep 26, 2022 at 8:18 PM Lawrence Velázquez <larryv@zsh.org> wrote:
> >
> > Illumos uses "manager" and "subsidiary"
> > AIX uses "controller" and "worker"
> 
> Well, that's no fun.  It means there's no "term of art" we can adopt.
> On the other hand, I guess, it means we don't have to worry about
> confusing future programmers, because they'll already be confused.

My only comment is that if we pick something unique and do the job
properly this time, then any further update to fit in with standards
is a 30 second automatic replacement.  So I don't think it's worth
agonising over.

> In this particular context I'd probably choose something like
> superior/inferior ... neither subsidiary nor worker really fits what
> that half of the PTY pair is doing, IMO.  They sound like words chosen
> for a global search-and-replace over a codebase nobody was willing to
> actually read.

So e.g. zsuperior and zinferior would give us that ability (but you may
well be right superior and inferior are good enough --- replacing
master and slave didn't hit any clashes).

pws

diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index dfd2a2a7a..b9e3b4050 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -188,7 +188,7 @@ getptycmd(char *name)
 #endif
 
 static int
-get_pty(int master, int *retfd)
+get_pty(int zsuperior, int *retfd)
 {
     static char *name;
     static int mfd, sfd;
@@ -196,7 +196,7 @@ get_pty(int master, int *retfd)
     int ret;
 #endif
 
-    if (master) {
+    if (zsuperior) {
 #ifdef HAVE_POSIX_OPENPT
 	if ((mfd = posix_openpt(O_RDWR|O_NOCTTY)) < 0)
 #else
@@ -252,7 +252,7 @@ get_pty(int master, int *retfd)
 #else /* No /dev/ptmx or no pt functions */
 
 static int
-get_pty(int master, int *retfd)
+get_pty(int zsuperior, int *retfd)
 {
 
 #ifdef __linux
@@ -275,7 +275,7 @@ get_pty(int master, int *retfd)
     static int mfd, sfd;
     char *p1, *p2;
 
-    if (master) {
+    if (zsuperior) {
 	strcpy(name, "/dev/ptyxx");
 #if defined(__BEOS__) || defined(__HAIKU__)
 	name[7] = '/';
@@ -310,7 +310,7 @@ static int
 newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 {
     Ptycmd p;
-    int master, slave, pid, oineval = ineval, ret;
+    int zsuperior, zinferior, pid, oineval = ineval, ret;
     char *oscriptname = scriptname, syncch;
     Eprog prog;
 
@@ -327,7 +327,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 	return 1;
     }
 
-    if (get_pty(1, &master)) {
+    if (get_pty(1, &zsuperior)) {
 	zwarnnam(nam, "can't open pseudo terminal: %e", errno);
 	scriptname = oscriptname;
 	ineval = oineval;
@@ -335,7 +335,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
     }
     if ((pid = fork()) == -1) {
 	zwarnnam(nam, "can't create pty command %s: %e", pname, errno);
-	close(master);
+	close(zsuperior);
 	scriptname = oscriptname;
 	ineval = oineval;
 	return 1;
@@ -360,9 +360,9 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 	}
 #endif
 
-	if (get_pty(0, &slave))
+	if (get_pty(0, &zinferior))
 	    exit(1);
-	SHTTY = slave;
+	SHTTY = zinferior;
 	attachtty(mypid);
 #ifdef TIOCGWINSZ
 	/* Set the window size before associating with the terminal *
@@ -370,10 +370,10 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 	if (interact) {
 	    struct ttyinfo info;
 
-	    if (ioctl(slave, TIOCGWINSZ, (char *) &info.winsize) == 0) {
+	    if (ioctl(zinferior, TIOCGWINSZ, (char *) &info.winsize) == 0) {
 		info.winsize.ws_row = zterm_lines;
 		info.winsize.ws_col = zterm_columns;
-		ioctl(slave, TIOCSWINSZ, (char *) &info.winsize);
+		ioctl(zinferior, TIOCSWINSZ, (char *) &info.winsize);
 	    }
 	}
 #endif /* TIOCGWINSZ */
@@ -381,7 +381,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 	if (!echo) {
 	    struct ttyinfo info;
 
-	    if (!ptygettyinfo(slave, &info)) {
+	    if (!ptygettyinfo(zinferior, &info)) {
 #ifdef HAVE_TERMIOS_H
 		info.tio.c_lflag &= ~ECHO;
 #else
@@ -391,25 +391,25 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 		info.tio.lmodes &= ~ECHO; /**** dunno if this is right */
 #endif
 #endif
-		ptysettyinfo(slave, &info);
+		ptysettyinfo(zinferior, &info);
 	    }
 	}
 
 #ifdef TIOCSCTTY
-	ioctl(slave, TIOCSCTTY, 0);
+	ioctl(zinferior, TIOCSCTTY, 0);
 #endif
 
 	close(0);
 	close(1);
 	close(2);
 
-	dup2(slave, 0);
-	dup2(slave, 1);
-	dup2(slave, 2);
+	dup2(zinferior, 0);
+	dup2(zinferior, 1);
+	dup2(zinferior, 2);
 
 	closem(FDT_UNUSED, 0);
-	close(slave);
-	close(master);
+	close(zinferior);
+	close(zsuperior);
 	close(coprocin);
 	close(coprocout);
 	init_io(NULL);
@@ -436,22 +436,22 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 	zexit(lastval, ZEXIT_NORMAL);
     }
 #ifndef USE_CYGWIN_FIX
-    master = movefd(master);
-    if (master == -1) {
-	zerrnam(nam, "cannot duplicate fd %d: %e", master, errno);
+    zsuperior = movefd(zsuperior);
+    if (zsuperior == -1) {
+	zerrnam(nam, "cannot duplicate fd %d: %e", zsuperior, errno);
 	scriptname = oscriptname;
 	ineval = oineval;
 	return 1;
     }
 #else
-    addmodulefd(master, FDT_INTERNAL);
+    addmodulefd(zsuperior, FDT_INTERNAL);
 #endif
 
     p = (Ptycmd) zalloc(sizeof(*p));
 
     p->name = ztrdup(pname);
     p->args = zarrdup(args);
-    p->fd = master;
+    p->fd = zsuperior;
     p->pid = pid;
     p->echo = echo;
     p->nblock = nblock;
@@ -464,13 +464,13 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
     ptycmds = p;
 
     if (nblock)
-	ptynonblock(master);
+	ptynonblock(zsuperior);
 
     scriptname = oscriptname;
     ineval = oineval;
 
     do {
-	ret = read(master, &syncch, 1);
+	ret = read(zsuperior, &syncch, 1);
     } while (ret != 1 && (
 #ifdef EWOULDBLOCK
 	    errno == EWOULDBLOCK ||
@@ -481,7 +481,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 #endif
 	    errno == EINTR));
 
-    setiparam_no_convert("REPLY", (zlong)master);
+    setiparam_no_convert("REPLY", (zlong)zsuperior);
 
     return 0;
 }


  reply	other threads:[~2022-09-27  8:55 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  6:52 Xiao Ling XL Chen
2022-09-19 18:20 ` Bart Schaefer
2022-09-27  3:15   ` Lawrence Velázquez
2022-09-27  4:22     ` Bart Schaefer
2022-09-27  8:44       ` Peter Stephenson [this message]
2022-09-27 20:54         ` Daniel Shahaf
2022-09-27 21:15           ` Clinton Bunch
2022-09-27 21:22             ` Clinton Bunch
2022-09-28 12:42               ` zeurkous, zeurkous
2022-09-28 12:33             ` zeurkous, zeurkous
2022-09-27 21:32           ` Mikael Magnusson
2022-09-28  6:17             ` Felipe Contreras
2022-09-28  6:30               ` Ellenor Bjornsdottir
2022-09-28 12:57                 ` zeurkous, zeurkous
2022-09-29  8:23                 ` Lawrence Velázquez
2022-09-28 12:47             ` zeurkous, zeurkous
2022-09-29  8:35             ` Axel Beckert
2022-09-28  6:14           ` Felipe Contreras
2022-09-28 12:16             ` Clinton Bunch
2022-09-28 13:05               ` zeurkous, zeurkous
2022-09-29  8:49                 ` Axel Beckert
2022-09-29  4:08               ` On the "Words Matter" issue (was Re: The request of words matter updated; quotes deleted) Ellenor Bjornsdottir
2022-09-29 10:48                 ` De Zeurkous
2022-09-29 12:11                   ` FU: " zeurkous, zeurkous
2022-09-30  4:29                 ` Bart Schaefer
2022-09-30  5:14                   ` Bart Schaefer
2022-10-08  8:41                   ` Felipe Contreras
2022-10-08 10:12                     ` zeurkous
2022-10-08 10:12                     ` zeurkous
     [not found]                     ` <63414db7.050a0220.8ee33.4cc4SMTPIN_ADDED_BROKEN@mx.google.com>
2022-10-08 10:48                       ` Mikael Magnusson
2022-10-08 11:06                         ` zeurkous
     [not found]                         ` <63415a7a.500a0220.e6d5.1c01SMTPIN_ADDED_BROKEN@mx.google.com>
2022-10-08 11:20                           ` Mikael Magnusson
2022-10-08 11:59                             ` zeurkous
2022-10-08 16:48                     ` Bart Schaefer
2022-10-08 16:54                       ` zeurkous
2022-10-08 17:55                     ` Eric Cook
2022-10-08 18:09                       ` Eric Cook
2022-10-08 18:24                         ` Clinton Bunch
2022-10-08 18:43                           ` zeurkous
2022-10-08 18:25                         ` zeurkous
2022-10-08 18:11                       ` zeurkous
2022-10-08 19:58                       ` Bart Schaefer
2022-10-08 20:17                         ` zeurkous
2022-09-28 12:52             ` Re: The request of words matter updated zeurkous, zeurkous
2022-09-28 12:08           ` zeurkous, zeurkous
2022-09-28 16:34           ` Peter Stephenson
2022-09-28 16:42             ` zeurkous, zeurkous
2022-10-03 14:25             ` Peter Stephenson
2022-10-03 14:43               ` zeurkous
2022-10-03 23:24               ` Eric Cook
2022-10-04  0:45                 ` Wesley
2022-10-04  5:29               ` Daniel Shahaf
2022-10-04  5:48                 ` Daniel Shahaf
2022-10-04 23:31                   ` zeurkous
2022-10-04 11:14                 ` Peter Stephenson
2022-10-08 18:14                 ` Martijn Dekker
2022-10-08 18:34                   ` zeurkous
2022-10-03 15:27             ` Wesley
2022-10-03 15:45               ` zeurkous
2022-10-04  7:05               ` Daniel Shahaf
2022-10-04  7:28                 ` Daniel Shahaf
2022-10-05  0:00                   ` zeurkous
2022-10-04 23:46                 ` zeurkous
2022-10-05  0:28                   ` FU: " zeurkous
2022-10-08  7:54                 ` Felipe Contreras
2022-10-08 10:06                   ` zeurkous
2022-10-08 10:46                   ` Mikael Magnusson
2022-10-08 10:59                     ` zeurkous
2022-09-29  8:31           ` Axel Beckert
2022-09-28 20:01         ` Eric Cook
2022-09-29  8:05           ` Lawrence Velázquez
2022-10-01  4:40     ` Lawrence Velázquez
2022-10-03 15:24       ` Peter Stephenson
2022-10-05  3:02 Wesley

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=1142471274.1562947.1664268254401@mail.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=chenxlxl@cn.ibm.com \
    --cc=kzzhang@cn.ibm.com \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).