diff options
author | Brian Somers <brian@FreeBSD.org> | 1998-05-15 23:58:30 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 1998-05-15 23:58:30 +0000 |
commit | dd0645c5b76252f6c673406039f384ba2cdeea74 (patch) | |
tree | 684801d060a212758ea54068162a61bfd1d7c05b /usr.sbin/ppp/systems.c | |
parent | ea7229694b5a94840ef14aa0bb71bb338f02bbe9 (diff) | |
download | src-dd0645c5b76252f6c673406039f384ba2cdeea74.tar.gz src-dd0645c5b76252f6c673406039f384ba2cdeea74.zip |
o Add the `set mode' command for change a links current mode. It
is not possible to switch to or from dedicated or direct mode,
but all other combinations are ok (eg. -auto -> -ddial).
o Cope with the fact that commands with optional context may not
be able to obtain a link with command_ChooseLink() (if all links
have been deleted for example).
o Allow `clone'ing in non-multilink mode. We may for example want
to configure two links in unilink mode and dial them both, using
the one that comes up first. It's also possible to rename
``deflink'' by cloning it, deleting the original, then setting
the mode of the new link.
Notes
Notes:
svn path=/cvs2svn/branches/MP/; revision=36088
Diffstat (limited to 'usr.sbin/ppp/systems.c')
-rw-r--r-- | usr.sbin/ppp/systems.c | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c index 26b709a7e4eb..ab95428206cd 100644 --- a/usr.sbin/ppp/systems.c +++ b/usr.sbin/ppp/systems.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: systems.c,v 1.35.2.8 1998/04/30 23:53:56 brian Exp $ + * $Id: systems.c,v 1.35.2.9 1998/05/01 19:26:01 brian Exp $ * * TODO: */ @@ -180,49 +180,19 @@ AllowUsers(struct cmdargs const *arg) return 0; } -static struct { - int mode; - const char *name; -} modes[] = { - { PHYS_MANUAL, "interactive" }, - { PHYS_DEMAND, "auto" }, - { PHYS_DIRECT, "direct" }, - { PHYS_DEDICATED, "dedicated" }, - { PHYS_PERM, "ddial" }, - { PHYS_1OFF, "background" }, - { PHYS_ALL, "*" }, - { 0, 0 } -}; - -const char * -mode2Nam(int mode) -{ - int m; - - for (m = 0; modes[m].mode; m++) - if (modes[m].mode == mode) - return modes[m].name; - - return "unknown"; -} - int AllowModes(struct cmdargs const *arg) { /* arg->bundle may be NULL (see system_IsValid()) ! */ - int f; - int m; - int allowed; + int f, mode, allowed; allowed = 0; for (f = arg->argn; f < arg->argc; f++) { - for (m = 0; modes[m].mode; m++) - if (!strcasecmp(modes[m].name, arg->argv[f])) { - allowed |= modes[m].mode; - break; - } - if (modes[m].mode == 0) + mode = Nam2mode(arg->argv[f]); + if (mode == PHYS_NONE || mode == PHYS_ALL) log_Printf(LogWARN, "allow modes: %s: Invalid mode\n", arg->argv[f]); + else + allowed |= mode; } modeok = modereq & allowed ? 1 : 0; |