]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_baudrate.c
ncurses 6.2 - patch 20200906
[ncurses.git] / ncurses / tinfo / lib_baudrate.c
index 3430477df712e7d6e53a8030370868010061b6d4..311c41ac97fa4743e88b47cc664d24409080cb01 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -83,7 +84,7 @@
 #undef USE_OLD_TTY
 #endif /* USE_OLD_TTY */
 
 #undef USE_OLD_TTY
 #endif /* USE_OLD_TTY */
 
-MODULE_ID("$Id: lib_baudrate.c,v 1.42 2016/10/03 00:29:21 tom Exp $")
+MODULE_ID("$Id: lib_baudrate.c,v 1.45 2020/09/05 21:15:32 tom Exp $")
 
 /*
  *     int
 
 /*
  *     int
@@ -98,6 +99,7 @@ struct speed {
     int actual_speed;          /* the actual speed */
 };
 
     int actual_speed;          /* the actual speed */
 };
 
+#if !defined(EXP_WIN32_DRIVER)
 #define DATA(number) { B##number, number }
 
 static struct speed const speeds[] =
 #define DATA(number) { B##number, number }
 
 static struct speed const speeds[] =
@@ -187,10 +189,16 @@ static struct speed const speeds[] =
 #endif
 #endif
 };
 #endif
 #endif
 };
+#endif /* !EXP_WIN32_DRIVER */
 
 NCURSES_EXPORT(int)
 _nc_baudrate(int OSpeed)
 {
 
 NCURSES_EXPORT(int)
 _nc_baudrate(int OSpeed)
 {
+#if defined(EXP_WIN32_DRIVER)
+    /* On Windows this is a noop */
+    (void) OSpeed;
+    return (OK);
+#else
 #if !USE_REENTRANT
     static int last_OSpeed;
     static int last_baudrate;
 #if !USE_REENTRANT
     static int last_OSpeed;
     static int last_baudrate;
@@ -229,13 +237,16 @@ _nc_baudrate(int OSpeed)
 #endif
     }
     return (result);
 #endif
     }
     return (result);
+#endif /* !EXP_WIN32_DRIVER */
 }
 
 NCURSES_EXPORT(int)
 _nc_ospeed(int BaudRate)
 {
     int result = 1;
 }
 
 NCURSES_EXPORT(int)
 _nc_ospeed(int BaudRate)
 {
     int result = 1;
-
+#if defined(EXP_WIN32_DRIVER)
+    (void) BaudRate;
+#else
     if (BaudRate >= 0) {
        unsigned i;
 
     if (BaudRate >= 0) {
        unsigned i;
 
@@ -246,6 +257,7 @@ _nc_ospeed(int BaudRate)
            }
        }
     }
            }
        }
     }
+#endif
     return (result);
 }
 
     return (result);
 }
 
@@ -256,6 +268,9 @@ NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0)
 
     T((T_CALLED("baudrate(%p)"), (void *) SP_PARM));
 
 
     T((T_CALLED("baudrate(%p)"), (void *) SP_PARM));
 
+#if defined(EXP_WIN32_DRIVER)
+    result = OK;
+#else
     /*
      * In debugging, allow the environment symbol to override when we're
      * redirecting to a file, so we can construct repeatable test-cases
     /*
      * In debugging, allow the environment symbol to override when we're
      * redirecting to a file, so we can construct repeatable test-cases
@@ -263,7 +278,7 @@ NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0)
      */
 #ifdef TRACE
     if (IsValidTIScreen(SP_PARM)
      */
 #ifdef TRACE
     if (IsValidTIScreen(SP_PARM)
-       && !NC_ISATTY(fileno(SP_PARM ? SP_PARM->_ofp : stdout))
+       && !NC_ISATTY(fileno((SP_PARM && SP_PARM->_ofp) ? SP_PARM->_ofp : stdout))
        && getenv("BAUDRATE") != 0) {
        int ret;
        if ((ret = _nc_getenv_num("BAUDRATE")) <= 0)
        && getenv("BAUDRATE") != 0) {
        int ret;
        if ((ret = _nc_getenv_num("BAUDRATE")) <= 0)
@@ -289,7 +304,7 @@ NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0)
     } else {
        result = ERR;
     }
     } else {
        result = ERR;
     }
-
+#endif /* !EXP_WIN32_DRIVER */
     returnCode(result);
 }
 
     returnCode(result);
 }