From 083f8ce16f81f2b8c4648d21f766ec3ed0e8e97d Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 16 Apr 2024 10:19:00 +0000 Subject: [PATCH] remove unused functions; ok tb@ --- usr.bin/less/filename.c | 79 ----------------------------------------- 1 file changed, 79 deletions(-) diff --git a/usr.bin/less/filename.c b/usr.bin/less/filename.c index 0aaecac6197..0f5e1840a4e 100644 --- a/usr.bin/less/filename.c +++ b/usr.bin/less/filename.c @@ -378,85 +378,6 @@ bin_file(int f) return (bin_count > 5); } -/* - * Read a string from a file. - * Return a pointer to the string in memory. - */ -static char * -readfd(FILE *fd) -{ - int len; - int ch; - char *buf; - char *p; - - /* - * Make a guess about how many chars in the string - * and allocate a buffer to hold it. - */ - len = 100; - buf = ecalloc(len, sizeof (char)); - for (p = buf; ; p++) { - if ((ch = getc(fd)) == '\n' || ch == EOF) - break; - if (p >= buf + len-1) { - /* - * The string is too big to fit in the buffer we have. - * Allocate a new buffer, twice as big. - */ - len *= 2; - *p = '\0'; - p = ecalloc(len, sizeof (char)); - strlcpy(p, buf, len); - free(buf); - buf = p; - p = buf + strlen(buf); - } - *p = (char)ch; - } - *p = '\0'; - return (buf); -} - -/* - * Execute a shell command. - * Return a pointer to a pipe connected to the shell command's standard output. - */ -static FILE * -shellcmd(char *cmd) -{ - FILE *fd; - - char *shell; - - shell = lgetenv("SHELL"); - if (shell != NULL && *shell != '\0') { - char *scmd; - char *esccmd; - - /* - * Read the output of <$SHELL -c cmd>. - * Escape any metacharacters in the command. - */ - esccmd = shell_quote(cmd); - if (esccmd == NULL) { - fd = popen(cmd, "r"); - } else { - scmd = easprintf("%s -c %s", shell, esccmd); - free(esccmd); - fd = popen(scmd, "r"); - free(scmd); - } - } else { - fd = popen(cmd, "r"); - } - /* - * Redirection in `popen' might have messed with the - * standard devices. Restore binary input mode. - */ - return (fd); -} - /* * Expand a filename, doing any system-specific metacharacter substitutions. */ -- 2.20.1