Changeset 1311
- Timestamp:
- Mar 16, 2004, 3:27:56 AM (21 years ago)
- Location:
- trunk/src/emx/src/gencat
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/gencat/gencat.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1310 r1311 37 37 #include <sys/stat.h> 38 38 #include <err.h> 39 #ifndef __EMX__ 39 40 #include <paths.h> 41 #endif 40 42 #include <stdio.h> 41 43 #include <stdlib.h> … … 106 108 catfile = argv[i]; 107 109 if (new) { 110 #ifndef __EMX__ 108 111 if ((ofd = open(catfile, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0) 112 #else 113 if ((ofd = open(catfile, O_WRONLY|O_TRUNC|O_CREAT|O_BINARY, 0666)) < 0) 114 #endif 109 115 errx(1, "unable to create a new %s", catfile); 116 #ifndef __EMX__ 110 117 } else if ((ofd = open(catfile, O_RDONLY)) < 0) { 111 118 if ((ofd = open(catfile, O_WRONLY|O_CREAT, 0666)) < 0) 119 #else 120 } else if ((ofd = open(catfile, O_RDONLY|O_BINARY)) < 0) { 121 if ((ofd = open(catfile, O_WRONLY|O_CREAT|O_BINARY, 0666)) < 0) 122 #endif 112 123 errx(1, "unable to create %s", catfile); 113 124 } else { 114 125 MCReadCat(ofd); 115 126 close(ofd); 127 #ifndef __EMX__ 116 128 if ((ofd = open(catfile, O_WRONLY|O_TRUNC)) < 0) 129 #else 130 if ((ofd = open(catfile, O_WRONLY|O_TRUNC|O_BINARY)) < 0) 131 #endif 117 132 errx(1, "unable to truncate %s", catfile); 118 133 } 119 134 } else { 120 135 input = argv[i]; 136 #ifndef __EMX__ 121 137 if ((ifd = open(input, O_RDONLY)) < 0) 138 #else 139 if ((ifd = open(input, O_RDONLY|O_TEXT)) < 0) 140 #endif 122 141 errx(1, "unable to read %s", input); 123 142 MCParse(ifd); … … 138 157 writeIfChanged(char *fname, int lang, int orConsts) 139 158 { 159 #ifndef __EMX__ 140 160 char tmpname[] = _PATH_TMP"/gencat.XXXXXX"; 161 #else 162 char tmpname[_MAX_PATH]; 163 char * tmp; 164 #endif 141 165 char buf[BUFSIZ], tbuf[BUFSIZ], *cptr, *tptr; 142 166 int fd, tfd; … … 144 168 int len, tlen; 145 169 struct stat sbuf; 170 #ifdef __EMX__ 171 /* setup tmpname */ 172 tmp = getenv("TMP"); 173 if (!tmp) 174 tmp = getenv("TMPDIR"); 175 if (!tmp) 176 tmp = getenv("TEMP"); 177 if (!tmp) 178 tmp = "/tmp"; 179 strcat(strcpy(tmpname, tmp), "/gencat.XXXXX"); 180 #endif 146 181 147 182 /* If it doesn't exist, just create it */ 148 183 if (stat(fname, &sbuf)) { 184 #ifndef __EMX__ 149 185 if ((fd = open(fname, O_WRONLY|O_CREAT, 0666)) < 0) 186 #else 187 if ((fd = open(fname, O_WRONLY|O_CREAT|O_BINARY, 0666)) < 0) 188 #endif 150 189 errx(1, "unable to create header file %s", fname); 151 190 MCWriteConst(fd, lang, orConsts); … … 163 202 164 203 /* Open the real header file */ 204 #ifndef __EMX__ 165 205 if ((fd = open(fname, O_RDONLY)) < 0) 206 #else 207 if ((fd = open(fname, O_RDONLY | O_BINARY)) < 0) 208 #endif 166 209 errx(1, "unable to read header file: %s", fname); 167 210 … … 188 231 errx(1, "unable to seek in tempfile: %s", tmpname); 189 232 close(fd); 233 #ifndef __EMX__ 190 234 if ((fd = open(fname, O_WRONLY|O_TRUNC)) < 0) 235 #else 236 if ((fd = open(fname, O_WRONLY|O_TRUNC|O_BINARY)) < 0) 237 #endif 191 238 errx(1, "unable to truncate header file: %s", fname); 192 239 while ((len = read(tfd, buf, BUFSIZ)) > 0) { -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/gencat/genlib.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1310 r1311 40 40 #include <string.h> 41 41 #include <unistd.h> 42 #ifndef __EMX__ 42 43 #include "msgcat.h" 44 #else 45 #include "../lib/bsd/nls/msgcat.h" 46 #endif 43 47 #include "gencat.h" 44 48 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.