]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/read_termcap.c
ncurses 5.9 - patch 20110604
[ncurses.git] / ncurses / tinfo / read_termcap.c
index d94d1a42466d8e612c77519e08882576cf0a3e48..eac37fa3d5d164e6d4af0a21b7f3a8f491bc0ea5 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2011 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            *
 
 #include <ctype.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <tic.h>
-#include <term_entry.h>
 
-MODULE_ID("$Id: read_termcap.c,v 1.71 2006/07/29 12:06:51 tom Exp $")
+MODULE_ID("$Id: read_termcap.c,v 1.76 2011/06/05 00:48:00 tom Exp $")
 
 #if !PURE_TERMINFO
 
@@ -79,6 +77,15 @@ get_termpath(void)
     return result;
 }
 
+/*
+ * Note:
+ * getcap(), cgetent(), etc., are BSD functions.  A copy of those was added to
+ * this file in November 1995, derived from the BSD4.4 Lite sources.
+ *
+ * The initial adaptation uses 518 lines from that source.
+ * The current source (in 2009) uses 183 lines of BSD4.4 Lite (441 ignoring
+ * whitespace).
+ */
 #if USE_GETCAP
 
 #if HAVE_BSD_CGETENT
@@ -107,11 +114,7 @@ static int _nc_nfcmp(const char *, char *);
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgment:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -1059,7 +1062,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp)
     for (j = 0; j < filecount; j++) {
        bool omit = FALSE;
        if (stat(termpaths[j], &test_stat[j]) != 0
-           || (test_stat[j].st_mode & S_IFMT) != S_IFREG) {
+           || !S_ISREG(test_stat[j].st_mode)) {
            omit = TRUE;
        } else {
            for (k = 0; k < j; k++) {