Lines Matching defs:master
45 "[c \atext\a?write \atext\a to the master; C style escapes "
48 "[d \amilliseconds\a?set the delay before each master write to "
50 "[i \are\a?read a line from the master; if it matches \are\a "
58 "[r [\are\a]]?read a line from the master [and it should match "
61 "[t \amilliseconds\a?set the master read timout to "
63 "[u \are\a?read lines from the master until one matches \are\a]"
66 "[w \atext\a?write \atext\a\\r\\n to the master; C style escapes "
71 "[I \are\a?ignore master lines matching \are\a]"
73 "[P \atext\a?delay each master write until the beginning of "
78 "[l:log?Log the master stdout and stderr to \afile\a.]:[file]"
82 "[t:timeout?Set the master read timeout to "
86 "[w:delay?Set the delay before each master write to "
172 static char *ptymopen(int *master)
176 return(_getpty(master,O_RDWR,MODE_666,0));
179 *master = open(_pty_clone,O_RDWR|O_CREAT,MODE_666);
180 if(*master>=0)
181 slave = ptsname(*master);
190 *master = fdm;
207 mkpty(int* master, int* slave)
242 if (openpty(master, slave, NULL, ttyp, winp) < 0)
252 if ((*master = posix_openpt(O_RDWR)) < 0)
254 if (grantpt(*master) || unlockpt(*master) || !(sname = ptsname(*master)) || (*slave = open(sname, O_RDWR|O_cloexec)) < 0)
256 close(*master);
260 if (!(sname = ptymopen(master)) || (*slave = open(sname, O_RDWR|O_cloexec)) < 0)
267 close(*master);
278 fcntl(*master, F_SETFD, FD_CLOEXEC);
307 * default master dance
434 char* ignore; /* ignore master lines matching this re */
448 * read one line from the master
722 Master_t* master;
728 !(master = vmnewof(vm, 0, Master_t, 1, 0)) ||
729 !(master->buf = vmnewof(vm, 0, char, 2 * SF_BUFSIZE, 0)))
734 master->vm = vm;
735 master->cur = master->end = master->buf;
736 master->max = master->buf + 2 * SF_BUFSIZE - 1;
737 master->restore = -1;
759 if (master->prompt && !masterline(mp, lp, master->prompt, 0, timeout, master))
790 if ((cond->prev->flags & SKIP) && !(cond->text = 0) || !(cond->text = masterline(mp, lp, 0, 0, timeout, master)))
844 if (!(m = masterline(mp, lp, s, 1, timeout, master)))
850 if (!(m = masterline(mp, lp, 0, s[0] == '?' && s[1] == '.' ? -1 : 1, timeout, master)))
871 if (!(m = masterline(mp, lp, 0, -1, timeout, master)))
889 if (master->ignore)
891 vmfree(vm, master->ignore);
892 master->ignore = 0;
894 if (*s && !(master->ignore = vmstrdup(vm, s)))
913 if (master->prompt)
915 vmfree(vm, master->prompt);
916 master->prompt = 0;
918 if (*s && !(master->prompt = vmstrdup(vm, s)))
953 int master;
1013 if (mkpty(&master, &slave) < 0)
1015 if (!(mp = sfnew(NiL, 0, SF_UNBOUND, master, SF_READ|SF_WRITE)))
1016 error(ERROR_system(1), "cannot open master stream");
1065 master = procclose(proc);
1068 return slave ? slave : master;