summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/chat.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-05-08 11:07:56 +0000
committerbrian <brian@FreeBSD.org>1999-05-08 11:07:56 +0000
commitab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4 (patch)
treee79816f983bd5a5be86a78fe0aafbd00a13ac2db /usr.sbin/ppp/chat.c
parent713dd62834d401cc7b9b394a4b916ab9e5e3d4d5 (diff)
downloadFreeBSD-src-ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4.zip
FreeBSD-src-ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4.tar.gz
o Redesign the layering mechanism and make the aliasing code part of
the layering. We now ``stack'' layers as soon as we open the device (when we figure out what we're dealing with). A static set of `dispatch' routines are also declared for dealing with incoming packets after they've been `pulled' up through the stacked layers. Physical devices are now assigned handlers based on the device type when they're opened. For the moment there are three device types; ttys, execs and tcps. o Increment version number to 2.2 o Make an entry in [uw]tmp for non-tty -direct invocations (after pap/chap authentication). o Make throughput counters quad_t's o Account for the absolute number of mbuf malloc()s and free()s in ``show mem''. o ``show modem'' becomes ``show physical''.
Diffstat (limited to 'usr.sbin/ppp/chat.c')
-rw-r--r--usr.sbin/ppp/chat.c65
1 files changed, 5 insertions, 60 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c
index ad56a01..f6fc574 100644
--- a/usr.sbin/ppp/chat.c
+++ b/usr.sbin/ppp/chat.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: chat.c,v 1.53 1999/01/28 01:56:31 brian Exp $
+ * $Id: chat.c,v 1.54 1999/02/12 00:52:29 brian Exp $
*/
#include <sys/param.h>
@@ -42,6 +42,7 @@
#include <termios.h>
#include <unistd.h>
+#include "layer.h"
#include "mbuf.h"
#include "log.h"
#include "defs.h"
@@ -73,7 +74,6 @@
#include "bundle.h"
#define BUFLEFT(c) (sizeof (c)->buf - ((c)->bufend - (c)->buf))
-#define issep(c) ((c) == '\t' || (c) == ' ')
static void ExecStr(struct physical *, char *, char *, int);
static char *ExpandString(struct chat *, const char *, char *, int, int);
@@ -301,9 +301,9 @@ chat_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
*/
if (c->state == CHAT_EXPECT)
- return physical_UpdateSet(&c->physical->desc, r, NULL, e, n, 1);
+ return physical_doUpdateSet(&c->physical->desc, r, NULL, e, n, 1);
else
- return physical_UpdateSet(&c->physical->desc, NULL, w, e, n, 1);
+ return physical_doUpdateSet(&c->physical->desc, NULL, w, e, n, 1);
}
static int
@@ -566,61 +566,6 @@ chat_Destroy(struct chat *c)
c->abort.num = 0;
}
-static char *
-findblank(char *p, int instring)
-{
- if (instring) {
- while (*p) {
- if (*p == '\\') {
- strcpy(p, p + 1);
- if (!*p)
- break;
- } else if (*p == '"')
- return (p);
- p++;
- }
- } else {
- while (*p) {
- if (issep(*p))
- return (p);
- p++;
- }
- }
- return p;
-}
-
-int
-MakeArgs(char *script, char **pvect, int maxargs)
-{
- int nargs, nb;
- int instring;
-
- nargs = 0;
- while (*script) {
- nb = strspn(script, " \t");
- script += nb;
- if (*script) {
- if (*script == '"') {
- instring = 1;
- script++;
- if (*script == '\0')
- break; /* Shouldn't return here. Need to null
- * terminate below */
- } else
- instring = 0;
- if (nargs >= maxargs - 1)
- break;
- *pvect++ = script;
- nargs++;
- script = findblank(script, instring);
- if (*script)
- *script++ = '\0';
- }
- }
- *pvect = NULL;
- return nargs;
-}
-
/*
* \c don't add a cr
* \d Sleep a little (delay 2 seconds
@@ -743,7 +688,7 @@ ExecStr(struct physical *physical, char *command, char *out, int olen)
close(fids[0]);
timer_TermService();
fids[1] = fcntl(fids[1], F_DUPFD, 4);
- dup2(physical_GetFD(physical), STDIN_FILENO);
+ dup2(physical->fd, STDIN_FILENO);
dup2(STDIN_FILENO, STDOUT_FILENO);
dup2(fids[1], STDERR_FILENO);
close(3);
OpenPOWER on IntegriCloud