]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/main.c
mods & restructuring to support Solaris 2
[ppp.git] / pppd / main.c
index 69cc5c4ee6a3fdf052ce793b3d3851f847515c57..38af544d7ae0d261826d6c92381cd53054112164 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: main.c,v 1.21 1995/04/24 05:56:13 paulus Exp $";
+static char rcsid[] = "$Id: main.c,v 1.23 1995/05/19 03:26:25 paulus Exp $";
 #endif
 
 #include <stdio.h>
@@ -65,8 +65,8 @@ int ifunit;                   /* Interface unit number */
 
 char *progname;                        /* Name of this program */
 char hostname[MAXNAMELEN];     /* Our hostname */
-static char pidfilename[MAXPATHLEN];
-
+static char pidfilename[MAXPATHLEN];   /* name of pid file */
+static char default_devnam[MAXPATHLEN];        /* name of default device */
 static pid_t   pid;            /* Our pid */
 static pid_t   pgrpid;         /* Process Group ID */
 static uid_t uid;              /* Our real user-id */
@@ -160,6 +160,7 @@ main(argc, argv)
     p = ttyname(0);
     if (p)
        strcpy(devnam, p);
+    strcpy(default_devnam, devnam);
 
     if (gethostname(hostname, MAXNAMELEN) < 0 ) {
        perror("couldn't get hostname");
@@ -192,6 +193,13 @@ main(argc, argv)
     check_auth_options();
     setipdefault();
 
+    /*
+     * If the user has specified the default device name explicitly,
+     * pretend they hadn't.
+     */
+    if (!default_device && strcmp(devnam, default_devnam) == 0)
+       default_device = 1;
+
     /*
      * Initialize system-dependent stuff and magic number package.
      */
@@ -378,10 +386,7 @@ main(argc, argv)
 
     } while (persist);
 
-    if (lockflag && !default_device)
-       unlock();
-
-    exit(0);
+    die(0);
 }
 
 
@@ -402,7 +407,7 @@ get_input()
        return;
 
     if (len == 0) {
-       MAINDEBUG((LOG_DEBUG, "End of file on fd!"));
+       syslog(LOG_NOTICE, "Modem hangup");
        hungup = 1;
        lcp_lowerdown(0);       /* serial link is no longer available */
        phase = PHASE_DEAD;