summarylogtreecommitdiffstats
path: root/02-errors-to-stderr.patch
blob: a1e447259d510a4674da8bae3793a6ba86bce287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
From: Roland Stigge <stigge@antcom.de>
Date: Sun, 10 Jul 2011 12:19:43 +0200
Subject: errors to stderr

This patch redirects error messages to stderr.
I.e., send error messages to standard error even when diagnostic
messages, on stream diag, are being sent to standard output.

Bug-Debian: http://bugs.debian.org/551125
---
 src/pstoedit.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/pstoedit.cpp b/src/pstoedit.cpp
index d3b8fd5..d36f52b 100644
--- a/src/pstoedit.cpp
+++ b/src/pstoedit.cpp
@@ -420,7 +420,7 @@ extern "C" DLLEXPORT
 		break;
 			}
 	default:{
-		diag << "more than two file arguments " << endl;
+		errstream << "more than two file arguments " << endl;
 		shortusage(diag);
 		return 1;
 			}
@@ -506,7 +506,7 @@ extern "C" DLLEXPORT
 		usage(diag,false,false);
 		const char *gstocall = whichPI(diag, options.verbose(), options.gsregbase.value.c_str(),options.GSToUse.value.c_str());
 		if (gstocall != 0) {
-			diag << "Default interpreter is " << gstocall << endl;
+			errstream << "Default interpreter is " << gstocall << endl;
 		}
 		getglobalRp()->explainformats(diag);
 		return 1;
@@ -589,13 +589,13 @@ To get the pre 8.00 behaviour, either use -dNOEPS or run the file with (filename
 	if (options.drivername.value.length() == 0) {
 		// try to find driver according to suffix of input file
 		if (!options.nameOfOutputFile) {
-			diag << "No output format specified (-f option) and format could not be deduced from suffix of output file since no output file name was given" << endl;
+			errstream << "No output format specified (-f option) and format could not be deduced from suffix of output file since no output file name was given" << endl;
 			shortusage(diag);
 			return 1;
 		} else {
 			const char * suffixOfInputFile = strrchr(options.nameOfOutputFile,'.');
 			if (!suffixOfInputFile) {
-				diag << "No output format specified (-f option) and format could not be deduced from suffix of output file since no suffix was found" << endl;
+				errstream << "No output format specified (-f option) and format could not be deduced from suffix of output file since no suffix was found" << endl;
 				shortusage(diag);
 				return 1;
 			} else {
@@ -604,7 +604,7 @@ To get the pre 8.00 behaviour, either use -dNOEPS or run the file with (filename
 					errstream << "No explicit output format specified - using " << suffixDriverDesc->symbolicname << " as derived from suffix of output file" << endl;
 					options.drivername = suffixDriverDesc->symbolicname;
 				} else {
-					diag << "No output format specified (-f option) and format could not be uniquely deduced from suffix " << suffixOfInputFile << " of output file" << endl;
+					errstream << "No output format specified (-f option) and format could not be uniquely deduced from suffix " << suffixOfInputFile << " of output file" << endl;
 					// usage(errstream);
 					getglobalRp()->explainformats(diag); // ,true);
 					return 1;
@@ -623,13 +623,13 @@ To get the pre 8.00 behaviour, either use -dNOEPS or run the file with (filename
 		}
 		const DriverDescription *currentDriverDesc = getglobalRp()->getDriverDescForName(options.drivername.value.c_str());
 		if (currentDriverDesc == 0) {
-			diag << "Unsupported output format " << options.drivername.value.c_str() << endl;
+			errstream << "Unsupported output format " << options.drivername.value.c_str() << endl;
 			getglobalRp()->explainformats(diag);
 			return 1;
 		}
 
 		if ( currentDriverDesc->backendFileOpenType!=DriverDescription::normalopen && !options.nameOfOutputFile ) {
-			diag << "The driver for the selected format cannot write to standard output because it writes binary data" << endl;
+			errstream << "The driver for the selected format cannot write to standard output because it writes binary data" << endl;
 			return 1;
 		}
 
@@ -637,7 +637,7 @@ To get the pre 8.00 behaviour, either use -dNOEPS or run the file with (filename
 		if (driveroptions && strequal(driveroptions, "-help") ) {
 			ProgramOptions* dummy = currentDriverDesc->createDriverOptions();
 			if (dummy->numberOfOptions() ) {
-				diag << "The driver for this output format supports the following additional options: (specify using -f \"format:-option1 -option2\")" << endl;
+				errstream << "The driver for this output format supports the following additional options: (specify using -f \"format:-option1 -option2\")" << endl;
 				dummy->showhelp(diag,false,false);
 			}
 			delete dummy;
@@ -647,7 +647,7 @@ To get the pre 8.00 behaviour, either use -dNOEPS or run the file with (filename
 // TODO:
 			// Check for input file (exists, or stdin) stdout handling
 			if (!options.nameOfInputFile) {
-				diag << "Cannot read from standard input if GS drivers are selected" << endl;
+				errstream << "Cannot read from standard input if GS drivers are selected" << endl;
 				return 1;
 			}
 			// an input file was given as argument
@@ -658,23 +658,23 @@ To get the pre 8.00 behaviour, either use -dNOEPS or run the file with (filename
 			convertBackSlashes(options.nameOfInputFile);
 
 			if (!fileExists(options.nameOfInputFile)) {
-				diag << "Could not open file " << options.nameOfInputFile << " for input" << endl;
+				errstream << "Could not open file " << options.nameOfInputFile << " for input" << endl;
 				return 1;
 			}
 
 			if (!options.nameOfOutputFile) {
-				diag <<
+				errstream <<
 					"Cannot write to standard output if GS drivers are selected" << endl;
 				return 1;
 			}
 
 			if (options.backendonly) {
-				diag << "The -bo option cannot be used if GS drivers are selected " << endl;
+				errstream << "The -bo option cannot be used if GS drivers are selected " << endl;
 				return 1;
 			}
 
 			if (!driveroptions) {
-				diag <<
+				errstream <<
 					"The gs output driver needs a gs-device as argument, e.g. gs:pdfwrite" << endl;
 				return 1;
 			}