Changeset 1311


Ignore:
Timestamp:
Mar 16, 2004, 3:27:56 AM (21 years ago)
Author:
bird
Message:

Initial port.

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 to 1.2
    r1310 r1311  
    3737#include <sys/stat.h>
    3838#include <err.h>
     39#ifndef __EMX__
    3940#include <paths.h>
     41#endif
    4042#include <stdio.h>
    4143#include <stdlib.h>
     
    106108                catfile = argv[i];
    107109                if (new) {
     110#ifndef __EMX__
    108111                    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
    109115                                errx(1, "unable to create a new %s", catfile);
     116#ifndef __EMX__
    110117                } else if ((ofd = open(catfile, O_RDONLY)) < 0) {
    111118                    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
    112123                                errx(1, "unable to create %s", catfile);
    113124                } else {
    114125                    MCReadCat(ofd);
    115126                    close(ofd);
     127#ifndef __EMX__
    116128                    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
    117132                                errx(1, "unable to truncate %s", catfile);
    118133                }
    119134            } else {
    120135                input = argv[i];
     136#ifndef __EMX__
    121137                if ((ifd = open(input, O_RDONLY)) < 0)
     138#else
     139                if ((ifd = open(input, O_RDONLY|O_TEXT)) < 0)
     140#endif
    122141                    errx(1, "unable to read %s", input);
    123142                MCParse(ifd);
     
    138157writeIfChanged(char *fname, int lang, int orConsts)
    139158{
     159#ifndef __EMX__
    140160    char        tmpname[] = _PATH_TMP"/gencat.XXXXXX";
     161#else
     162    char        tmpname[_MAX_PATH];
     163    char *      tmp;
     164#endif
    141165    char        buf[BUFSIZ], tbuf[BUFSIZ], *cptr, *tptr;
    142166    int         fd, tfd;
     
    144168    int         len, tlen;
    145169    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
    146181
    147182    /* If it doesn't exist, just create it */
    148183    if (stat(fname, &sbuf)) {
     184#ifndef __EMX__
    149185        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
    150189            errx(1, "unable to create header file %s", fname);
    151190        MCWriteConst(fd, lang, orConsts);
     
    163202
    164203    /* Open the real header file */
     204#ifndef __EMX__
    165205    if ((fd = open(fname, O_RDONLY)) < 0)
     206#else
     207    if ((fd = open(fname, O_RDONLY | O_BINARY)) < 0)
     208#endif
    166209                errx(1, "unable to read header file: %s", fname);
    167210
     
    188231            errx(1, "unable to seek in tempfile: %s", tmpname);
    189232        close(fd);
     233#ifndef __EMX__
    190234        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
    191238            errx(1, "unable to truncate header file: %s", fname);
    192239        while ((len = read(tfd, buf, BUFSIZ)) > 0) {
  • trunk/src/emx/src/gencat/genlib.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1310 r1311  
    4040#include <string.h>
    4141#include <unistd.h>
     42#ifndef __EMX__
    4243#include "msgcat.h"
     44#else
     45#include "../lib/bsd/nls/msgcat.h"
     46#endif
    4347#include "gencat.h"
    4448
Note: See TracChangeset for help on using the changeset viewer.