summaryrefslogtreecommitdiff
path: root/app-text/pstotext/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-text/pstotext/files
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-text/pstotext/files')
-rw-r--r--app-text/pstotext/files/1.9-flags.patch36
-rw-r--r--app-text/pstotext/files/pstotext-1.9-quote-chars-fix.patch136
2 files changed, 172 insertions, 0 deletions
diff --git a/app-text/pstotext/files/1.9-flags.patch b/app-text/pstotext/files/1.9-flags.patch
new file mode 100644
index 000000000000..6f3c9b68d82c
--- /dev/null
+++ b/app-text/pstotext/files/1.9-flags.patch
@@ -0,0 +1,36 @@
+diff --git a/Makefile b/Makefile
+index 551e3b8..1d55ebe 100644
+--- a/Makefile
++++ b/Makefile
+@@ -9,7 +9,7 @@
+ # commenting out the includes of ptotdll.h in ptotdll.c and main.c.
+ # PMcJ 6 Sep 96
+
+-CC=gcc
++CC ?= gcc
+ #CC=cc -std
+
+ BUNDLE = ocr.h rot270.h rot90.h
+@@ -17,18 +17,18 @@ BUNDLE = ocr.h rot270.h rot90.h
+ all: pstotext
+
+ main.o: main.c ptotdll.h bundle.h ocr.h rot270.h rot90.h
+- $(CC) -c $*.c
++ $(CC) $(CFLAGS) -c $*.c
+
+ ptotdll.o: ptotdll.c ptotdll.h
+- $(CC) -c $*.c
++ $(CC) $(CFLAGS) -c $*.c
+
+ pstotext: bundle.o main.o ptotdll.o
+- $(CC) -o pstotext main.o bundle.o ptotdll.o -lm
++ $(CC) $(CFLAGS) $(LDFLAGS) -o pstotext main.o bundle.o ptotdll.o -lm
+
+ .SUFFIXES: .ps
+
+ .c.o:
+- $(CC) -c $*.c
++ $(CC) $(CFLAGS) -c $*.c
+
+ # "Bundle" an Ascii file.
+ .ps.h:
diff --git a/app-text/pstotext/files/pstotext-1.9-quote-chars-fix.patch b/app-text/pstotext/files/pstotext-1.9-quote-chars-fix.patch
new file mode 100644
index 000000000000..177d3726e659
--- /dev/null
+++ b/app-text/pstotext/files/pstotext-1.9-quote-chars-fix.patch
@@ -0,0 +1,136 @@
+diff -urN pstotext-1.9.orig/main.c pstotext-1.9/main.c
+--- pstotext-1.9.orig/main.c 2004-01-09 11:17:38.000000000 +0100
++++ pstotext-1.9/main.c 2006-05-19 11:43:52.000000000 +0200
+@@ -126,12 +126,14 @@
+ static int cleanup(void) {
+ int gsstatus, status = 0;
+ pstotextExit(instance);
+- if (gs!=NULL) {
+ #ifdef VMS
++ if (gs!=NULL) {
+ gsstatus = fclose(gs);
++ }
+ #else
+- gsstatus = pclose(gs);
++ waitpid(-1, &gsstatus, 0);
+ #endif
++ if (gsstatus) {
+ if (WIFEXITED(gsstatus)) {
+ if (WEXITSTATUS(gsstatus)!=0) status = 3;
+ else if (WIFSIGNALED(gsstatus)) status = 4;
+@@ -166,8 +168,13 @@
+
+ static int do_it(char *path) {
+ /* If "path" is NULL, then "stdin" should be processed. */
+- char *gs_cmdline;
+- char *input;
++ char *gs_argv[32];
++ int gs_argc=0;
++#ifdef DEBUG
++ int i;
++#endif
++ int fd[2];
++ pid_t p;
+ int status;
+ char norotate[] = "";
+ FILE *fileout;
+@@ -201,47 +208,31 @@
+ exit(1);
+ }
+
+- if (path==NULL) {
+- input = (char*)malloc(2);
+- if (input == NULL) {
+- fprintf(stderr,"No memory available\n");
+- cleanup();
+- exit(1);
+- }
+- strcpy(input, "-");
+- } else {
+- input = (char*)malloc(strlen(path) + 6);
+- if (input == NULL) {
+- fprintf(stderr,"No memory available\n");
+- cleanup();
+- exit(1);
+- }
+- strcpy(input, "-- '"); strcat(input, path); strcat(input, "'");
++ gs_argv[gs_argc++] = "gs";
++ gs_argv[gs_argc++] = "-r72";
++ gs_argv[gs_argc++] = "-dNODISPLAY";
++ gs_argv[gs_argc++] = "-dFIXEDMEDIA";
++ gs_argv[gs_argc++] = "-dDELAYBIND";
++ gs_argv[gs_argc++] = "-dWRITESYSTEMDICT";
++ if (!debug) {
++ gs_argv[gs_argc++] = "-q";
++ }
++ gs_argv[gs_argc++] = "-dNOPAUSE";
++ gs_argv[gs_argc++] = "-dSAFER";
++ if (rotate_path && strcmp(rotate_path, "")) {
++ gs_argv[gs_argc++] = rotate_path;
++ }
++ if (ocr_path && strcmp(ocr_path, "")) {
++ gs_argv[gs_argc++] = ocr_path;
++ }
++ if (path == NULL ) {
++ gs_argv[gs_argc++] = "-";
++ }
++ else {
++ gs_argv[gs_argc++] = "--";
++ gs_argv[gs_argc++] = path;
+ }
+-
+- gs_cmdline = (char*)malloc(strlen(gs_cmd)+strlen(rotate_path)+
+- strlen(ocr_path) + strlen(input) + 128);
+-
+- if (gs_cmdline == NULL) {
+- fprintf(stderr, "No memory available\n");
+- cleanup();
+- exit(1);
+- }
+-
+- sprintf(
+- gs_cmdline,
+-#ifdef VMS
+- "%s -r72 \"-dNODISPLAY\" \"-dFIXEDMEDIA\" \"-dDELAYBIND\" \"-dWRITESYSTEMDICT\" %s \"-dNOPAUSE\" %s %s %s",
+-#else
+- "%s -r72 -dNODISPLAY -dFIXEDMEDIA -dDELAYBIND -dWRITESYSTEMDICT %s -dNOPAUSE %s %s %s",
+-#endif
+- gs_cmd,
+- (debug ? "" : "-q"),
+- rotate_path,
+- ocr_path,
+- input
+- );
+- if (debug) fprintf(stderr, "%s\n", gs_cmdline);
++ gs_argv[gs_argc++] = NULL;
+ #ifdef VMS
+ cmdfile = tempnam("SYS$SCRATCH:","PS2TGS");
+ gsoutfile = tempnam("SYS$SCRATCH:","GSRES");
+@@ -259,8 +250,25 @@
+ exit(1);
+ }
+ #else
+- gs = popen(gs_cmdline, "r");
+- if (gs==0) {perror(cmd); exit(1);}
++ if (pipe(fd)) {
++ perror("pipe failed: "); exit(1);
++ };
++ p = fork();
++ if (p == -1) {
++ perror("fork failed: "); exit(1);
++ }
++ if (p == 0) { /* child */
++ close(fd[0]);
++ dup2(fd[1], 1); /* Redirect stdout into pipe to parent */
++ execvp("/usr/bin/gs", gs_argv);
++ perror("execvp: "); status=cleanup(); exit(1);
++ } else { /* parent */
++ close(fd[1]);
++ gs = fdopen(fd[0], "r");
++ if (gs == NULL) {
++ perror("fdopen: "); status=cleanup(); exit(1);
++ }
++ }
+ #endif
+ status = pstotextInit(&instance);
+ if (status!=0) {