summaryrefslogtreecommitdiff
path: root/Build/source/texk/psutils/psutils-1.21-PATCHES/patch-10-binary-mode
blob: ddb38186dc241e1b7db5edcce743426fcc4d3199 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
diff -ur psutils-1.21.orig/epsffit.c psutils-1.21/epsffit.c
--- psutils-1.21.orig/epsffit.c	2013-10-21 23:28:08.000000000 +0200
+++ psutils-1.21/epsffit.c	2013-10-25 13:06:05.000000000 +0200
@@ -17,7 +17,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 #include "psutil.h"
 
@@ -37,6 +39,9 @@
    FILE *output = stdout;
    int opt;
 
+   SET_BINARY(stdin);
+   SET_BINARY(stdout);
+
    program = *argv;
 
    while((opt = getopt(argc, argv, "csramv")) != EOF) {
diff -ur psutils-1.21.orig/psbook.c psutils-1.21/psbook.c
--- psutils-1.21.orig/psbook.c	2013-10-21 23:28:08.000000000 +0200
+++ psutils-1.21/psbook.c	2013-10-25 13:06:05.000000000 +0200
@@ -7,9 +7,9 @@
  */
 
 #include "config.h"
-
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-
+#endif
 #include "psutil.h"
 
 const char *syntax = "[-q] [-sSIGNATURE] [INFILE [OUTFILE]]\n       SIGNATURE must be positive and divisible by 4\n";
@@ -23,6 +23,9 @@
    int currentpg, maxpage;
    int opt;
 
+   SET_BINARY(stdin);
+   SET_BINARY(stdout);
+
    verbose = 1;
    program = *argv;
 
diff -ur psutils-1.21.orig/psnup.c psutils-1.21/psnup.c
--- psutils-1.21.orig/psnup.c	2013-10-21 23:28:08.000000000 +0200
+++ psutils-1.21/psnup.c	2013-10-25 13:06:05.000000000 +0200
@@ -7,8 +7,9 @@
  */
 
 #include "config.h"
-
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <string.h>
 #include <paper.h>
 
@@ -49,6 +50,9 @@
    int opt;
    const struct paper *paper = NULL;
 
+   SET_BINARY(stdin);
+   SET_BINARY(stdout);
+
    set_paper_size(NULL);
 
    margin = border = vshift = hshift = column = flip = 0;
diff -ur psutils-1.21.orig/psresize.c psutils-1.21/psresize.c
--- psutils-1.21.orig/psresize.c	2013-10-21 23:28:08.000000000 +0200
+++ psutils-1.21/psresize.c	2013-10-25 13:06:05.000000000 +0200
@@ -7,8 +7,9 @@
  */
 
 #include "config.h"
-
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <paper.h>
 
 #include "psutil.h"
@@ -32,6 +33,9 @@
    int opt;
    const struct paper *paper = NULL;
 
+   SET_BINARY(stdin);
+   SET_BINARY(stdout);
+
    set_paper_size(NULL);
 
    vshift = hshift = 0;
diff -ur psutils-1.21.orig/psselect.c psutils-1.21/psselect.c
--- psutils-1.21.orig/psselect.c	2013-10-21 23:28:08.000000000 +0200
+++ psutils-1.21/psselect.c	2013-10-25 13:06:05.000000000 +0200
@@ -7,9 +7,9 @@
  */
 
 #include "config.h"
-
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-
+#endif
 #include "psutil.h"
 
 const char *syntax = "[-q] [-e] [-o] [-r] [-pPAGES] [INFILE [OUTFILE]]\n";
@@ -88,6 +88,9 @@
    int pass, all;
    PageRange *pagerange = NULL;
 
+   SET_BINARY(stdin);
+   SET_BINARY(stdout);
+
    verbose = 1;
    program = *argv;
 
diff -ur psutils-1.21.orig/pstops.c psutils-1.21/pstops.c
--- psutils-1.21.orig/pstops.c	2013-10-21 23:28:08.000000000 +0200
+++ psutils-1.21/pstops.c	2013-10-25 13:06:05.000000000 +0200
@@ -7,8 +7,9 @@
  */
 
 #include "config.h"
-
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <string.h>
 #include <paper.h>
 
@@ -107,6 +108,9 @@
    const struct paper *paper = NULL;
    int opt;
 
+   SET_BINARY(stdin);
+   SET_BINARY(stdout);
+
    set_paper_size(NULL);
 
    verbose = 1;
diff -ur psutils-1.21.orig/psutil.h psutils-1.21/psutil.h
--- psutils-1.21.orig/psutil.h	2013-10-21 23:28:08.000000000 +0200
+++ psutils-1.21/psutil.h	2013-10-25 13:06:05.000000000 +0200
@@ -21,6 +21,15 @@
 #define WARN		(MESSAGE_NL|MESSAGE_PROGRAM)
 #define LOG		0
 
+/* change mode of a file pointer on Windows */
+#if defined(WIN32)
+#include <io.h>
+#include <fcntl.h>
+#define SET_BINARY(fp) (void)_setmode(fileno(fp), _O_BINARY)
+#else /* !WIN32 */
+#define SET_BINARY(fp) (void)0
+#endif
+
 /* Definitions for functions found in psutil.c */
 extern void usage(void);
 extern void message(int flags, const char *format, ...);