From ca9627e70852f6b2e835660df870fe3ab405882d Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 1 Sep 2019 00:00:32 +0200 Subject: Initial import --- app-text/a2ps/files/a2ps-4.13-select-freebsd.patch | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 app-text/a2ps/files/a2ps-4.13-select-freebsd.patch (limited to 'app-text/a2ps/files/a2ps-4.13-select-freebsd.patch') diff --git a/app-text/a2ps/files/a2ps-4.13-select-freebsd.patch b/app-text/a2ps/files/a2ps-4.13-select-freebsd.patch new file mode 100644 index 0000000..a2c3889 --- /dev/null +++ b/app-text/a2ps/files/a2ps-4.13-select-freebsd.patch @@ -0,0 +1,57 @@ +--- src/select.c.orig Thu Dec 16 02:04:56 1999 ++++ src/select.c Sat Aug 21 12:05:31 2004 +@@ -131,6 +131,36 @@ + return 1; + } + ++/* escapes the name of a file so that the shell groks it in 'single' q.marks. ++ The resulting pointer has to be free()ed when not longer used. */ ++char * ++shell_escape(const char *fn) ++{ ++ size_t len = 0; ++ const char *inp; ++ char *retval, *outp; ++ ++ for(inp = fn; *inp; ++inp) ++ switch(*inp) ++ { ++ case '\'': len += 4; break; ++ default: len += 1; break; ++ } ++ ++ outp = retval = malloc(len + 1); ++ if(!outp) ++ return NULL; /* perhaps one should do better error handling here */ ++ for(inp = fn; *inp; ++inp) ++ switch(*inp) ++ { ++ case '\'': *outp++ = '\''; *outp++ = '\\'; *outp++ = '\'', *outp++ = '\''; break; ++ default: *outp++ = *inp; break; ++ } ++ *outp = 0; ++ ++ return retval; ++} ++ + /* What says file about the type of a file (result is malloc'd). NULL + if could not be run. */ + +@@ -144,11 +174,15 @@ + if (IS_EMPTY (job->file_command)) + return NULL; + ++ filename = shell_escape(filename); ++ if(filename == NULL) ++ return NULL; + /* Call file(1) with the correct option */ +- command = ALLOCA (char, (2 ++ command = ALLOCA (char, (4 + + strlen (job->file_command) + + ustrlen (filename))); +- sprintf (command, "%s %s", job->file_command, (const char *) filename); ++ sprintf (command, "%s '%s'", job->file_command, (const char *) filename); ++ free(filename); + message (msg_tool, (stderr, "Reading pipe: `%s'\n", command)); + file_out = popen (command, "r"); + -- cgit v1.2.3