home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Connectivity / GateKeeper-2.1 / options.m < prev    next >
Encoding:
Text File  |  1997-01-10  |  35.6 KB  |  1,756 lines

  1. /*
  2.  * options.c - handles option processing for PPP.
  3.  *
  4.  * Copyright (c) 1989 Carnegie Mellon University.
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms are permitted
  8.  * provided that the above copyright notice and this paragraph are
  9.  * duplicated in all such forms and that any documentation,
  10.  * advertising materials, and other materials related to such
  11.  * distribution and use acknowledge that the software was developed
  12.  * by Carnegie Mellon University.  The name of the
  13.  * University may not be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  *
  19.  *    11/19/96  FAR -- Corrected bug which caused GK's graphical editor 
  20.  *                        to edit the wrong values
  21.  *
  22.  *    Modifications added 6/16/96 to support GateKeeper.app
  23.  *    Copyright (c) 1996
  24.  *        
  25.  *            by    Felipe A. Rodriguez
  26.  *
  27.  *    GateKeeper code is supplied "as is" the author makes no warranty as  
  28.  *    to its suitability for any purpose.  This code is free and may be 
  29.  *    distributed in accordance with the terms of the:
  30.  *        
  31.  *            GNU GENERAL PUBLIC LICENSE
  32.  *            Version 2, June 1991
  33.  *            copyright (C) 1989, 1991 Free Software Foundation, Inc.
  34.  *             675 Mass Ave, Cambridge, MA 02139, USA
  35.  *
  36.  */
  37.  
  38.  
  39. //#ifndef lint
  40. //char rcsid[] = "$Id: options.c,v 1.22 1995/06/30 01:52:24 paulus Exp $";
  41. //#endif
  42.  
  43. #import <objc/Object.h>
  44. #import <appkit/Application.h>
  45. #import <appkit/nextstd.h>
  46. #import "options.h"
  47. #import "Coordinator.h"
  48. #import "OptionsEditor.h"
  49.  
  50.  
  51. #define    S_IRUSR    _S_IRUSR        /* read permission, */
  52. #define NGROUPS_MAX    16             /* Number of simultaneous    */  
  53.                                    /* supplementary group IDs   */
  54.                                   /* per process.              */
  55. #define S_IRGRP    0000040        /* read permission, group */
  56. #define S_IROTH    0000004        /* read permission, other */
  57. #define MAXWORDLEN    1024    /* max length of word in file (incl null) */
  58. #define MAXARGS        1        /* max # args to a command */
  59. #define MAXNAMELEN    256        /* max length of hostname or name for auth */
  60. #define MAXSECRETLEN    256    /* max length of password or secret */
  61.  
  62. #import <stdio.h>
  63. #import <errno.h>
  64. #import <ctype.h>
  65. #import <unistd.h>
  66. #import <limits.h>
  67. #import <stdlib.h>
  68. #import <termios.h>
  69. #import <syslog.h>
  70. #import <string.h>
  71. #import <netdb.h>
  72. #import <pwd.h>
  73. #import <sys/types.h>
  74. #import <sys/stat.h>
  75. #import <sys/param.h>        /* for MAXPATHLEN and BSD4_4, if defined */
  76. #import <netinet/in.h>
  77.  
  78.  
  79. typedef unsigned u_int32_t;
  80.  
  81. #ifndef GIDSET_TYPE
  82. #define GIDSET_TYPE    int
  83. #endif
  84.  
  85. /*
  86.  * Option variables and default values.
  87.  */
  88. int    debug = 0;        /* Debug flag */
  89. int    default_device = 1;    /* Using /dev/tty or equivalent */
  90. char devnam[MAXPATHLEN] = "/dev/tty";    /* Device name */
  91. int    crtscts = 0;        /* Use hardware flow control */
  92. int    modem = 1;        /* Use modem control lines */
  93. int    inspeed = 0;        /* Input/Output speed requested */
  94. int    lockflag = 0;        /* Create lock file to lock the serial dev */
  95. int    nodetach = 0;        /* Don't detach from controlling tty */
  96. int    defaultroute = 0;    /* assign default route through interface */
  97. int    proxyarp = 0;        /* Set up proxy ARP entry for peer */
  98.     FILE *f;
  99.  
  100.  
  101. //*****************************************************************************
  102. //
  103. //         Prototypes for implemented functions 
  104. //
  105. //            GateKeeper supports graphical editing of these parameters
  106. //
  107. //*****************************************************************************
  108.  
  109. static int setspeed (char *arg);
  110. static int setlock (void);
  111. static int clearlock (void);
  112. static int setdefaultroute (void);
  113. static int cleardefaultroute (void);
  114. static int setdebug (void);
  115. static int cleardebug (void);
  116. static int setd (void);
  117. static int cleard (void);
  118. static int setcrtscts (void);
  119. static int clearcrtscts (void);
  120. static int setdevname(char *cp);
  121.  
  122.  
  123. #define __P(x)    ()                    // redefine in order to get a clean 
  124.                                     // compile under NeXT
  125.  
  126. //*****************************************************************************
  127. //
  128. //         Prototypes for placeholders 
  129. //
  130. //            GateKeeper does not support graphical editing of these parameters
  131. //
  132. //*****************************************************************************
  133.  
  134. static int setkdebug __P((char **));
  135. static int setpassive __P((void));
  136. static int setsilent __P((void));
  137. static int noopt __P((void));
  138. static int setnovj __P((void));
  139. static int setnovjccomp __P((void));
  140. static int setvjslots __P((char **));
  141. static int reqpap __P((void));
  142. static int nopap __P((void));
  143. static int setupapfile __P((char **));
  144. static int nochap __P((void));
  145. static int reqchap __P((void));
  146. static int noaccomp __P((void));
  147. static int noasyncmap __P((void));
  148. static int noip __P((void));
  149. static int nomagicnumber __P((void));
  150. static int setasyncmap __P((char **));
  151. static int setescape __P((char **));
  152. static int setmru __P((char **));
  153. static int setmtu __P((char **));
  154. static int setcbcp __P((char **));
  155. static int nomru __P((void));
  156. static int nopcomp __P((void));
  157. static int setconnector __P((char **));
  158. static int setdisconnector __P((char **));
  159. static int setwelcomer __P((char **));
  160. static int setmaxconnect __P((char **));
  161. static int setdomain __P((char **));
  162. static int setnetmask __P((char **));
  163. static int setnocrtscts __P((void));
  164. static int setxonxoff __P((void));
  165. static int setnodetach __P((void));
  166. static int setmodem __P((void));
  167. static int setlocal __P((void));
  168. static int setname __P((char **));
  169. static int setuser __P((char **));
  170. static int setremote __P((char **));
  171. static int setauth __P((void));
  172. static int setnoauth __P((void));
  173. static int readfile __P((char **));
  174. static int callfile __P((char **));
  175. static int setnodefaultroute __P((void));
  176. static int setproxyarp __P((void));
  177. static int setnoproxyarp __P((void));
  178. static int setpersist __P((void));
  179. static int setnopersist __P((void));
  180. static int setdologin __P((void));
  181. static int setusehostname __P((void));
  182. static int setnoipdflt __P((void));
  183. static int setlcptimeout __P((char **));
  184. static int setlcpterm __P((char **));
  185. static int setlcpconf __P((char **));
  186. static int setlcpfails __P((char **));
  187. static int setipcptimeout __P((char **));
  188. static int setipcpterm __P((char **));
  189. static int setipcpconf __P((char **));
  190. static int setipcpfails __P((char **));
  191. static int setpaptimeout __P((char **));
  192. static int setpapreqs __P((char **));
  193. static int setpapreqtime __P((char **));
  194. static int setchaptimeout __P((char **));
  195. static int setchapchal __P((char **));
  196. static int setchapintv __P((char **));
  197. static int setipcpaccl __P((void));
  198. static int setipcpaccr __P((void));
  199. static int setlcpechointv __P((char **));
  200. static int setlcpechofails __P((char **));
  201. static int noccp __P((void));
  202. static int setbsdcomp __P((char **));
  203. static int setnobsdcomp __P((void));
  204. static int setdeflate __P((char **));
  205. static int setnodeflate __P((void));
  206. static int setdemand __P((void));
  207. static int setpred1comp __P((void));
  208. static int setnopred1comp __P((void));
  209. static int setipparam __P((char **));
  210. static int setpapcrypt __P((void));
  211. static int setidle __P((char **));
  212. static int setholdoff __P((char **));
  213. static int setdnsaddr __P((char **));
  214. static int resetipxproto __P((void));
  215. static int setipxproto __P((void));
  216. static int setipxanet __P((void));
  217. static int setipxalcl __P((void));
  218. static int setipxarmt __P((void));
  219. static int setipxnetwork __P((char **));
  220. static int setipxnode __P((char **));
  221. static int setipxrouter __P((char **));
  222. static int setipxname __P((char **));
  223. static int setipxcptimeout __P((char **));
  224. static int setipxcpterm __P((char **));
  225. static int setipxcpconf __P((char **));
  226. static int setipxcpfails __P((char **));
  227.  
  228.  
  229.  
  230. static int hitArray[7];        // used in determining whether an option flag
  231.                             // method was called while scanning options file 
  232.  
  233.  
  234. /*
  235.  * Valid arguments.
  236.  */
  237. static struct cmd {
  238.     char *cmd_name;
  239.     int num_args;
  240.     int (*cmd_func)();
  241. } cmds[] = {
  242.             // implemented functions
  243.     {"-d", 0, setd},    /* Increase debugging level */
  244.     {"@-d", 0, cleard},    /* Increase debugging level */
  245.     {"debug", 0, setdebug},    /* Increase debugging level */
  246.     {"@debug", 0, cleardebug},    /* Increase debugging level */
  247.     {"crtscts", 0, setcrtscts},        /* set h/w flow control */
  248.     {"-crtscts", 0, clearcrtscts},     /* clear h/w flow control */
  249.     {"@crtscts", 0, clearcrtscts},     /* clear h/w flow control */
  250.     {"lock", 0, setlock},    /* Lock serial device (with lock file) */
  251.     {"@lock", 0, clearlock},    /* Lock serial device (with lock file) */
  252.     {"defaultroute", 0, setdefaultroute}, /* Add default route */
  253.     {"@defaultroute", 0, cleardefaultroute}, /* Add default route */
  254.     {"mtu", 1, setmtu},                        /* Set mtu */
  255.  
  256.             // placeholder functions
  257.     {"-all", 0, noopt},        /* Don't request/allow any options (useless) */
  258.     {"noaccomp", 0, noaccomp},    /* Disable Address/Control compression */
  259.     {"-ac", 0, noaccomp},    /* Disable Address/Control compress */
  260.     {"default-asyncmap", 0, noasyncmap}, /* Disable asyncmap negoatiation */
  261.     {"-am", 0, noasyncmap},    /* Disable asyncmap negotiation */
  262.     {"-as", 1, setasyncmap},    /* set the desired async map */
  263.     {"nodetach", 0, setnodetach}, /* Don't detach from controlling tty */
  264.     {"-detach", 0, setnodetach}, /* don't fork */
  265.     {"noip", 0, noip},        /* Disable IP and IPCP */
  266.     {"-ip", 0, noip},        /* Disable IP and IPCP */
  267.     {"nomagic", 0, nomagicnumber}, /* Disable magic number negotiation */
  268.     {"-mn", 0, nomagicnumber},    /* Disable magic number negotiation */
  269.     {"default-mru", 0, nomru},    /* Disable MRU negotiation */
  270.     {"-mru", 0, nomru},        /* Disable mru negotiation */
  271.     {"-p", 0, setpassive},    /* Set passive mode */
  272.     {"nopcomp", 0, nopcomp},    /* Disable protocol field compression */
  273.     {"-pc", 0, nopcomp},    /* Disable protocol field compress */
  274.     {"+ua", 1, setupapfile},    /* Get PAP user and password from file */
  275.     {"require-pap", 0, reqpap},    /* Require PAP authentication from peer */
  276.     {"+pap", 0, reqpap},    /* Require PAP auth from peer */
  277.     {"refuse-pap", 0, nopap},    /* Don't agree to auth to peer with PAP */
  278.     {"-pap", 0, nopap},        /* Don't allow UPAP authentication with peer */
  279.     {"require-chap", 0, reqchap}, /* Require CHAP authentication from peer */
  280.     {"+chap", 0, reqchap},    /* Require CHAP authentication from peer */
  281.     {"refuse-chap", 0, nochap},    /* Don't agree to auth to peer with CHAP */
  282.     {"-chap", 0, nochap},    /* Don't allow CHAP authentication with peer */
  283.     {"novj", 0, setnovj},    /* Disable VJ compression */
  284.     {"-vj", 0, setnovj},    /* disable VJ compression */
  285.     {"novjccomp", 0, setnovjccomp}, /* disable VJ connection-ID compression */
  286.     {"-vjccomp", 0, setnovjccomp}, /* disable VJ connection-ID compression */
  287.     {"vj-max-slots", 1, setvjslots}, /* Set maximum VJ header slots */
  288.     {"asyncmap", 1, setasyncmap}, /* set the desired async map */
  289.     {"escape", 1, setescape},    /* set chars to escape on transmission */
  290.     {"connect", 1, setconnector}, /* A program to set up a connection */
  291.     {"disconnect", 1, setdisconnector},    /* program to disconnect serial dev. */
  292.     {"welcome", 1, setwelcomer},/* Script to welcome client */
  293.     {"maxconnect", 1, setmaxconnect},  /* specify a maximum connect time */
  294.     {"nocrtscts", 0, setnocrtscts}, /* clear h/w flow control */
  295.     {"-crtscts", 0, setnocrtscts}, /* clear h/w flow control */
  296.     {"xonxoff", 0, setxonxoff},    /* set s/w flow control */
  297.     {"kdebug", 1, setkdebug},    /* Enable kernel-level debugging */
  298.     {"domain", 1, setdomain},    /* Add given domain name to hostname*/
  299.     {"mru", 1, setmru},        /* Set MRU value for negotiation */
  300.     {"mtu", 1, setmtu},        /* Set our MTU */
  301.     {"callback", 1, setcbcp},    /* Ask for callback */
  302.     {"netmask", 1, setnetmask},    /* set netmask */
  303.     {"passive", 0, setpassive},    /* Set passive mode */
  304.     {"silent", 0, setsilent},    /* Set silent mode */
  305.     {"modem", 0, setmodem},    /* Use modem control lines */
  306.     {"local", 0, setlocal},    /* Don't use modem control lines */
  307.     {"name", 1, setname},    /* Set local name for authentication */
  308.     {"user", 1, setuser},    /* Set name for auth with peer */
  309.     {"usehostname", 0, setusehostname},    /* Must use hostname for auth. */
  310.     {"remotename", 1, setremote}, /* Set remote name for authentication */
  311.     {"auth", 0, setauth},    /* Require authentication from peer */
  312.     {"noauth", 0, setnoauth},    /* Don't require peer to authenticate */
  313.     {"file", 1, readfile},    /* Take options from a file */
  314.     {"call", 1, callfile},    /* Take options from a privileged file */
  315.     {"nodefaultroute", 0, setnodefaultroute}, /* disable defaultroute option */
  316.     {"-defaultroute", 0, setnodefaultroute}, /* disable defaultroute option */
  317.     {"proxyarp", 0, setproxyarp}, /* Add proxy ARP entry */
  318.     {"noproxyarp", 0, setnoproxyarp}, /* disable proxyarp option */
  319.     {"-proxyarp", 0, setnoproxyarp}, /* disable proxyarp option */
  320.     {"persist", 0, setpersist},    /* Keep on reopening connection after close */
  321.     {"nopersist", 0, setnopersist},  /* Turn off persist option */
  322.     {"demand", 0, setdemand},    /* Dial on demand */
  323.     {"login", 0, setdologin},    /* Use system password database for UPAP */
  324.     {"noipdefault", 0, setnoipdflt}, /* Don't use name for default IP adrs */
  325.     {"lcp-echo-failure", 1, setlcpechofails}, /* consecutive echo failures */
  326.     {"lcp-echo-interval", 1, setlcpechointv}, /* time for lcp echo events */
  327.     {"lcp-restart", 1, setlcptimeout}, /* Set timeout for LCP */
  328.     {"lcp-max-terminate", 1, setlcpterm}, /* Set max #xmits for term-reqs */
  329.     {"lcp-max-configure", 1, setlcpconf}, /* Set max #xmits for conf-reqs */
  330.     {"lcp-max-failure", 1, setlcpfails}, /* Set max #conf-naks for LCP */
  331.     {"ipcp-restart", 1, setipcptimeout}, /* Set timeout for IPCP */
  332.     {"ipcp-max-terminate", 1, setipcpterm}, /* Set max #xmits for term-reqs */
  333.     {"ipcp-max-configure", 1, setipcpconf}, /* Set max #xmits for conf-reqs */
  334.     {"ipcp-max-failure", 1, setipcpfails}, /* Set max #conf-naks for IPCP */
  335.     {"pap-restart", 1, setpaptimeout},    /* Set retransmit timeout for PAP */
  336.     {"pap-max-authreq", 1, setpapreqs}, /* Set max #xmits for auth-reqs */
  337.     {"pap-timeout", 1, setpapreqtime},    /* Set time limit for peer PAP auth. */
  338.     {"chap-restart", 1, setchaptimeout}, /* Set timeout for CHAP */
  339.     {"chap-max-challenge", 1, setchapchal}, /* Set max #xmits for challenge */
  340.     {"chap-interval", 1, setchapintv}, /* Set interval for rechallenge */
  341.     {"ipcp-accept-local", 0, setipcpaccl}, /* Accept peer's address for us */
  342.     {"ipcp-accept-remote", 0, setipcpaccr}, /* Accept peer's address for it */
  343.     {"noccp", 0, noccp},        /* Disable CCP negotiation */
  344.     {"-ccp", 0, noccp},            /* Disable CCP negotiation */
  345.     {"bsdcomp", 1, setbsdcomp},        /* request BSD-Compress */
  346.     {"nobsdcomp", 0, setnobsdcomp},    /* don't allow BSD-Compress */
  347.     {"-bsdcomp", 0, setnobsdcomp},    /* don't allow BSD-Compress */
  348.     {"deflate", 1, setdeflate},        /* request Deflate compression */
  349.     {"nodeflate", 0, setnodeflate},    /* don't allow Deflate compression */
  350.     {"-deflate", 0, setnodeflate},    /* don't allow Deflate compression */
  351.     {"predictor1", 0, setpred1comp},    /* request Predictor-1 */
  352.     {"nopredictor1", 0, setnopred1comp},/* don't allow Predictor-1 */
  353.     {"-predictor1", 0, setnopred1comp},    /* don't allow Predictor-1 */
  354.     {"ipparam", 1, setipparam},        /* set ip script parameter */
  355.     {"papcrypt", 0, setpapcrypt},    /* PAP passwords encrypted */
  356.     {"idle", 1, setidle},        /* idle time limit (seconds) */
  357.     {"holdoff", 1, setholdoff},        /* set holdoff time (seconds) */
  358.     {"ms-dns", 1, setdnsaddr},        /* DNS address for the peer's use */
  359.     {"noipx",  0, resetipxproto},    /* Disable IPXCP (and IPX) */
  360.     {"-ipx",   0, resetipxproto},    /* Disable IPXCP (and IPX) */
  361.     {"ipx-network",          1, setipxnetwork}, /* IPX network number */
  362.     {"ipxcp-accept-network", 0, setipxanet},    /* Accept peer netowrk */
  363.     {"ipx-node",             1, setipxnode},    /* IPX node number */
  364.     {"ipxcp-accept-local",   0, setipxalcl},    /* Accept our address */
  365.     {"ipxcp-accept-remote",  0, setipxarmt},    /* Accept peer's address */
  366.     {"ipx-routing",          1, setipxrouter},  /* IPX routing proto number */
  367.     {"ipx-router-name",      1, setipxname},    /* IPX router name */
  368.     {"ipxcp-restart",        1, setipxcptimeout}, /* Set timeout for IPXCP */
  369.     {"ipxcp-max-terminate",  1, setipxcpterm},  /* max #xmits for term-reqs */
  370.     {"ipxcp-max-configure",  1, setipxcpconf},  /* max #xmits for conf-reqs */
  371.     {"ipxcp-max-failure",    1, setipxcpfails}, /* max #conf-naks for IPXCP */
  372.     {"ipx",             0, setipxproto},    /* Enable IPXCP (and IPX) */
  373.     {"+ipx",             0, setipxproto},    /* Enable IPXCP (and IPX) */
  374.    {NULL, 0, NULL}
  375. };
  376.  
  377.  
  378. /*
  379.  * Read a word from a file.
  380.  * Words are delimited by white-space or by quotes (" or ').
  381.  * Quotes, white-space and \ may be escaped with \.
  382.  * \<newline> is ignored.
  383.  */
  384.  
  385. int
  386. getword(f, word, newlinep, filename)
  387.     FILE *f;
  388.     char *word;
  389.     int *newlinep;
  390.     const char *filename;
  391. {
  392.     int c, len, escape;
  393.     int quoted, comment;
  394.     int value, digit, got, n;
  395.  
  396. #define isoctal(c) ((c) >= '0' && (c) < '8')
  397.  
  398.     *newlinep = 0;
  399.     len = 0;
  400.     escape = 0;
  401.     comment = 0;
  402.  
  403.     /*
  404.      * First skip white-space and comments.
  405.      */
  406.     for (;;) {
  407.     c = getc(f);
  408.     if (c == EOF)
  409.         break;
  410.  
  411.     /*
  412.      * A newline means the end of a comment; backslash-newline
  413.      * is ignored.  Note that we cannot have escape && comment.
  414.      */
  415.     if (c == '\n') {
  416.         if (!escape) {
  417.         *newlinep = 1;
  418.         comment = 0;
  419.         } else
  420.         escape = 0;
  421.         continue;
  422.     }
  423.  
  424.  
  425.     /*
  426.      * Possible one of our flags or keywords.
  427.      */
  428.     if (comment && (c == '@'))
  429.         break;
  430.  
  431.     /*
  432.      * Ignore characters other than newline in a comment.
  433.      */
  434.     if (comment)
  435.         continue;
  436.  
  437.  
  438.     /*
  439.      * If this character is escaped, we have a word start.
  440.      */
  441.     if (escape)
  442.         break;
  443.  
  444.     /*
  445.      * If this is the escape character, look at the next character.
  446.      */
  447.     if (c == '\\') {
  448.         escape = 1;
  449.         continue;
  450.     }
  451.  
  452.     /*
  453.      * If this is the start of a comment, ignore the rest of the line.
  454.      */
  455.     if (c == '#') {
  456.         comment = 1;
  457.         continue;
  458.     }
  459.  
  460.     /*
  461.      * A non-whitespace character is the start of a word.
  462.      */
  463.     if (!isspace(c))
  464.         break;
  465.     }
  466.  
  467.     /*
  468.      * Save the delimiter for quoted strings.
  469.      */
  470.     if (!escape && (c == '"' || c == '\'')) {
  471.         quoted = c;
  472.     c = getc(f);
  473.     } else
  474.         quoted = 0;
  475.  
  476.     /*
  477.      * Process characters until the end of the word.
  478.      */
  479.     while (c != EOF) {
  480.     if (escape) {
  481.         /*
  482.          * This character is escaped: backslash-newline is ignored,
  483.          * various other characters indicate particular values
  484.          * as for C backslash-escapes.
  485.          */
  486.         escape = 0;
  487.         if (c == '\n') {
  488.             c = getc(f);
  489.         continue;
  490.         }
  491.  
  492.         got = 0;
  493.         switch (c) {
  494.         case 'a':
  495.         value = '\a';
  496.         break;
  497.         case 'b':
  498.         value = '\b';
  499.         break;
  500.         case 'f':
  501.         value = '\f';
  502.         break;
  503.         case 'n':
  504.         value = '\n';
  505.         break;
  506.         case 'r':
  507.         value = '\r';
  508.         break;
  509.         case 's':
  510.         value = ' ';
  511.         break;
  512.         case 't':
  513.         value = '\t';
  514.         break;
  515.  
  516.         default:
  517.         if (isoctal(c)) {
  518.             /*
  519.              * \ddd octal sequence
  520.              */
  521.             value = 0;
  522.             for (n = 0; n < 3 && isoctal(c); ++n) {
  523.             value = (value << 3) + (c & 07);
  524.             c = getc(f);
  525.             }
  526.             got = 1;
  527.             break;
  528.         }
  529.  
  530.         if (c == 'x') {
  531.             /*
  532.              * \x<hex_string> sequence
  533.              */
  534.             value = 0;
  535.             c = getc(f);
  536.             for (n = 0; n < 2 && isxdigit(c); ++n) {
  537.             digit = toupper(c) - '0';
  538.             if (digit > 10)
  539.                 digit += '0' + 10 - 'A';
  540.             value = (value << 4) + digit;
  541.             c = getc (f);
  542.             }
  543.             got = 1;
  544.             break;
  545.         }
  546.  
  547.         /*
  548.          * Otherwise the character stands for itself.
  549.          */
  550.         value = c;
  551.         break;
  552.         }
  553.  
  554.         /*
  555.          * Store the resulting character for the escape sequence.
  556.          */
  557.         if (len < MAXWORDLEN-1)
  558.         word[len] = value;
  559.         ++len;
  560.  
  561.         if (!got)
  562.         c = getc(f);
  563.         continue;
  564.  
  565.     }
  566.  
  567.     /*
  568.      * Not escaped: see if we've reached the end of the word.
  569.      */
  570.     if (quoted) {
  571.         if (c == quoted)
  572.         break;
  573.     } else {
  574.         if (isspace(c) || c == '#') {
  575.         ungetc (c, f);
  576.         break;
  577.         }
  578.     }
  579.  
  580.     /*
  581.      * Backslash starts an escape sequence.
  582.      */
  583.     if (c == '\\') {
  584.         escape = 1;
  585.         c = getc(f);
  586.         continue;
  587.     }
  588.  
  589.     /*
  590.      * An ordinary character: store it in the word and get another.
  591.      */
  592.     if (len < MAXWORDLEN-1)
  593.         word[len] = c;
  594.     ++len;
  595.  
  596.     c = getc(f);
  597.     }
  598.  
  599.     /*
  600.      * End of the word: check for errors.
  601.      */
  602.     if (c == EOF) {
  603.     if (ferror(f)) {
  604.         if (errno == 0)
  605.         errno = EIO;
  606.         perror(filename);
  607.         return 0;
  608.     }
  609.     /*
  610.      * If len is zero, then we didn't find a word before the
  611.      * end of the file.
  612.      */
  613.     if (len == 0)
  614.         return 0;
  615.     }
  616.  
  617.     /*
  618.      * Warn if the word was too long, and append a terminating null.
  619.      */
  620.     if (len >= MAXWORDLEN) {
  621.     perror("warning: word in options file is too long");
  622.     len = MAXWORDLEN - 1;
  623.     }
  624.     word[len] = 0;
  625.  
  626.     return 1;
  627.  
  628. #undef isoctal
  629.  
  630. }
  631.  
  632. /*
  633.  * options_from_file - Read a string of options from a file,
  634.  * and interpret them.
  635.  */
  636. int
  637. options_from_file(filename, must_exist, check_prot)
  638.     const char *filename;
  639.     int must_exist;
  640.     int check_prot;
  641. {
  642.     int i, newline, ret;
  643.     struct cmd *cmdp;
  644.     char *argv[MAXARGS];
  645.     char args[MAXARGS][MAXWORDLEN];
  646.     char cmd[MAXWORDLEN];
  647.  
  648.     for (i = 0; i < 6; i++)         // zero out hit array each invocation
  649.          {hitArray[i] = 0;}        // used in detecting whether func was called
  650.  
  651.     if ((f = fopen(filename, "r+")) == NULL) {
  652.     if (!must_exist && errno == ENOENT)
  653.         return 1;
  654.     perror(filename);
  655.     return 0;
  656.     }
  657.     if (check_prot && !readable(fileno(f))) {
  658.     fprintf(stderr, "%s: access denied\n", filename);
  659.     fclose(f);
  660.     return 0;
  661.     }
  662.  
  663.     while (getword(f, cmd, &newline, filename)) {
  664.     /*
  665.      * First see if it's a command.
  666.      */
  667.     for (cmdp = cmds; cmdp->cmd_name; cmdp++)
  668.         if (!strcmp(cmd, cmdp->cmd_name))
  669.         break;
  670.  
  671.     if (cmdp->cmd_name != NULL) {
  672.         for (i = 0; i < cmdp->num_args; ++i) {
  673.         if (!getword(f, args[i], &newline, filename)) {
  674.             fprintf(stderr,
  675.                 "In file %s: too few parameters for command %s\n",
  676.                 filename, cmd);
  677.             fclose(f);
  678.             f = NULL;
  679.             return 0;
  680.         }
  681.         argv[i] = args[i];
  682.         }
  683.         if (!(*cmdp->cmd_func)(argv)) {
  684.         fclose(f);
  685.         f = NULL;
  686.         return 0;
  687.         }
  688.  
  689.     } else {
  690.         /*
  691.          * Maybe a tty name, speed or IP address?
  692.          */
  693.         ret = setdevname(cmd);
  694.         ret = setspeed(cmd);
  695.         }
  696.     }
  697.     if(!hitArray[4] && [oDelegate shouldSave])
  698.         {
  699.         fputs("\n/dev/cua  \n", f);
  700.         [oDelegate setDevName:"/dev/cua"];
  701.         }
  702.     if(!hitArray[5] && [oDelegate shouldSave])        // speed not found in file
  703.         {
  704.         fputs("\n57600  \n", f);                    // save in options file
  705.         [oDelegate setSpeed:"57600"];                // show setting in GUI
  706.         }
  707.     if(!hitArray[0] && [oDelegate defaultRoute] && [oDelegate shouldSave])
  708.         fputs("\ndefaultroute  \n", f);
  709.     if(!hitArray[1] && [oDelegate lockFlag] && [oDelegate shouldSave])
  710.         fputs("\nlock  \n", f);
  711.     if(!hitArray[2] && [oDelegate crtscts] && [oDelegate shouldSave])
  712.         fputs("\ncrtscts  \n", f);
  713.     if(!hitArray[3] && [oDelegate debug] && [oDelegate shouldSave])
  714.         fputs("\ndebug  \n", f);
  715.  
  716.     if(f)
  717.         fclose(f);
  718.         f = NULL;
  719.  
  720.     return 1;
  721. }
  722.  
  723. /*
  724.  * readable - check if a file is readable by the real user.
  725.  */
  726. int
  727. readable(fd)
  728.     int fd;
  729. {
  730.     uid_t uid;
  731.     int ngroups, i;
  732.     struct stat sbuf;
  733.     GIDSET_TYPE groups[NGROUPS_MAX];
  734.  
  735.     uid = getuid();
  736.     if (uid == 0)
  737.     return 1;
  738.     if (fstat(fd, &sbuf) != 0)
  739.     return 0;
  740.     if (sbuf.st_uid == uid)
  741.     return sbuf.st_mode & S_IRUSR;
  742.     if (sbuf.st_gid == getgid())
  743.     return sbuf.st_mode & S_IRGRP;
  744.     ngroups = getgroups(NGROUPS_MAX, groups);
  745.     for (i = 0; i < ngroups; ++i)
  746.     if (sbuf.st_gid == groups[i])
  747.         return sbuf.st_mode & S_IRGRP;
  748.     return sbuf.st_mode & S_IROTH;
  749. }
  750. //*****************************************************************************
  751. //
  752. //         set and remove "lock" flag 
  753. //
  754. //*****************************************************************************
  755.  
  756. static int
  757. setlock()
  758. {
  759.     if([oDelegate shouldSave] && ![oDelegate lockFlag])
  760.         {
  761.          fseek(f,-4, SEEK_CUR);
  762.         fputs("#@lock\n", f);
  763.         fseek(f, ftell(f), SEEK_SET);
  764.         }
  765.     else
  766.         [oDelegate setLockFlag];
  767.      hitArray[1] = 1;
  768.  
  769.     return 1;
  770. }
  771. static int
  772. clearlock()
  773. {
  774.     if([oDelegate shouldSave] && [oDelegate lockFlag])
  775.         {
  776.          fseek(f,-6, SEEK_CUR);
  777.         fputs("lock  \n", f);
  778.         fseek(f, ftell(f), SEEK_SET);
  779.         }
  780.      hitArray[1] = 1;
  781.  
  782.     return 1;
  783. }
  784. //*****************************************************************************
  785. //
  786. //         set and remove "defaultRoute" flag 
  787. //
  788. //*****************************************************************************
  789.  
  790. static int
  791. setdefaultroute()
  792. {
  793.     if([oDelegate shouldSave] && ![oDelegate defaultRoute])
  794.         {
  795.          fseek(f,-12, SEEK_CUR);
  796.         fputs("#@defaultroute\n", f);
  797.         fseek(f, ftell(f), SEEK_SET);
  798.         }
  799.     else
  800.         [oDelegate setDefaultRoute];
  801.      hitArray[0] = 1;
  802.  
  803.     return 1;
  804. }
  805. static int
  806. cleardefaultroute()
  807. {
  808.     if([oDelegate shouldSave] && [oDelegate defaultRoute])
  809.         {
  810.          fseek(f,-14, SEEK_CUR);
  811.         fputs("defaultroute  \n", f);
  812.         fseek(f, ftell(f), SEEK_SET);
  813.         }
  814.      hitArray[0] = 1;
  815.  
  816.     return 1;
  817. }
  818. //*****************************************************************************
  819. //
  820. //         set and remove "debug" flag 
  821. //
  822. //*****************************************************************************
  823.  
  824. static int
  825. setdebug()
  826. {
  827.     if([oDelegate shouldSave] && ![oDelegate debug])
  828.         {
  829.          fseek(f,-5, SEEK_CUR);
  830.         fputs("#@debug\n", f);
  831.         fseek(f, ftell(f), SEEK_SET);
  832.         }
  833.     else
  834.         [oDelegate setDebug];
  835.      hitArray[3] = 1;
  836.  
  837.     return 1;
  838. }
  839. static int
  840. cleardebug()
  841. {
  842.     if([oDelegate shouldSave] && [oDelegate debug])
  843.         {
  844.          fseek(f,-7, SEEK_CUR);
  845.         fputs("debug  \n", f);
  846.         fseek(f, ftell(f), SEEK_SET);
  847.         }
  848.      hitArray[3] = 1;
  849.  
  850.     return 1;
  851. }
  852. static int
  853. setd()
  854. {
  855.     if([oDelegate shouldSave] && ![oDelegate debug])
  856.         {
  857.          fseek(f,-2, SEEK_CUR);
  858.         fputs("#@-d\n", f);
  859.         fseek(f, ftell(f), SEEK_SET);
  860.         }
  861.     else
  862.         [oDelegate setDebug];
  863.      hitArray[3] = 1;
  864.  
  865.     return 1;
  866. }
  867. static int
  868. cleard()
  869. {
  870.     if([oDelegate shouldSave] && [oDelegate debug])
  871.         {
  872.          fseek(f,-4, SEEK_CUR);
  873.         fputs("-d  \n", f);
  874.         fseek(f, ftell(f), SEEK_SET);
  875.         }
  876.      hitArray[3] = 1;
  877.  
  878.     return 1;
  879. }
  880. //*****************************************************************************
  881. //
  882. //         set and remove "crtscts" flag 
  883. //
  884. //*****************************************************************************
  885.  
  886. static int
  887. setcrtscts()
  888. {
  889.     if([oDelegate shouldSave] && ![oDelegate crtscts])
  890.         {
  891.          fseek(f,-7, SEEK_CUR);
  892.         fputs("-crtscts\n", f);
  893.         fseek(f, ftell(f), SEEK_SET);
  894.         }
  895.     else
  896.         [oDelegate setCrtscts];
  897.      hitArray[2] = 1;
  898.  
  899.     return 1;
  900. }
  901. static int
  902. clearcrtscts()
  903. {
  904.     if([oDelegate shouldSave] && [oDelegate crtscts])
  905.         {
  906.          fseek(f,-8, SEEK_CUR);
  907.         fputs("crtscts \n", f);
  908.         fseek(f, ftell(f), SEEK_SET);
  909.         }
  910.      hitArray[2] = 1;
  911.  
  912.     return 1;
  913. }
  914.  
  915. /*
  916.  * setspeed - Set the speed.
  917.  */
  918. static int
  919. setspeed(arg)
  920.     char *arg;
  921. {
  922.     char *ptr;
  923.     int spd;
  924.     int lenOfarg = strlen(arg);
  925.  
  926.     spd = strtol(arg, &ptr, 0);
  927.     if (ptr == arg || *ptr != 0 || spd == 0)
  928.     return 0;
  929.  
  930.     if([oDelegate shouldSave] && (strcmp([oDelegate speed], arg) != 0))
  931.         {                                    // user changed speed in GUI
  932.          fseek(f,-lenOfarg, SEEK_CUR);
  933.         fputs([oDelegate speed], f);
  934.         if((lenOfarg = strlen([oDelegate speed])) == 5)
  935.             fputs("\n", f);
  936.         if(lenOfarg == 4)
  937.             fputs(" \n", f);
  938.         if(lenOfarg == 3)
  939.             fputs("  \n", f);
  940.         fseek(f, ftell(f), SEEK_SET);
  941.          hitArray[5] = 1;
  942.         }
  943.     else                                    // else we just scanned an opt file
  944.         {
  945.         if([oDelegate setSpeed:arg])        // show results in GUI
  946.              hitArray[5] = 1;
  947.         }
  948.  
  949.     inspeed = spd;
  950.     return 1;
  951. }
  952.  
  953.  
  954. /*
  955.  * setdevname - Set the device name.
  956.  */
  957. int
  958. setdevname(cp)
  959.     char *cp;
  960. {
  961.     struct stat statbuf;
  962.     char *ttyname();
  963.     char dev[MAXPATHLEN];
  964.     int lenOfcp = strlen(cp);
  965.  
  966.     if (strncmp("/dev/", cp, 5) != 0) {
  967.     strcpy(dev, "/dev/");
  968.     strncat(dev, cp, MAXPATHLEN - 5);
  969.     dev[MAXPATHLEN-1] = 0;
  970.     cp = dev;
  971.     }
  972.  
  973.     /*
  974.      * Check if there is a device by this name.
  975.      */
  976.     if (stat(cp, &statbuf) < 0) {
  977.     if (errno == ENOENT)
  978.         return 0;
  979.     syslog(LOG_ERR, cp);
  980.     return -1;
  981.     }
  982.   
  983.     if([oDelegate shouldSave] && (strcmp([oDelegate devName], cp) != 0))
  984.         {
  985.          fseek(f,-lenOfcp, SEEK_CUR);
  986.         fputs([oDelegate devName], f);
  987.         if((lenOfcp = strlen([oDelegate devName]))== 10)
  988.             fputs("\n", f);
  989.         if(lenOfcp == 9)
  990.             fputs(" \n", f);
  991.         if(lenOfcp == 8)
  992.             fputs("  \n", f);
  993.         fseek(f, ftell(f), SEEK_SET);
  994.         }
  995.     else
  996.         [oDelegate setDevName:cp];
  997.      hitArray[4] = 1;
  998.  
  999.     (void) strncpy(devnam, cp, MAXPATHLEN);
  1000.     devnam[MAXPATHLEN-1] = 0;
  1001.     default_device = FALSE;
  1002.   
  1003.     return 1;
  1004. }
  1005.  
  1006. int setDelegate(id del)
  1007. {
  1008.     oDelegate = del;
  1009.  
  1010.     return 1;
  1011. }
  1012. //*****************************************************************************
  1013. //
  1014. //         the following do nothing  
  1015. //
  1016. //*****************************************************************************
  1017.  
  1018. /*
  1019.  * setkdebug - Set kernel debugging level.
  1020.  */
  1021. static int
  1022. setkdebug(argv)
  1023.     char **argv;
  1024. {
  1025.     return 1;
  1026. }
  1027.  
  1028. /*
  1029.  * noopt - Disable all options.
  1030.  */
  1031. static int
  1032. noopt()
  1033. {
  1034.     return 1;
  1035. }
  1036.  
  1037. /*
  1038.  * noaccomp - Disable Address/Control field compression negotiation.
  1039.  */
  1040. static int
  1041. noaccomp()
  1042. {
  1043.     return 1;
  1044. }
  1045.  
  1046.  
  1047. /*
  1048.  * noasyncmap - Disable async map negotiation.
  1049.  */
  1050. static int
  1051. noasyncmap()
  1052. {
  1053.     return 1;
  1054. }
  1055.  
  1056.  
  1057. /*
  1058.  * noip - Disable IP and IPCP.
  1059.  */
  1060. static int
  1061. noip()
  1062. {
  1063.     return 1;
  1064. }
  1065.  
  1066.  
  1067. /*
  1068.  * nomagicnumber - Disable magic number negotiation.
  1069.  */
  1070. static int
  1071. nomagicnumber()
  1072. {
  1073.     return 1;
  1074. }
  1075.  
  1076.  
  1077. /*
  1078.  * nomru - Disable mru negotiation.
  1079.  */
  1080. static int
  1081. nomru()
  1082. {
  1083.     return 1;
  1084. }
  1085.  
  1086.  
  1087. /*
  1088.  * setmru - Set MRU for negotiation.
  1089.  */
  1090. static int
  1091. setmru(argv)
  1092.     char **argv;
  1093. {
  1094.     return 1;
  1095. }
  1096.  
  1097.  
  1098. /*
  1099.  * setmru - Set the largest MTU we'll use.
  1100.  */
  1101. static int
  1102. setmtu(argv)
  1103.     char **argv;
  1104. {
  1105.     return 1;
  1106. }
  1107.  
  1108. static int
  1109. setcbcp(argv)
  1110.     char **argv;
  1111. {
  1112.     return 1;
  1113. }
  1114.  
  1115. /*
  1116.  * nopcomp - Disable Protocol field compression negotiation.
  1117.  */
  1118. static int
  1119. nopcomp()
  1120. {
  1121.     return 1;
  1122. }
  1123.  
  1124.  
  1125. /*
  1126.  * setpassive - Set passive mode (don't give up if we time out sending
  1127.  * LCP configure-requests).
  1128.  */
  1129. static int
  1130. setpassive()
  1131. {
  1132.     return 1;
  1133. }
  1134.  
  1135.  
  1136. /*
  1137.  * setsilent - Set silent mode (don't start sending LCP configure-requests
  1138.  * until we get one from the peer).
  1139.  */
  1140. static int
  1141. setsilent()
  1142. {
  1143.     return 1;
  1144. }
  1145.  
  1146.  
  1147. /*
  1148.  * nopap - Disable PAP authentication with peer.
  1149.  */
  1150. static int
  1151. nopap()
  1152. {
  1153.     return 1;
  1154. }
  1155.  
  1156.  
  1157. /*
  1158.  * reqpap - Require PAP authentication from peer.
  1159.  */
  1160. static int
  1161. reqpap()
  1162. {
  1163.     return 1;
  1164. }
  1165.  
  1166. /*
  1167.  * setupapfile - specifies UPAP info for authenticating with peer.
  1168.  */
  1169. static int
  1170. setupapfile(argv)
  1171.     char **argv;
  1172. {
  1173.     return 1;
  1174. }
  1175.  
  1176.  
  1177. /*
  1178.  * nochap - Disable CHAP authentication with peer.
  1179.  */
  1180. static int
  1181. nochap()
  1182. {
  1183.     return 1;
  1184. }
  1185.  
  1186.  
  1187. /*
  1188.  * reqchap - Require CHAP authentication from peer.
  1189.  */
  1190. static int
  1191. reqchap()
  1192. {
  1193.     return 1;
  1194. }
  1195.  
  1196.  
  1197. /*
  1198.  * setnovj - disable vj compression
  1199.  */
  1200. static int
  1201. setnovj()
  1202. {
  1203.     return 1;
  1204. }
  1205.  
  1206.  
  1207. /*
  1208.  * setnovjccomp - disable VJ connection-ID compression
  1209.  */
  1210. static int
  1211. setnovjccomp()
  1212. {
  1213.     return 1;
  1214. }
  1215.  
  1216.  
  1217. /*
  1218.  * setvjslots - set maximum number of connection slots for VJ compression
  1219.  */
  1220. static int
  1221. setvjslots(argv)
  1222.     char **argv;
  1223. {
  1224.     return 1;
  1225. }
  1226.  
  1227.  
  1228. /*
  1229.  * setconnector - Set a program to connect to a serial line
  1230.  */
  1231. static int
  1232. setconnector(argv)
  1233.     char **argv;
  1234. {
  1235.     return 1;
  1236. }
  1237.  
  1238. /*
  1239.  * setdisconnector - Set a program to disconnect from the serial line
  1240.  */
  1241. static int
  1242. setdisconnector(argv)
  1243.     char **argv;
  1244. {
  1245.     return 1;
  1246. }
  1247.  
  1248. /*
  1249.  * setwelcomer - Set a program to welcome a client after connection
  1250.  */
  1251. static int
  1252. setwelcomer(argv)
  1253.     char **argv;
  1254. {
  1255.     return 1;
  1256. }
  1257.  
  1258. /*
  1259.  * setmaxconnect - Set the maximum connect time
  1260.  */
  1261. static int
  1262. setmaxconnect(argv)
  1263.     char **argv;
  1264. {
  1265.     return 1;
  1266. }
  1267.  
  1268. /*
  1269.  * setdomain - Set domain name to append to hostname 
  1270.  */
  1271. static int
  1272. setdomain(argv)
  1273.     char **argv;
  1274. {
  1275.     return 1;
  1276. }
  1277.  
  1278.  
  1279. /*
  1280.  * setasyncmap - add bits to asyncmap (what we request peer to escape).
  1281.  */
  1282. static int
  1283. setasyncmap(argv)
  1284.     char **argv;
  1285. {
  1286.     return 1;
  1287. }
  1288.  
  1289.  
  1290. /*
  1291.  * setescape - add chars to the set we escape on transmission.
  1292.  */
  1293. static int
  1294. setescape(argv)
  1295.     char **argv;
  1296. {
  1297.     return 1;
  1298. }
  1299.  
  1300. /*
  1301.  * setnoipdflt - disable setipdefault()
  1302.  */
  1303. static int
  1304. setnoipdflt()
  1305. {
  1306.     return 1;
  1307. }
  1308.  
  1309.  
  1310. /*
  1311.  * setipcpaccl - accept peer's idea of our address
  1312.  */
  1313. static int
  1314. setipcpaccl()
  1315. {
  1316.     return 1;
  1317. }
  1318.  
  1319.  
  1320. /*
  1321.  * setipcpaccr - accept peer's idea of its address
  1322.  */
  1323. static int
  1324. setipcpaccr()
  1325. {
  1326.     return 1;
  1327. }
  1328.  
  1329.  
  1330. /*
  1331.  * setnetmask - set the netmask to be used on the interface.
  1332.  */
  1333. static int
  1334. setnetmask(argv)
  1335.     char **argv;
  1336. {
  1337.     return 1;
  1338. }
  1339.  
  1340. static int
  1341. setnocrtscts()
  1342. {
  1343.     return 1;
  1344. }
  1345.  
  1346. static int
  1347. setxonxoff()
  1348. {
  1349.     return 1;
  1350. }
  1351.  
  1352. static int
  1353. setnodetach()
  1354. {
  1355.     return 1;
  1356. }
  1357.  
  1358. static int
  1359. setdemand()
  1360. {
  1361.     return 1;
  1362. }
  1363.  
  1364. static int
  1365. setmodem()
  1366. {
  1367.     return 1;
  1368. }
  1369.  
  1370. static int
  1371. setlocal()
  1372. {
  1373.     return 1;
  1374. }
  1375.  
  1376. static int
  1377. setusehostname()
  1378. {
  1379.     return 1;
  1380. }
  1381.  
  1382. static int
  1383. setname(argv)
  1384.     char **argv;
  1385. {
  1386.         return 1;
  1387. }
  1388.  
  1389. static int
  1390. setuser(argv)
  1391.     char **argv;
  1392. {
  1393.         return 1;
  1394. }
  1395.  
  1396. static int
  1397. setremote(argv)
  1398.     char **argv;
  1399. {
  1400.         return 1;
  1401. }
  1402.  
  1403. static int
  1404. setauth()
  1405. {
  1406.         return 1;
  1407. }
  1408.  
  1409. static int
  1410. setnoauth()
  1411. {
  1412.         return 1;
  1413. }
  1414.  
  1415. static int
  1416. setnodefaultroute()
  1417. {
  1418.         return 1;
  1419. }
  1420.  
  1421. static int
  1422. setproxyarp()
  1423. {
  1424.         return 1;
  1425. }
  1426.  
  1427. static int
  1428. setnoproxyarp()
  1429. {
  1430.         return 1;
  1431. }
  1432.  
  1433. static int
  1434. setpersist()
  1435. {
  1436.         return 1;
  1437. }
  1438.  
  1439. static int
  1440. setnopersist()
  1441. {
  1442.         return 1;
  1443. }
  1444.  
  1445. static int
  1446. setdologin()
  1447. {
  1448.         return 1;
  1449. }
  1450.  
  1451. /*
  1452.  * Functions to set the echo interval for modem-less monitors
  1453.  */
  1454.  
  1455. static int
  1456. setlcpechointv(argv)
  1457.     char **argv;
  1458. {
  1459.         return 1;
  1460. }
  1461.  
  1462. static int
  1463. setlcpechofails(argv)
  1464.     char **argv;
  1465. {
  1466.         return 1;
  1467. }
  1468.  
  1469. /*
  1470.  * Functions to set timeouts, max transmits, etc.
  1471.  */
  1472. static int
  1473. setlcptimeout(argv)
  1474.     char **argv;
  1475. {
  1476.         return 1;
  1477. }
  1478.  
  1479. static int
  1480. setlcpterm(argv)
  1481.     char **argv;
  1482. {
  1483.         return 1;
  1484. }
  1485.  
  1486. static int
  1487. setlcpconf(argv)
  1488.     char **argv;
  1489. {
  1490.         return 1;
  1491. }
  1492.  
  1493. static int
  1494. setlcpfails(argv)
  1495.     char **argv;
  1496. {
  1497.         return 1;
  1498. }
  1499.  
  1500. static int
  1501. setipcptimeout(argv)
  1502.     char **argv;
  1503. {
  1504.         return 1;
  1505. }
  1506.  
  1507. static int
  1508. setipcpterm(argv)
  1509.     char **argv;
  1510. {
  1511.         return 1;
  1512. }
  1513.  
  1514. static int
  1515. setipcpconf(argv)
  1516.     char **argv;
  1517. {
  1518.         return 1;
  1519. }
  1520.  
  1521. static int
  1522. setipcpfails(argv)
  1523.     char **argv;
  1524. {
  1525.         return 1;
  1526. }
  1527.  
  1528. static int
  1529. setpaptimeout(argv)
  1530.     char **argv;
  1531. {
  1532.         return 1;
  1533. }
  1534.  
  1535. static int
  1536. setpapreqtime(argv)
  1537.     char **argv;
  1538. {
  1539.         return 1;
  1540. }
  1541.  
  1542. static int
  1543. setpapreqs(argv)
  1544.     char **argv;
  1545. {
  1546.         return 1;
  1547. }
  1548.  
  1549. static int
  1550. setchaptimeout(argv)
  1551.     char **argv;
  1552. {
  1553.         return 1;
  1554. }
  1555.  
  1556. static int
  1557. setchapchal(argv)
  1558.     char **argv;
  1559. {
  1560.         return 1;
  1561. }
  1562.  
  1563. static int
  1564. setchapintv(argv)
  1565.     char **argv;
  1566. {
  1567.         return 1;
  1568. }
  1569.  
  1570. static int
  1571. noccp()
  1572. {
  1573.         return 1;
  1574. }
  1575.  
  1576. static int
  1577. setbsdcomp(argv)
  1578.     char **argv;
  1579. {
  1580.         return 1;
  1581. }
  1582.  
  1583. static int
  1584. setnobsdcomp()
  1585. {
  1586.         return 1;
  1587. }
  1588.  
  1589. static int
  1590. setdeflate(argv)
  1591.     char **argv;
  1592. {
  1593.         return 1;
  1594. }
  1595.  
  1596. static int
  1597. setnodeflate()
  1598. {
  1599.         return 1;
  1600. }
  1601.  
  1602. static int
  1603. setpred1comp()
  1604. {
  1605.         return 1;
  1606. }
  1607.  
  1608. static int
  1609. setnopred1comp()
  1610. {
  1611.         return 1;
  1612. }
  1613.  
  1614. static int
  1615. setipparam(argv)
  1616.     char **argv;
  1617. {
  1618.         return 1;
  1619. }
  1620.  
  1621. static int
  1622. setpapcrypt()
  1623. {
  1624.         return 1;
  1625. }
  1626.  
  1627. static int
  1628. setidle(argv)
  1629.     char **argv;
  1630. {
  1631.         return 1;
  1632. }
  1633.  
  1634. static int
  1635. setholdoff(argv)
  1636.     char **argv;
  1637. {
  1638.         return 1;
  1639. }
  1640.  
  1641. /*
  1642.  * setdnsaddr - set the dns address(es)
  1643.  */
  1644. static int
  1645. setdnsaddr(argv)
  1646.     char **argv;
  1647. {
  1648.         return 1;
  1649. }
  1650.  
  1651. static int
  1652. setipxrouter (argv)
  1653.     char **argv;
  1654. {
  1655.         return 1;
  1656. }
  1657.  
  1658. static int
  1659. setipxname (argv)
  1660.     char **argv;
  1661. {
  1662.         return 1;
  1663. }
  1664.  
  1665. static int
  1666. setipxcptimeout (argv)
  1667.     char **argv;
  1668. {
  1669.         return 1;
  1670. }
  1671.  
  1672. static int
  1673. setipxcpterm (argv)
  1674.     char **argv;
  1675. {
  1676.         return 1;
  1677. }
  1678.  
  1679. static int
  1680. setipxcpconf (argv)
  1681.     char **argv;
  1682. {
  1683.         return 1;
  1684. }
  1685.  
  1686. static int
  1687. setipxcpfails (argv)
  1688.     char **argv;
  1689. {
  1690.         return 1;
  1691. }
  1692.  
  1693. static int
  1694. setipxnetwork(argv)
  1695.     char **argv;
  1696. {
  1697.         return 1;
  1698. }
  1699.  
  1700. static int
  1701. setipxanet()
  1702. {
  1703.         return 1;
  1704. }
  1705.  
  1706. static int
  1707. setipxalcl()
  1708. {
  1709.         return 1;
  1710. }
  1711.  
  1712. static int
  1713. setipxarmt()
  1714. {
  1715.         return 1;
  1716. }
  1717.  
  1718. static int
  1719. setipxnode(argv)
  1720.     char **argv;
  1721. {
  1722.         return 1;
  1723. }
  1724.  
  1725. static int
  1726. setipxproto()
  1727. {
  1728.     return 1;
  1729. }
  1730.  
  1731. static int
  1732. resetipxproto()
  1733. {
  1734.     return 1;
  1735. }
  1736.  
  1737. /*
  1738.  * readfile - take commands from a file.
  1739.  */
  1740. static int
  1741. readfile(argv)
  1742.     char **argv;
  1743. {
  1744.     return 1;
  1745. }
  1746. /*
  1747.  * callfile - take commands from /etc/ppp/peers/<name>.
  1748.  * Name may not contain /../, start with / or ../, or end in /..
  1749.  */
  1750. static int
  1751. callfile(argv)
  1752.     char **argv;
  1753. {
  1754.     return 1;
  1755. }
  1756.