VirtualBox

Changeset 1309 in kBuild for trunk/src/kmk/kmkbuiltin/cp_utils.c


Ignore:
Timestamp:
Dec 2, 2007 4:53:40 AM (17 years ago)
Author:
bird
Message:

combined the bulk of the cmp stuff into cmp_util.c. implemented cp --changed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/kmkbuiltin/cp_utils.c

    r1192 r1309  
    5454#include <sysexits.h>
    5555#include <unistd.h>
    56 
    5756#ifdef __sun__
    5857# include "solfakes.h"
    5958#endif
    6059#ifdef _MSC_VER
     60# define MSC_DO_64_BIT_IO
    6161# include "mscfakes.h"
    6262#endif
    63 
    6463#include "cp_extern.h"
     64#include "cmp_extern.h"
     65
    6566#define cp_pct(x,y)     (int)(100.0 * (double)(x) / (double)(y))
    6667
     
    7677#endif
    7778
    78 int
    79 copy_file(const FTSENT *entp, int dne)
     79
     80int
     81copy_file(const FTSENT *entp, int dne, int changed_only, int *pcopied)
    8082{
    8183        static char buf[MAXBSIZE];
     
    9092#endif
    9193
     94        *pcopied = 0;
     95
    9296        if ((from_fd = open(entp->fts_path, O_RDONLY | O_BINARY, 0)) == -1) {
    9397                warn("%s", entp->fts_path);
     
    106110         */
    107111        if (!dne) {
     112                /* compare the files first if requested */
     113                if (    changed_only
     114                    &&  cmp_fd_and_file(from_fd, entp->fts_path, to.p_path,
     115                                        1 /* silent */, 0 /* lflag */,
     116                                        0 /* special */)
     117                        == OK_EXIT) {
     118                        return (0);
     119                }
     120
    108121#define YESNO "(y/n [n]) "
    109122                if (nflag) {
     
    144157
    145158        rval = 0;
     159        *pcopied = 1;
    146160
    147161        /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette