Ignore:
Timestamp:
Dec 18, 2005, 4:48:02 AM (20 years ago)
Author:
bird
Message:

o Ported all kmk builtins to win32.
o Fixed serveral bugs in kmk builtins.
o Probably broke both linux, bsd and OS/2. :-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/kmkbuiltin/append.c

    r348 r370  
    2727#include <string.h>
    2828#include <stdio.h>
    29 #include <errno.h>
     29#include "err.h"
    3030#include "kmkbuiltin.h"
    3131
     
    3838    FILE *pFile;
    3939
     40    g_progname = argv[0];
     41
    4042    /*
    4143     * Open the output file.
     
    4345    if (argc <= 1)
    4446    {
    45         fprintf(stderr, "append: missing filename!\n");
     47        errx(1, "missing filename!");
    4648        fprintf(stderr, "usage: append file [string ...]\n");
    4749        return 1;
     
    4951    pFile = fopen(argv[1], "a");
    5052    if (!pFile)
    51     {
    52         fprintf(stderr, "append: failed to open '%s': %s\n", argv[1], strerror(errno));
    53         return 1;
    54     }
     53        return err(1, "failed to open '%s'.", argv[1]);
    5554
    5655    /*
     
    7271        ||  ferror(pFile))
    7372    {
    74         fprintf(stderr, "append: error writing to '%s'!\n", argv[1]);
    7573        fclose(pFile);
    76         return 1;
     74        return errx(1, "error writing to '%s'!", argv[1]);
    7775    }
    7876    if (fclose(pFile))
    79     {
    80         fprintf(stderr, "append: failed to fclose '%s': %s\n", argv[1], strerror(errno));
    81         return 1;
    82     }
     77        return err(1, "failed to fclose '%s'!", argv[1]);
    8378    return 0;
    8479}
Note: See TracChangeset for help on using the changeset viewer.