+#define MAXPATHS 32
+
+/*
+ * Add a filename to the list in 'termpaths[]', checking that we really have
+ * a right to open the file.
+ */
+#if !USE_GETCAP
+static int add_tc(char *termpaths[], char *path, int count)
+{
+ if (count < MAXPATHS
+ && _nc_access(path, R_OK) == 0)
+ termpaths[count++] = path;
+ termpaths[count] = 0;
+ return count;
+}
+#define ADD_TC(path, count) filecount = add_tc(termpaths, path, count)
+#endif /* !USE_GETCAP */
+