]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/options.c
Updated for OSF 4.0.
[ppp.git] / pppd / options.c
index 7d5c71af36117b6e6ceae7290e79e8a54de2337f..f9c9aa56e243d5d091e383348b5ad4c025e3f5ef 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: options.c,v 1.54 1999/03/22 05:55:33 paulus Exp $";
+static char rcsid[] = "$Id: options.c,v 1.57 1999/04/12 06:24:47 paulus Exp $";
 #endif
 
 #include <ctype.h>
@@ -88,6 +88,8 @@ int   idle_time_limit = 0;    /* Disconnect if idle for this many seconds */
 int    holdoff = 30;           /* # seconds to pause before reconnecting */
 bool   notty = 0;              /* Stdin/out is not a tty */
 char   *record_file = NULL;    /* File to record chars sent/received */
+int    using_pty = 0;
+bool   sync_serial = 0;        /* Device is synchronous serial device */
 
 extern option_t auth_options[];
 
@@ -210,6 +212,8 @@ option_t general_options[] = {
       "Show brief listing of options" },
     { "-h", o_special_noarg, showhelp,
       "Show brief listing of options" },
+    { "sync", o_bool, &sync_serial,
+      "Use synchronous HDLC serial encoding", 1 },
 
 #ifdef PPP_FILTER
     { "pdebug", o_int, &dflag,
@@ -299,7 +303,7 @@ parse_args(argc, argv)
 
 /*
  * scan_args - scan the command line arguments to get the tty name,
- * if specified.
+ * if specified.  Also checks whether the notty or pty option was given.
  */
 void
 scan_args(argc, argv)
@@ -314,6 +318,9 @@ scan_args(argc, argv)
        arg = *argv++;
        --argc;
 
+       if (strcmp(arg, "notty") == 0 || strcmp(arg, "pty") == 0)
+           using_pty = 1;
+
        /* Skip options and their arguments */
        opt = find_option(arg);
        if (opt != NULL) {
@@ -340,7 +347,7 @@ options_from_file(filename, must_exist, check_prot, priv)
     int priv;
 {
     FILE *f;
-    int i, newline, ret;
+    int i, newline, ret, err;
     option_t *opt;
     int oldpriv;
     char *oldsource;
@@ -351,11 +358,13 @@ options_from_file(filename, must_exist, check_prot, priv)
     if (check_prot)
        seteuid(getuid());
     f = fopen(filename, "r");
+    err = errno;
     if (check_prot)
        seteuid(0);
     if (f == NULL) {
-       if (!must_exist && errno == ENOENT)
+       if (!must_exist && err == ENOENT)
            return 1;
+       errno = err;
        option_error("Can't open options file %s: %m", filename);
        return 0;
     }