char *df;
int i;
- if (filename == 0 || _USE_LFN)
+ if (filename == NULL || _USE_LFN)
return filename;
/* FIXME: what about filenames which violate
8+3 constraints, like "config.h.in", or ".emacs"? */
- if (strpbrk (filename, "\"*+,;<=>?[\\]|") != 0)
+ if (strpbrk (filename, "\"*+,;<=>?[\\]|") != NULL)
return filename;
df = dos_filename;
++filename;
if (*filename == '.')
return filename;
- *df = 0;
+ *df = '\0';
return dos_filename;
}
#endif /* __MSDOS__ */
static PATH_VAR (new_filename);
char *df;
- if (filename == 0)
- return 0;
+ if (filename == NULL)
+ return NULL;
df = new_filename;
while (*filename != '\0')
++filename;
}
- *df = 0;
+ *df = '\0';
return new_filename;
}
DIR *dir;
dir = opendir (name);
- if (dir == 0)
+ if (dir == NULL)
return -1;
closedir (dir);
s = strchr (name, ':'); /* find device */
if (s)
{
/* to keep the compiler happy we said "const char *name", now we cheat */
- *s++ = 0;
+ *s++ = '\0';
st->st_dev = (char *)vms_hash (name);
h = vms_hash (s);
*(s-1) = ':';
{
--open_directories;
closedir (dc->dirstream);
- dc->dirstream = 0;
+ dc->dirstream = NULL;
}
- hash_free (&dc->dirfiles, 1);
+ if (dc->dirfiles.ht_vec != NULL)
+ hash_free (&dc->dirfiles, 1);
return NULL;
}
dc->counter = command_count;
ENULLLOOP (dc->dirstream, opendir (name));
- if (dc->dirstream == 0)
- /* Couldn't open the directory. Mark this by setting the
- 'files' member to a nil pointer. */
- dc->dirfiles.ht_vec = 0;
+ if (dc->dirstream == NULL)
+ /* Couldn't open the directory: mark this by setting files to NULL. */
+ dc->dirfiles.ht_vec = NULL;
else
{
hash_init (&dc->dirfiles, DIRFILE_BUCKETS,
if (open_directories == MAX_OPEN_DIRECTORIES)
/* We have too many directories open already.
Read the entire directory and then close it. */
- dir_contents_file_exists_p (dir, 0);
+ dir_contents_file_exists_p (dir, NULL);
}
}
int rehash = 0;
#endif
- if (dc == 0 || dc->dirfiles.ht_vec == 0)
+ if (dc == NULL || dc->dirfiles.ht_vec == NULL)
/* The directory could not be stat'd or opened. */
return 0;
#endif
#ifdef __EMX__
- if (filename != 0)
+ if (filename != NULL)
_fnlwr (filename); /* lower case for FAT drives */
#endif
- if (filename != 0)
+ if (filename != NULL)
{
struct dirfile dirfile_key;
/* The file was not found in the hashed list.
Try to read the directory further. */
- if (dc->dirstream == 0)
+ if (dc->dirstream == NULL)
{
#ifdef WINDOWS32
/*
{
if ((dc->fs_flags & FS_FAT) != 0)
{
- dc->mtime = time ((time_t *) 0);
+ dc->mtime = time (NULL);
rehash = 1;
}
else if (stat (dc->path_key, &st) == 0 && st.st_mtime > dc->mtime)
struct dirfile **dirfile_slot;
ENULLLOOP (d, readdir (dc->dirstream));
- if (d == 0)
+ if (d == NULL)
{
if (errno)
OSS (fatal, NILF, "readdir %s: %s", dir->name, strerror (errno));
hash_insert_at (&dc->dirfiles, df, dirfile_slot);
}
/* Check if the name matches the one we're searching for. */
- if (filename != 0 && patheq (d->d_name, filename))
+ if (filename != NULL && patheq (d->d_name, filename))
return 1;
}
dirend = strrchr (name, '/');
#ifdef VMS
- if (dirend == 0)
+ if (dirend == NULL)
{
dirend = strrchr (name, ']');
dirend == NULL ? dirend : dirend++;
}
- if (dirend == 0)
+ if (dirend == NULL)
{
dirend = strrchr (name, '>');
dirend == NULL ? dirend : dirend++;
}
- if (dirend == 0)
+ if (dirend == NULL)
{
dirend = strrchr (name, ':');
dirend == NULL ? dirend : dirend++;
dirend = name + 1;
}
#endif /* HAVE_DOS_PATHS */
- if (dirend == 0)
+ if (dirend == NULL)
#ifndef _AMIGA
return dir_file_exists_p (".", name);
#else /* !AMIGA */
dirend = p + 1;
}
#endif /* HAVE_DOS_PATHS */
- if (dirend == 0)
+ if (dirend == NULL)
#ifdef _AMIGA
dir = find_directory ("");
#else /* !AMIGA */
#endif
}
- if (dir->contents == 0)
+ if (dir->contents == NULL)
/* The directory could not be stat'd. We allocate a contents
structure for it, but leave it out of the contents hash table. */
dir->contents = xcalloc (sizeof (struct directory_contents));
- if (dir->contents->dirfiles.ht_vec == 0)
- {
- hash_init (&dir->contents->dirfiles, DIRFILE_BUCKETS,
- dirfile_hash_1, dirfile_hash_2, dirfile_hash_cmp);
- }
+ if (dir->contents->dirfiles.ht_vec == NULL)
+ hash_init (&dir->contents->dirfiles, DIRFILE_BUCKETS,
+ dirfile_hash_1, dirfile_hash_2, dirfile_hash_cmp);
/* Make a new entry and put it in the table. */
dirend = filename + 1;
}
#endif /* HAVE_DOS_PATHS */
- if (dirend == 0)
+ if (dirend == NULL)
#ifdef _AMIGA
dir = find_directory ("")->contents;
#else /* !AMIGA */
#endif
}
- if (dir == 0 || dir->dirfiles.ht_vec == 0)
+ if (dir == NULL || dir->dirfiles.ht_vec == NULL)
/* There are no files entered for this directory. */
return 0;
struct directory *dir = *dir_slot;
if (! HASH_VACANT (dir))
{
- if (dir->contents == 0)
+ if (dir->contents == NULL)
printf (_("# %s: could not be stat'd.\n"), dir->name);
- else if (dir->contents->dirfiles.ht_vec == 0)
+ else if (dir->contents->dirfiles.ht_vec == NULL)
#ifdef WINDOWS32
printf (_("# %s (key %s, mtime %s): could not be opened.\n"),
dir->name, dir->contents->path_key,
else
printf ("%u", im);
fputs (_(" impossibilities"), stdout);
- if (dir->contents->dirstream == 0)
+ if (dir->contents->dirstream == NULL)
puts (".");
else
puts (_(" so far."));
struct dirstream *new;
struct directory *dir = find_directory (directory);
- if (dir->contents == 0 || dir->contents->dirfiles.ht_vec == 0)
+ if (dir->contents == NULL || dir->contents->dirfiles.ht_vec == NULL)
/* DIR->contents is nil if the directory could not be stat'd.
DIR->contents->dirfiles is nil if it could not be opened. */
- return 0;
+ return NULL;
/* Read all the contents of the directory now. There is no benefit
in being lazy, since glob will want to see every file anyway. */
- dir_contents_file_exists_p (dir, 0);
+ dir_contents_file_exists_p (dir, NULL);
new = xmalloc (sizeof (struct dirstream));
new->contents = dir->contents;
}
}
- return 0;
+ return NULL;
}
/* On 64 bit ReliantUNIX (5.44 and above) in LFS mode, stat() is actually a