Subversion Repositories svn.Prod repos

Compare Revisions

Ignore whitespace Rev 52 → Rev 53

/filefind/C/Makefile
1,6 → 1,6
PRG=filefind
SRC=$(PRG).c
DIR=/var/tmp
DIR=/var/tmp/filefind_testdata
.PHONY: clean test cleantest
 
all: test
12,7 → 12,11
clean:
rm -f $(PRG)
 
test: $(PRG)
createtestdata:
mkdir -p $(DIR)
echo "bla" > $(DIR)/testfile
 
test: createtestdata $(PRG)
./$(PRG) $(DIR) > result
sort result > result.sort
find $(DIR) > result2
23,3 → 27,4
cleantest:
rm -f result result.sort
rm -f result2 result2.sort
rm -rf $(DIR)
/filefind/C/filefind.c
29,7 → 29,7
 
#include <errno.h>
 
#define PATH_MAX 255
#define PATH_MAX2 255
 
// ============================================================================
// Functions
45,19 → 45,19
 
void traverse(char *directory)
{
char curdir[PATH_MAX];
char curdir2[PATH_MAX];
char curdir[PATH_MAX2];
char curdir2[PATH_MAX2];
 
getcwd(curdir, PATH_MAX);
getcwd(curdir, PATH_MAX2);
chdir(directory);
getcwd(curdir2, PATH_MAX);
getcwd(curdir2, PATH_MAX2);
 
DIR *dir = NULL;
struct dirent entry;
struct dirent *entryPtr = NULL;
int retval = 0;
char pathName[PATH_MAX + 1];
char pfile[PATH_MAX + 1];
char pathName[PATH_MAX2 + 1];
char pfile[PATH_MAX2 + 1];
 
/* Open the given directory, if you can. */
dir = opendir(curdir2);
70,8 → 70,8
{
struct stat entryInfo;
if( ( ! strncmp( entry.d_name, ".", PATH_MAX ) == 0 ) &&
( ! strncmp( entry.d_name, "..", PATH_MAX ) == 0 ) )
if( ( ! strncmp( entry.d_name, ".", PATH_MAX2 ) == 0 ) &&
( ! strncmp( entry.d_name, "..", PATH_MAX2 ) == 0 ) )
{
sprintf(pfile,"%s/%s", curdir2, entry.d_name);
if (isdir(entry.d_name) && ! issymlink(entry.d_name))