]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/radius/radiusclient/lib/util.c
Whitespace tidying.
[ppp.git] / pppd / plugins / radius / radiusclient / lib / util.c
index 392db249bc24a88b977b6867d0858d64ebe48a9d..813ec7ec5452e832121dccdc8774ff5c6c32e817 100644 (file)
@@ -1,15 +1,15 @@
 /*
- * $Id: util.c,v 1.1 2002/01/22 16:03:02 dfs Exp $
+ * $Id: util.c,v 1.2 2002/02/27 15:51:20 dfs Exp $
  *
  * Copyright (C) 1995,1996,1997 Lars Fenneberg
  *
  * Copyright 1992 Livingston Enterprises, Inc.
  *
- * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan 
+ * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan
  * and Merit Network, Inc. All Rights Reserved
  *
- * See the file COPYRIGHT for the respective terms and conditions. 
- * If the file is missing contact me at lf@elemental.net 
+ * See the file COPYRIGHT for the respective terms and conditions.
+ * If the file is missing contact me at lf@elemental.net
  * and I'll send you a copy.
  *
  */
@@ -61,16 +61,16 @@ void rc_str2tm (char *valstr, struct tm *tm)
 
 char *rc_getifname(char *tty)
 {
-#if defined(BSD4_4) || defined(linux)  
-       static char     name[512];
+#if defined(BSD4_4) || defined(linux)
+       static char     name[512];
        int             fd;
 
        if ((fd = open(tty, O_RDWR|O_NDELAY)) < 0) {
                rc_log(LOG_ERR, "rc_getifname: can't open %s: %s", tty, strerror(errno));
                return NULL;
        }
-#endif 
-       
+#endif
+
 #ifdef BSD4_4
        strcpy(name,ttyname(fd));
        if (strlen(name) < 1) {
@@ -88,7 +88,7 @@ char *rc_getifname(char *tty)
        return NULL;
 #endif
 
-#if defined(BSD4_4) || defined(linux)  
+#if defined(BSD4_4) || defined(linux)
        close(fd);
        return name;
 #endif
@@ -125,17 +125,17 @@ char *rc_getstr (char *prompt, int do_echo)
 
        if ((is_term = isatty(in)))
        {
-       
+
                (void) tcgetattr (in, &term_old);
                term_new = term_old;
                if (do_echo)
                        term_new.c_lflag |= ECHO;
-               else 
+               else
                        term_new.c_lflag &= ~ECHO;
-       
+
                if (tcsetattr (in, TCSAFLUSH, &term_new) == 0)
                        flushed = 1;
-                       
+
        }
        else
        {
@@ -143,18 +143,18 @@ char *rc_getstr (char *prompt, int do_echo)
                if ((flags = fcntl(in, F_GETFL, 0)) >= 0) {
                        old_flags = flags;
                        flags |= O_NONBLOCK;
-                       
+
                        fcntl(in, F_SETFL, flags);
-                       
+
                        while (read(in, &c, 1) > 0)
                                /* nothing */;
-                               
+
                        fcntl(in, F_SETFL, old_flags);
-                       
+
                        flushed = 1;
-               }  
+               }
        }
-               
+
        write(out, prompt, strlen(prompt));
 
        /* well, this looks ugly, but it handles the following end of line
@@ -165,7 +165,7 @@ char *rc_getstr (char *prompt, int do_echo)
        {
                if (read(in, &c, 1) <= 0)
                        return NULL;
-               
+
                if (!flushed && ((c == '\0') || (c == '\r') || (c == '\n'))) {
                        flushed = 1;
                        continue;
@@ -185,23 +185,23 @@ char *rc_getstr (char *prompt, int do_echo)
        }
 
        *p = '\0';
-       
+
        if (!do_echo || !is_term) write(out, "\r\n", 2);
-       
+
        if (is_term)
                tcsetattr (in, TCSAFLUSH, &term_old);
        else {
                if ((flags = fcntl(in, F_GETFL, 0)) >= 0) {
                        old_flags = flags;
                        flags |= O_NONBLOCK;
-                       
+
                        fcntl(in, F_SETFL, flags);
-                       
+
                        while (read(in, &c, 1) > 0)
                                /* nothing */;
-                               
+
                        fcntl(in, F_SETFL, old_flags);
-               }  
+               }
        }
 
        (void) sigprocmask (SIG_SETMASK, &oldset, NULL);
@@ -212,7 +212,7 @@ char *rc_getstr (char *prompt, int do_echo)
 void rc_mdelay(int msecs)
 {
        struct timeval tv;
-       
+
        tv.tv_sec = (int) msecs / 1000;
        tv.tv_usec = (msecs % 1000) * 1000;