aboutsummaryrefslogtreecommitdiff
path: root/filename.c
diff options
context:
space:
mode:
Diffstat (limited to 'filename.c')
-rw-r--r--filename.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/filename.c b/filename.c
index 983a02b0e062..7c3ccd2e97a5 100644
--- a/filename.c
+++ b/filename.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2017 Mark Nudelman
+ * Copyright (C) 1984-2019 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -98,7 +98,7 @@ shell_unquote(str)
* Get the shell's escape character.
*/
public char *
-get_meta_escape()
+get_meta_escape(VOID_PARAM)
{
char *s;
@@ -112,7 +112,7 @@ get_meta_escape()
* Get the characters which the shell considers to be "metacharacters".
*/
static char *
-metachars()
+metachars(VOID_PARAM)
{
static char *mchars = NULL;
@@ -561,8 +561,6 @@ readfd(fd)
#if HAVE_POPEN
-FILE *popen();
-
/*
* Execute a shell command.
* Return a pointer to a pipe connected to the shell command's standard output.
@@ -577,7 +575,7 @@ shellcmd(cmd)
char *shell;
shell = lgetenv("SHELL");
- if (shell != NULL && *shell != '\0')
+ if (!isnullenv(shell))
{
char *scmd;
char *esccmd;
@@ -754,7 +752,7 @@ lglob(filename)
return (filename);
}
lessecho = lgetenv("LESSECHO");
- if (lessecho == NULL || *lessecho == '\0')
+ if (isnullenv(lessecho))
lessecho = "lessecho";
/*
* Invoke lessecho, and read its output (a globbed list of filenames).
@@ -781,7 +779,7 @@ lglob(filename)
if (*gfilename == '\0')
{
free(gfilename);
- return (save(filename));
+ return (filename);
}
}
#else
@@ -797,6 +795,21 @@ lglob(filename)
}
/*
+ * @@@
+ */
+ public char *
+lrealpath(path)
+ char *path;
+{
+#if HAVE_REALPATH
+ char rpath[PATH_MAX];
+ if (realpath(path, rpath) != NULL)
+ return (save(rpath));
+#endif
+ return (save(path));
+}
+
+/*
* Return number of %s escapes in a string.
* Return a large number if there are any other % escapes besides %s.
*/
@@ -1080,7 +1093,7 @@ filesize(f)
*
*/
public char *
-shell_coption()
+shell_coption(VOID_PARAM)
{
return ("-c");
}