version 1.42, 2014/05/20 01:25:23 |
version 1.43, 2015/01/16 06:40:07 |
|
|
* Materiel Command, USAF, under agreement number F39502-99-1-0512. |
* Materiel Command, USAF, under agreement number F39502-99-1-0512. |
*/ |
*/ |
|
|
#include <sys/param.h> |
|
#include <sys/stat.h> |
#include <sys/stat.h> |
|
|
#include <dirent.h> |
#include <dirent.h> |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
|
#include <limits.h> |
|
|
#include "diff.h" |
#include "diff.h" |
#include "xmalloc.h" |
#include "xmalloc.h" |
|
|
struct dirent *dent1, **dp1, **edp1, **dirp1 = NULL; |
struct dirent *dent1, **dp1, **edp1, **dirp1 = NULL; |
struct dirent *dent2, **dp2, **edp2, **dirp2 = NULL; |
struct dirent *dent2, **dp2, **edp2, **dirp2 = NULL; |
size_t dirlen1, dirlen2; |
size_t dirlen1, dirlen2; |
char path1[MAXPATHLEN], path2[MAXPATHLEN]; |
char path1[PATH_MAX], path2[PATH_MAX]; |
int pos; |
int pos; |
|
|
dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); |
dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); |
|
|
int flags) |
int flags) |
{ |
{ |
flags |= D_HEADER; |
flags |= D_HEADER; |
strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); |
strlcpy(path1 + plen1, dp->d_name, PATH_MAX - plen1); |
if (stat(path1, &stb1) != 0) { |
if (stat(path1, &stb1) != 0) { |
if (!(Nflag || Pflag) || errno != ENOENT) { |
if (!(Nflag || Pflag) || errno != ENOENT) { |
warn("%s", path1); |
warn("%s", path1); |
|
|
memset(&stb1, 0, sizeof(stb1)); |
memset(&stb1, 0, sizeof(stb1)); |
} |
} |
|
|
strlcpy(path2 + plen2, dp->d_name, MAXPATHLEN - plen2); |
strlcpy(path2 + plen2, dp->d_name, PATH_MAX - plen2); |
if (stat(path2, &stb2) != 0) { |
if (stat(path2, &stb2) != 0) { |
if (!Nflag || errno != ENOENT) { |
if (!Nflag || errno != ENOENT) { |
warn("%s", path2); |
warn("%s", path2); |