]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/tset.c
ncurses 5.0
[ncurses.git] / progs / tset.c
index 1df3fd64986923cdb79957030eefbd81dd91b315..cef980ad9737b566c5eb434d1f53e0c7c0c28e52 100644 (file)
@@ -103,7 +103,7 @@ char *ttyname(int fd);
 #include <curses.h>    /* for bool typedef */
 #include <dump_entry.h>
 
-MODULE_ID("$Id: tset.c,v 0.31 1998/02/11 12:14:02 tom Exp $")
+MODULE_ID("$Id: tset.c,v 0.37 1999/03/14 12:30:02 tom Exp $")
 
 extern char **environ;
 
@@ -135,15 +135,8 @@ CaselessCmp(const char *a, const char *b) /* strcasecmp isn't portable */
 }
 
 #if !HAVE_STRDUP
-static char *strdup (char *s)
-{
-  char *p;
-
-  p = malloc(strlen(s)+1);
-  if (p)
-    strcpy(p,s);
-  return(p);
-}
+#define strdup _nc_strdup
+extern char *_nc_strdup(const char *);
 #endif /* not HAVE_STRDUP */
 
 static void
@@ -246,7 +239,7 @@ typedef struct map {
        const char *porttype;   /* Port type, or "" for any. */
        const char *type;       /* Terminal type to select. */
        int conditional;        /* Baud rate conditionals bitmask. */
-       int speed;              /* Baud rate to compare against. */
+       speed_t speed;          /* Baud rate to compare against. */
 } MAP;
 
 static MAP *cur, *maplist;
@@ -340,7 +333,7 @@ add_mapping(const char *port, char *arg)
        char *base = 0;
 
        copy = strdup(arg);
-       mapp = malloc((u_int)sizeof(MAP));
+       mapp = malloc(sizeof(MAP));
        if (copy == 0 || mapp == 0)
                failed("malloc");
        mapp->next = 0;
@@ -585,22 +578,21 @@ found:    if ((p = getenv("TERMCAP")) != 0 && *p != '/') {
         * ttype now contains a pointer to the type of the terminal.
         * If the first character is '?', ask the user.
         */
-       if (ttype[0] == '?')
+       if (ttype[0] == '?') {
                if (ttype[1] != '\0')
                        ttype = askuser(ttype + 1);
                else
                        ttype = askuser(0);
-
+       }
        /* Find the terminfo entry.  If it doesn't exist, ask the user. */
-       while ((rval = setupterm(ttype, STDOUT_FILENO, &errret)) != OK) {
+       while ((rval = setupterm((NCURSES_CONST char *)ttype, STDOUT_FILENO, &errret)) != OK) {
                if (errret == 0) {
                        (void)fprintf(stderr, "tset: unknown terminal type %s\n",
                            ttype);
                        ttype = 0;
                }
                else {
-                       (void)fprintf(stderr, "tset: can't initialize terminal\
-                           type %s (error %d)\n", ttype, errret);
+                       (void)fprintf(stderr, "tset: can't initialize terminal type %s (error %d)\n", ttype, errret);
                        ttype = 0;
                }
                ttype = askuser(ttype);
@@ -965,10 +957,10 @@ set_tabs()
  * Tell the user if a control key has been changed from the default value.
  */
 static void
-report(const char *name, int which, u_int def)
+report(const char *name, int which, unsigned def)
 {
 #ifdef TERMIOS
-       u_int older, newer;
+       unsigned older, newer;
        char *p;
 
        newer = mode.c_cc[which];
@@ -986,7 +978,7 @@ report(const char *name, int which, u_int def)
        if (newer == 0177)
                (void)fprintf(stderr, "delete.\n");
        else if ((p = key_backspace) != 0
-        && newer == (u_int)p[0]
+        && newer == (unsigned char)p[0]
         && p[1] == '\0')
                (void)fprintf(stderr, "backspace.\n");
        else if (newer < 040) {