2005-08-06 Erez Zadok <ezk@cs.sunysb.edu>
+ * ALL: use '0' properly when assigning or passing it to functions.
+ If in the context pointer, use NULL. If in the context of a
+ single char (say within a string), the use '\0'. This is just to
+ make the code clearer.
+
* m4/macros/header_templates.m4: template for HAVE_MAP_SUN.
* amd/mapc.c (maptypes): add placeholder for Sun-syntax map
ops_search(char *type)
{
am_ops **vp;
- am_ops *rop = 0;
+ am_ops *rop = NULL;
for (vp = vops; (rop = *vp); vp++)
if (STREQ(rop->fs_type, type))
break;
am_ops *
ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map)
{
- am_ops *rop = 0;
+ am_ops *rop = NULL;
char *link_dir;
/*
/* Normalize the sublink and make it absolute */
link_dir = fo->opt_sublink;
if (link_dir && link_dir[0] && link_dir[0] != '/') {
- link_dir = str3cat((char *) 0, fo->opt_fs, "/", link_dir);
+ link_dir = str3cat((char *) NULL, fo->opt_fs, "/", link_dir);
normalize_slash(link_dir);
XFREE(fo->opt_sublink);
fo->opt_sublink = link_dir;
#endif /* HAVE_PLOCK || HAVE_MLOCKALL */
#if defined(HAVE_MADVISE) && defined(MADV_PROTECT)
- madvise(0, 0, MADV_PROTECT); /* may be redundant of the above worked out */
+ madvise(NULL, 0, MADV_PROTECT); /* may be redundant of the above worked out */
#endif /* defined(HAVE_MADVISE) && defined(MADV_PROTECT) */
}
char *ppref = mp->am_parent->am_pref;
if (ppref == 0)
ppref = "";
- mp->am_pref = str3cat((char *) 0, ppref, mp->am_name, "/");
+ mp->am_pref = str3cat((char *) NULL, ppref, mp->am_name, "/");
}
#ifdef HAVE_FS_AUTOFS
int error = 0; /* Error so far */
int in_progress = 0; /* # of (un)mount in progress */
mntfs *mf;
- char *expanded_fname = 0;
+ char *expanded_fname = NULL;
dlog("in amfs_lookup_node");
am_ops *p;
am_opts *fs_opts;
mntfs *new_mf;
- char *mp_dir = 0;
+ char *mp_dir = NULL;
#ifdef HAVE_FS_AUTOFS
int on_autofs = 1;
#endif /* HAVE_FS_AUTOFS */
/*
* Pick up new defaults
*/
- def_opts = str3cat((char *) 0, def_opts, ";", *cur_ivec + 1);
+ def_opts = str3cat((char *) NULL, def_opts, ";", *cur_ivec + 1);
dlog("Setting def_opts to \"%s\"", def_opts);
continue;
} else
dlog("Resetting the default options, a single dash '-' was found.");
} else {
/* append options to /default options */
- def_opts = str3cat((char *) 0, orig_def_opts, ";", *cur_ivec + 1);
+ def_opts = str3cat((char *) NULL, orig_def_opts, ";", *cur_ivec + 1);
dlog("Resetting def_opts to \"%s\"", def_opts);
}
continue;
free_mntfs(*mfp);
}
XFREE(cp->mp->am_mfarray);
- cp->mp->am_mfarray = 0;
XFREE(cp);
}
/* we have an errorfs attached to the am_node, free it */
free_mntfs(new_mp->am_mnt);
- new_mp->am_mnt = 0;
+ new_mp->am_mnt = NULL;
/*
* Construct a continuation
int n_export;
int j, k;
exports exlist = 0, ex;
- exports *ep = 0;
- am_nfs_handle_t *fp = 0;
+ exports *ep = NULL;
+ am_nfs_handle_t *fp = NULL;
char *host;
int error = 0;
struct sockaddr_in sin;
/* Check and avoid a duplicated export entry */
if (j > k && ep[k] && STREQ(ep[j]->ex_dir, ep[k]->ex_dir)) {
dlog("avoiding dup fhandle requested for %s", ep[j]->ex_dir);
- ep[j] = 0;
+ ep[j] = NULL;
} else {
k = j;
error = fetch_fhandle(client, ep[j]->ex_dir, &fp[j],
mf->mf_server->fs_version);
if (error)
- ep[j] = 0;
+ ep[j] = NULL;
}
}
* the last error code.
*/
xstrlcpy(fs_name, mf->mf_info, MAXPATHLEN);
- if ((rfs_dir = strchr(fs_name, ':')) == (char *) 0) {
+ if ((rfs_dir = strchr(fs_name, ':')) == (char *) NULL) {
plog(XLOG_FATAL, "amfs_host_mount: mf_info has no colon");
error = EINVAL;
goto out;
* Reverse list...
*/
ml = mlist;
- mprev = 0;
+ mprev = NULL;
while (ml) {
mntlist *ml2 = ml->mnext;
ml->mnext = mprev;
/*
* Determine magic cookie to put in mtab
*/
- xmtab = str3cat((char *) 0, fo->opt_rhost, ":", fo->opt_rfs);
+ xmtab = str3cat((char *) NULL, fo->opt_rhost, ":", fo->opt_rfs);
dlog("NFSX: mounting remote server \"%s\", remote fs \"%s\" on \"%s\"",
fo->opt_rhost, fo->opt_rfs, fo->opt_fs);
if (nx == 0) {
char **ivec;
- char *info = 0;
+ char *info = NULL;
char *host;
char *pref;
int error = 0;
nx->nx_c = i - 1; /* i-1 because we don't want the prefix */
nx->nx_v = (amfs_nfsx_mnt *) xmalloc(nx->nx_c * sizeof(amfs_nfsx_mnt));
- nx->nx_mp = 0;
+ nx->nx_mp = NULL;
{
- char *mp = 0;
- char *xinfo = 0;
+ char *mp = NULL;
+ char *xinfo = NULL;
char *fs = mf->mf_fo->opt_fs;
- char *rfs = 0;
+ char *rfs = NULL;
for (i = 0; i < nx->nx_c; i++) {
char *path = ivec[i + 1];
rfs = str3cat(rfs, pref, "/", path);
}
}
free_mntfs(m);
- n->n_mnt = 0;
+ n->n_mnt = NULL;
n->n_error = -1;
}
}
if (amuDebug(D_STR))
plog(XLOG_DEBUG, "strsplit saved a total of %d strings", ic);
- ivec[ic] = 0;
+ ivec[ic] = NULL;
return ivec;
}
if (!s || size < 0 || rdfd < 0)
return 0;
- s[0] = 0;
+ s[0] = '\0';
if (size == 0)
return s;
start = clocktime();
while (s[i] != '\n' && i < size-1) {
- s[i+1] = 0; /* places the requisite trailing '\0' */
+ s[i+1] = '\0'; /* places the requisite trailing '\0' */
/* ready for reading */
rval = read(rdfd, (void *)(s+i), 1);
FD_ZERO(&fds);
FD_SET(rdfd, &fds);
- rval = select(rdfd+1, &fds, 0, 0, &timeo);
+ rval = select(rdfd+1, &fds, NULL, NULL, &timeo);
if (rval < 0) {
/* error selecting */
plog(XLOG_WARNING, "fgets_timed select error: %m");
static int
exec_parse_qanswer(mnt_map *m, int fd, char *map, char *key, char **pval, time_t *tp)
{
- char qanswer[INFO_MAX_LINE_LEN], *dc = 0;
+ char qanswer[INFO_MAX_LINE_LEN], *dc = NULL;
int chuck = 0;
int line_no = 0;
close(pdes[1]);
/* anti-zombie insurance */
- while (waitpid(p1,0,0) < 0)
+ while (waitpid(p1, 0, 0) < 0)
if (errno != EINTR)
exit(errno);
int
passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
{
- char *dir = 0;
+ char *dir = NULL;
struct passwd *pw;
if (STREQ(key, "/defaults")) {
static int timeout_mp_id; /* Id from last call to timeout */
static am_node *root_node; /* The root of the mount tree */
-static am_node **exported_ap = (am_node **) 0;
+static am_node **exported_ap = (am_node **) NULL;
static int exported_ap_size = 0;
static int first_free_map = 0; /* First available free slot */
static int last_used_map = -1; /* Last unavailable used slot */
/*
* Zero the slot pointer to avoid double free's
*/
- exported_ap[mp->am_mapno] = 0;
+ exported_ap[mp->am_mapno] = NULL;
/*
* Update the free and last_used indices
* other fields don't need to be set to zero.
*/
mp->am_mnt = new_mntfs();
- mp->am_mfarray = 0;
+ mp->am_mfarray = NULL;
mp->am_name = strdup(dir);
mp->am_path = strdup(dir);
mp->am_gen = new_gen();
#ifdef HAVE_FS_AUTOFS
- mp->am_autofs_fh = 0;
+ mp->am_autofs_fh = NULL;
#endif /* HAVE_FS_AUTOFS */
mp->am_timeo = gopt.am_timeo;
/*
* Allocate a new mounted filesystem
*/
- root_mnt = find_mntfs(&amfs_root_ops, (am_opts *) 0, "", rootmap, "", "", "");
+ root_mnt = find_mntfs(&amfs_root_ops, (am_opts *) NULL, "", rootmap, "", "", "");
/*
* Replace the initial null reference
} else {
am_unmounted(mp);
}
- exported_ap[i] = 0;
+ exported_ap[i] = NULL;
} else {
/*
* Any other node gets forcibly timed out.
t = now + 1;
dlog("Next mount timeout in %lds", (long) (t - now));
- timeout_mp_id = timeout(t - now, timeout_mp, 0);
+ timeout_mp_id = timeout(t - now, timeout_mp, NULL);
}
{
if (timeout_mp_id)
untimeout(timeout_mp_id);
- timeout_mp_id = timeout(0, timeout_mp, 0);
+ timeout_mp_id = timeout(0, timeout_mp, NULL);
}
{"regexp", MAPC_RE},
#endif /* HAVE_REGEXEC */
{"sync", MAPC_SYNC},
- {0, 0}
+ {NULL, 0}
};
/*
int rc = search_map(m, wildcard, &m->wildcard);
if (rc != 0)
- m->wildcard = 0;
+ m->wildcard = NULL;
}
memcpy((voidp) m->kvhash, (voidp) tmphash, sizeof(m->kvhash));
m->modify = t;
}
- m->wildcard = 0;
+ m->wildcard = NULL;
dlog("calling mapc_search for wildcard");
error = mapc_search(m, wildcard, &m->wildcard);
if (error)
- m->wildcard = 0;
+ m->wildcard = NULL;
}
memset((voidp) m->kvhash, 0, sizeof(m->kvhash));
m->map_name = strdup(map);
m->refc = 1;
- m->wildcard = 0;
+ m->wildcard = NULL;
m->reloads = 0;
/* Unfortunately with current code structure, this cannot be initialized here */
m->cfm = NULL;
/*
* Free the wildcard if it exists
*/
- if (m->wildcard) {
+ if (m->wildcard)
XFREE(m->wildcard);
- m->wildcard = 0;
- }
}
mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
{
int error = 0;
- kv *k = 0;
+ kv *k = NULL;
/*
* Firewall
int retval;
/* XXX: this code was recently ported, and must be tested -Erez */
- retval = regexec(&k->re, key, 0, 0, 0);
+ retval = regexec(&k->re, key, 0, NULL, 0);
if (retval == 0) { /* succeeded */
break;
} else { /* failed to match, log error */
dlog("mapc recurses on %s", wildname);
error = mapc_meta_search(m, wildname, pval, MREC_PART);
if (error)
- *subp = 0;
+ *subp = '\0';
}
if (error > 0 && m->wildcard) {
mf->mf_flags = 0;
mf->mf_error = -1;
mf->mf_cid = 0;
- mf->mf_private = 0;
- mf->mf_prfree = 0;
+ mf->mf_private = NULL;
+ mf->mf_prfree = NULL;
if (ops->ffserver)
mf->mf_server = (*ops->ffserver) (mf);
else
- mf->mf_server = 0;
+ mf->mf_server = NULL;
}
if (mf->mf_private && mf->mf_prfree) {
mf->mf_prfree(mf->mf_private);
- mf->mf_private = 0;
+ mf->mf_private = NULL;
}
fs = ops->ffserver ? (*ops->ffserver) (mf) : (fserver *) NULL;
mntfs *
new_mntfs(void)
{
- return alloc_mntfs(&amfs_error_ops, (am_opts *) 0, "//nil//", ".", "", "", "");
+ return alloc_mntfs(&amfs_error_ops, (am_opts *) NULL, "//nil//", ".", "", "", "");
}
static void
checkup(void)
{
-
static int max_fd = 0;
- static char *max_mem = 0;
-
+ static char *max_mem = NULL;
int next_fd = dup(0);
caddr_t next_mem = sbrk(0);
+
close(next_fd);
if (max_fd < next_fd) {
/*
* Wait for input
*/
- nsel = select(fds, fdp, (fd_set *) 0, (fd_set *) 0,
- tvp->tv_sec ? tvp : (struct timeval *) 0);
+ nsel = select(fds, fdp, (fd_set *) NULL, (fd_set *) NULL,
+ tvp->tv_sec ? tvp : (struct timeval *) NULL);
}
#ifdef HAVE_SIGACTION
FD_SET(fwd_sock, &readfds);
tvv.tv_sec = tvv.tv_usec = 0;
- nsel = select(FD_SETSIZE, &readfds, (fd_set *) 0, (fd_set *) 0, &tvv);
+ nsel = select(FD_SETSIZE, &readfds, (fd_set *) NULL, (fd_set *) NULL, &tvv);
if (nsel < 1)
return (0);
if (FD_ISSET(fwd_sock, &readfds))
fh_to_mp3(am_nfs_fh *fhp, int *rp, int vop)
{
struct am_fh *fp = (struct am_fh *) fhp;
- am_node *ap = 0;
+ am_node *ap = NULL;
if (fp->u.s.fhh_type != 0) {
/* New filehandle type */
* a new one allocated.
*/
if (ap != NULL && ap->am_gen != fp->fhh_gen)
- ap = 0;
+ ap = NULL;
/*
* If it doesn't exists then drop the request
if (ap && error < 0)
ap = orig_ap->am_parent->am_mnt->mf_ops->mount_child(ap, &error);
} else {
- ap = 0;
+ ap = NULL;
error = ESTALE;
}
if (ap == 0) {
new_ttl(orig_ap);
}
-#endif
+#endif /* 0 */
/*
* Disallow references to objects being unmounted, unless
static fh_cache *
find_nfs_fhandle_cache(opaque_t arg, int done)
{
- fh_cache *fp, *fp2 = 0;
+ fh_cache *fp, *fp2 = NULL;
int id = (long) arg; /* for 64-bit archs */
ITER(fp, fh_cache, &fh_head) {
static int
prime_nfs_fhandle_cache(char *path, fserver *fs, am_nfs_handle_t *fhbuf, mntfs *mf)
{
- fh_cache *fp, *fp_save = 0;
+ fh_cache *fp, *fp_save = NULL;
int error;
int reuse_id = FALSE;
nfsdiropargs args;
#ifdef HAVE_FS_NFS3
am_LOOKUP3args args3;
-#endif
+#endif /* HAVE_FS_NFS3 */
char *wnfs_path;
if (!nfs_auth) {
f.fh_fs = fs;
f.fh_id = 0;
f.fh_error = 0;
- prime_nfs_fhandle_cache(colon + 1, mf->mf_server, (am_nfs_handle_t *) 0, mf);
- call_mountd(&f, MOUNTPROC_UMNT, (fwd_fun *) 0, (wchan_t) 0);
+ prime_nfs_fhandle_cache(colon + 1, mf->mf_server, (am_nfs_handle_t *) NULL, mf);
+ call_mountd(&f, MOUNTPROC_UMNT, (fwd_fun *) NULL, (wchan_t) NULL);
*colon = ':';
}
}
/* assert(*f == 0 || *f == '/'); */
} while (*f);
- *t = 0; /* derived from fix by Steven Glassman */
+ *t = '\0'; /* derived from fix by Steven Glassman */
}
}
/* out of space */
plog(XLOG_DEBUG, "make_entry_chain: no more space in chain");
if (num_entries > 0) {
- chain[num_entries - 1].ne_nextentry = 0;
+ chain[num_entries - 1].ne_nextentry = NULL;
retval = &chain[0];
}
return retval;
/* terminate chain */
if (num_entries > 0) {
- chain[num_entries - 1].ne_nextentry = 0;
+ chain[num_entries - 1].ne_nextentry = NULL;
retval = &chain[0];
}
ep[1].ne_fileid = mp->am_gen;
ep[1].ne_name = "..";
- ep[1].ne_nextentry = 0;
+ ep[1].ne_nextentry = NULL;
*(u_int *) ep[1].ne_cookie = DOT_DOT_COOKIE;
/*
if (gen == DOT_DOT_COOKIE) {
dlog("amfs_readdir_browsable: End of readdir in %s", mp->am_path);
dp->dl_eof = TRUE;
- dp->dl_entries = 0;
+ dp->dl_entries = NULL;
return 0;
}
te = te_next; /* reset 'te' from last saved te_next */
if (!te) { /* another indicator of end of readdir */
- dp->dl_entries = 0;
+ dp->dl_entries = NULL;
return 0;
}
/*
else
ep[1].ne_fileid = mp->am_gen;
ep[1].ne_name = "..";
- ep[1].ne_nextentry = 0;
+ ep[1].ne_nextentry = NULL;
*(u_int *) ep[1].ne_cookie = (xp ? xp->am_gen : DOT_DOT_COOKIE);
if (!xp)
if (gen == DOT_DOT_COOKIE) {
dlog("amfs_generic_readdir: End of readdir in %s", mp->am_path);
dp->dl_eof = TRUE;
- dp->dl_entries = 0;
+ dp->dl_entries = NULL;
if (amuDebug(D_READDIR))
plog(XLOG_DEBUG, "end of readdir eof=TRUE, dl_entries=0\n");
return 0;
}
} while (todo > 0);
- ep->ne_nextentry = 0;
+ ep->ne_nextentry = NULL;
if (amuDebug(D_READDIR)) {
nfsentry *ne;
* Partially fake up an opts structure
*/
memset(&mo, 0, sizeof(mo));
- mo.opt_rhost = 0;
- mo.opt_rfs = 0;
+ mo.opt_rhost = NULL;
+ mo.opt_rfs = NULL;
cp = strchr(me->mnt_fsname, ':');
if (cp) {
*cp = '\0';
if (mf->mf_refc == 1) {
mf->mf_flags |= MFF_RESTART | MFF_MOUNTED;
mf->mf_error = 0; /* Already mounted correctly */
- mf->mf_fo = 0;
+ mf->mf_fo = NULL;
/*
* Only timeout non-NFS entries
*/
mlp;
mlp = mlp->mnext) {
mntent_t *me = mlp->mnt;
- am_ops *fs_ops = 0;
+ am_ops *fs_ops = NULL;
if (STREQ(me->mnt_type, MNTTAB_TYPE_NFS)) {
/*
mlp;
mlp = mlp->mnext) {
mntent_t *me = mlp->mnt;
- am_ops *fs_ops = 0;
+ am_ops *fs_ops = NULL;
char *colon;
long pid;
u_short port;
fwd_alloc(void)
{
time_t now = clocktime();
- rpc_forward *p = 0, *p2;
+ rpc_forward *p = NULL, *p2;
/*
* First search for an existing expired one.
/*
* Some things we talk to require a priv port - so make one here
*/
- if (bind_resv_port(fwd_sock, (u_short *) 0) < 0)
+ if (bind_resv_port(fwd_sock, (u_short *) NULL) < 0)
plog(XLOG_ERROR, "can't bind privileged port (rpc_fwd)");
if (fcntl(fwd_sock, F_SETFL, FNDELAY) < 0
#ifdef HAVE_WAITPID
while ((pid = waitpid((pid_t) -1, &w, WNOHANG)) > 0) {
#else /* not HAVE_WAITPID */
- while ((pid = wait3( &w, WNOHANG, (struct rusage *) 0)) > 0) {
+ while ((pid = wait3( &w, WNOHANG, (struct rusage *) NULL)) > 0) {
#endif /* not HAVE_WAITPID */
pjob *p, *p2;
fs = ALLOC(struct fserver);
fs->fs_refc = 0;
fs->fs_host = strdup("localhost");
- fs->fs_ip = 0;
+ fs->fs_ip = NULL;
fs->fs_cid = 0;
fs->fs_pinger = AM_PINGER;
fs->fs_flags = FSF_VALID | FSF_PING_UNINIT;
fs->fs_type = "local";
- fs->fs_private = 0;
- fs->fs_prfree = 0;
+ fs->fs_private = NULL;
+ fs->fs_prfree = NULL;
ins_que(&fs->fs_q, &amfs_auto_srvr_list);
got_portmap(voidp pkt, int len, struct sockaddr_in *sa, struct sockaddr_in *ia, voidp idv, int done)
{
fserver *fs2 = (fserver *) idv;
- fserver *fs = 0;
+ fserver *fs = NULL;
/*
* Find which fileserver we are talking about
#if 0
flush_nfs_fhandle_cache(fs); /* done in caller: nfs_keepalive_timeout */
/* XXX: need to purge nfs_private so that somehow it will get re-initialized? */
-#endif
+#endif /* 0 */
}
ping_buf[fs->fs_version - NFS_VERSION],
ping_len[fs->fs_version - NFS_VERSION],
fs->fs_ip,
- (struct sockaddr_in *) 0,
+ (struct sockaddr_in *) NULL,
(voidp) ((long) np->np_xid), /* cast needed for 64-bit archs */
nfs_keepalive_callback);
list = malloc(autofs_max_fds * sizeof(*list));
hash = malloc(autofs_max_fds * sizeof(*hash));
- for (i = 0 ; i < autofs_max_fds; i++)
- hash[i] = 0, list[i] = -1;
+ for (i = 0 ; i < autofs_max_fds; i++) {
+ hash[i] = NULL;
+ list[i] = -1;
+ }
}
if (hash[fd] == 0)
plog(XLOG_WARNING, "file descriptor %d not in the hash", fd);
- hash[fd] = 0;
+ hash[fd] = NULL;
numfds--;
for (i = 0; i < numfds; i++)
if (list[i] == fd) {
fixmount_check_mount(char *host, struct in_addr hostaddr, char *path)
{
int ret, i;
- char *mntinfo = 0, *cp;
+ char *mntinfo = NULL, *cp;
char *short_hostname, *long_hostname, *mount_point;
struct vmount *vp;
if (strlen(*xopts))
*(*xopts + strlen(*xopts)-1) = '\0';
if (strlen(topts))
- topts[strlen(topts)-1] = 0;
+ topts[strlen(topts)-1] = '\0';
XFREE(xoptstr);
return topts;
}
plog(XLOG_ERROR, "Can't create socket for kernel");
return 1;
}
- if (bindresvport(mnt_data->fd, 0) < 0) {
+ if (bindresvport(mnt_data->fd, NULL) < 0) {
plog(XLOG_ERROR, "Can't bind to reserved port");
errorcode = 1;
goto out;
#define LOOP_FMT_SIZE(a) (sizeof(a)/sizeof(a[0]))
for (j = 0; j < (int) LOOP_FMT_SIZE(loop_formats); j++) {
- for(i = 0; i < 256; i++) {
+ for (i = 0; i < 256; i++) {
sprintf(dev, loop_formats[j], i);
if (stat(dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) {
somedev++;
case MOUNT_TYPE_NFS:
ty = MNTTAB_TYPE_NFS;
- new_mp->mnt_fsname = str3cat((char *) 0,
+ new_mp->mnt_fsname = str3cat((char *) NULL,
vmt2dataptr(mp, VMT_HOSTNAME), ":",
fsname);
break;
#ifdef HAVE_FS_NFS3
case MOUNT_TYPE_NFS3:
ty = MNTTAB_TYPE_NFS3;
- new_mp->mnt_fsname = str3cat((char *) 0,
+ new_mp->mnt_fsname = str3cat((char *) NULL,
vmt2dataptr(mp, VMT_HOSTNAME), ":",
fsname);
break;
{
mntlist **mpp, *mhp;
int i;
- char *mntinfo = 0, *cp;
+ char *mntinfo = NULL, *cp;
struct vmount *vp;
int ret;
int maxtry = 10; /* maximum number of times to try mntctl */
mpp = &(*mpp)->mnext;
}
- *mpp = 0;
+ *mpp = NULL;
out:
if (mntinfo)
/*
* Terminate the list
*/
- *mpp = 0;
+ *mpp = NULL;
return mhp;
}
static FILE *
open_locked_mtab(const char *mnttabname, char *mode, char *fs)
{
- FILE *mfp = 0;
+ FILE *mfp = NULL;
/*
* There is a possible race condition if two processes enter
dlog("Forced close on %s in read_mtab", mnttabname);
# endif /* DEBUG */
endmntent(mnt_file);
- mnt_file = 0;
+ mnt_file = NULL;
}
again:
if (mfp) {
endmntent(mfp);
- mfp = 0;
+ mfp = NULL;
}
clock_valid = 0;
if (stat(mnttabname, &st_before) < 0) {
if (mnt_file) {
dlog("unlock_mntlist: releasing");
endmntent(mnt_file);
- mnt_file = 0;
+ mnt_file = NULL;
}
}
*/
mpp = &(*mpp)->mnext;
}
- *mpp = 0;
+ *mpp = NULL;
#ifdef MOUNT_TABLE_ON_FILE
/*
int nmts;
if (lockmnttab() != 0)
- return (mntlist *) 0;
+ return (mntlist *) NULL;
fd = open(mnttabname, O_RDONLY);
if (fd < 0) {
plog(XLOG_ERROR, "Can't open %s: %m", mnttabname);
- return (mntlist *) 0;
+ return (mntlist *) NULL;
}
mpp = &mhp;
while ((ret = read(fd, (char *) mountbuffer, NMOUNT * sizeof(mntent_t))) > 0) {
if (ret < 0) {
plog(XLOG_ERROR, "read error on %s: %m", mnttabname);
unlockmnttab();
- mhp = (mntlist *) 0;
+ mhp = (mntlist *) NULL;
}
- *mpp = 0;
+ *mpp = NULL;
close(fd);
return mhp;
static FILE *
open_locked_mtab(const char *mnttabname, char *mode, char *fs)
{
- FILE *mfp = 0;
+ FILE *mfp = NULL;
if (mnt_file) {
dlog("Forced close on %s in read_mtab", mnttabname);
endmntent(mnt_file);
- mnt_file = 0;
+ mnt_file = NULL;
}
if (!mtab_is_a_symlink() &&
dlog("unlock_mntlist: releasing");
if (mnt_file) {
endmntent(mnt_file);
- mnt_file = 0;
+ mnt_file = NULL;
}
if (we_created_lockfile) {
close(lockfile_fd);
*/
mpp = &(*mpp)->mnext;
}
- *mpp = 0;
+ *mpp = NULL;
#ifdef MOUNT_TABLE_ON_FILE
/*
static FILE *
open_locked_mtab(char *mnttabname, char *mode, char *fs)
{
- FILE *mfp = 0;
+ FILE *mfp = NULL;
/*
* There is a possible race condition if two processes enter
dlog("Forced close on %s in read_mtab", mnttabname);
#endif /* DEBUG */
endmntent(mnt_file);
- mnt_file = 0;
+ mnt_file = NULL;
}
again:
if (mfp) {
endmntent(mfp);
- mfp = 0;
+ mfp = NULL;
}
clock_valid = 0;
if (stat(mnttabname, &st_before) < 0) {
if (mnt_file) {
dlog("unlock_mntlist: releasing");
endmntent(mnt_file);
- mnt_file = 0;
+ mnt_file = NULL;
}
}
*/
mpp = &(*mpp)->mnext;
}
- *mpp = 0;
+ *mpp = NULL;
/*
* If we are not updating the mount table then we
}
/* terminate the linked list */
- *mpp = 0;
+ *mpp = NULL;
return mhp;
}
unlockmnttab();
mhp = NULL;
}
- *mpp = 0;
+ *mpp = NULL;
fclose(fp);
return mhp;
read_mtab(char *fs, const char *mnttabname)
{
mntlist **mpp, *mhp;
-
/* From: Piete Brooks <pb@cl.cam.ac.uk> */
-
int loc = 0;
struct fs_data mountbuffer[NMOUNT], *fs_data;
int ret;
plog(XLOG_ERROR, "getmountent: %m");
return 0;
}
- *mpp = 0;
+ *mpp = NULL;
return mhp;
}
unsigned long u14; /* ??? UNKNOWN ??? */
struct pathcnf *pathconf; /* pathconf */
};
-#endif
+#endif /* 0 */
/*
* IBM is in dire need of taking a soft-eng class.
*/
#if 0
#define MOUNT_NFS3 MOUNT_NFS
-#endif
+#endif /* 0 */
#endif /* not _AMU_NFS_PROT_H */
char *fsname; /* F/S name */
#if 0
struct pathcnf *pathconf; /* static pathconf kludge */
-#endif
+#endif /* 0 */
};
struct nfs_fh {
#if 0
post_op_attr obj_attributes;
post_op_attr dir_attributes;
-#endif
+#endif /* 0 */
};
typedef struct LOOKUP3resok LOOKUP3resok;
int dummy;
#if 0
post_op_attr dir_attributes;
-#endif
+#endif /* 0 */
};
typedef struct LOOKUP3resfail LOOKUP3resfail;
#if 0
/* this is right for 1.3beta */
typedef int (*ypall_callback_fxn_t)(int, char *, int, char *, int, char *);
-#endif
+#endif /* 0 */
#endif /* DEFINED_YPALL_CALLBACK_FXN_T */
#if 0
/* this is RIGHT for 1.2G and 1.2.1 */
typedef int (*ypall_callback_fxn_t)(u_long, char *, int, char *, int, void *);
-#endif
+#endif /* 0 */
/* this is right for 1.3beta and newer */
typedef int (*ypall_callback_fxn_t)(int, char *, int, char *, int, char *);
#endif /* DEFINED_YPALL_CALLBACK_FXN_T */
#if 0
/* this is RIGHT for 1.2G and 1.2.1 */
typedef int (*ypall_callback_fxn_t)(u_long, char *, int, char *, int, void *);
-#endif
+#endif /* 0 */
/* this is right for 1.3beta and newer */
typedef int (*ypall_callback_fxn_t)(int, char *, int, char *, int, char *);
#endif /* DEFINED_YPALL_CALLBACK_FXN_T */
#if 0
/* cannot include this file b/c it refers to non-existing headers */
# include <bsd/nfs/nfs_mount.h>
-#endif
+#endif /* 0 */
/*
char *wra_val_u;
} wra_u;
};
-#endif
+#endif /* 0 */
struct nfscreateargs {
nfsdiropargs ca_where;
char *wra_val_u;
} wra_u;
};
-#endif
+#endif /* 0 */
struct nfscreateargs {
nfsdiropargs ca_where;
/* defaults: libamu/amu.h */
#define MNTPATHLEN 1024
#define MNTNAMLEN 255
-#endif
+#endif /* 0 */
#define NFSMODE_FMT 0170000
#define NFSMODE_DIR 0040000
/*
* Bind to a privileged port
*/
- if (bind_resv_port(*sock, (u_short *) 0) < 0)
+ if (bind_resv_port(*sock, (u_short *) NULL) < 0)
plog(XLOG_ERROR, "can't bind privileged port (socket)");
/*
/*
* Bind to a privileged port
*/
- if (bind_resv_port(*sock, (u_short *) 0) < 0)
+ if (bind_resv_port(*sock, (u_short *) NULL) < 0)
plog(XLOG_ERROR, "can't bind privileged port");
/*
plog(XLOG_ERROR, "t_open %s: %m", nc->nc_device);
goto tryudp;
}
- if (bind_resv_port(*sock, (u_short *) 0) < 0)
+ if (bind_resv_port(*sock, (u_short *) NULL) < 0)
plog(XLOG_ERROR, "couldn't bind mountd socket to privileged port");
if ((client = clnt_vc_create(*sock, &nb, MOUNTPROG, mnt_version, 0, 0))
plog(XLOG_ERROR, "t_open %s: %m", nc->nc_device);
goto badout; /* neither tcp not udp succeeded */
}
- if (bind_resv_port(*sock, (u_short *) 0) < 0)
+ if (bind_resv_port(*sock, (u_short *) NULL) < 0)
plog(XLOG_ERROR, "couldn't bind mountd socket to privileged port");
if ((client = clnt_dg_create(*sock, &nb, MOUNTPROG, mnt_version, 0, 0))
* correct device name to udp, and t_open a descriptor to be used in
* t_bind below.
*/
- td = t_open(nc->nc_device, O_RDWR, (struct t_info *) 0);
+ td = t_open(nc->nc_device, O_RDWR, (struct t_info *) NULL);
endnetconfig(nc_handle);
if (td < 0) {
return -1;
}
- td = t_open(ncp->nc_device, O_RDWR, (struct t_info *) 0);
+ td = t_open(ncp->nc_device, O_RDWR, (struct t_info *) NULL);
if (td < 0) {
plog(XLOG_ERROR, "t_open failed: %d: %s", t_errno, t_errlist[t_errno]);
return -1;
int
register_autofs_service(char *autofs_conftype, void (*autofs_dispatch)())
{
- struct t_bind *tbp = 0;
+ struct t_bind *tbp = NULL;
struct netconfig *autofs_ncp;
SVCXPRT *autofs_xprt = NULL;
int fd = -1, err = 1; /* assume failed */
int
umount_fs(char *mntdir, const char *mnttabname, u_int unmount_flags)
{
- mntlist *mlist, *mp, *mp_save = 0;
+ mntlist *mlist, *mp, *mp_save = NULL;
int error = 0;
mp = mlist = read_mtab(mntdir, mnttabname);
* Search the mount table looking for
* the correct (ie last) matching entry
*/
- mp_save = 0;
+ mp_save = NULL;
while (mp) {
if (STREQ(mp->mnt->mnt_dir, mntdir))
mp_save = mp;
if (mp_save) {
mnt_free(mp_save->mnt);
- mp_save->mnt = 0;
+ mp_save->mnt = NULL;
rewrite_mtab(mlist, mnttabname);
}
#endif /* MOUNT_TABLE_ON_FILE */
int error = 0;
#if 0
u_int vfs_id = 0;
-#endif
+#endif /* 0 */
if (unmount_flags & AMU_UMOUNT_FORCE) {
plog(XLOG_INFO, "**UNIMPLEMENTED**: umount2_fs: trying unmount/forced on %s", mntdir);
plog(XLOG_WARNING, "%u: unmount/force: %m", vfs_id);
else
dlog("%s: unmount/force: OK", mntdir);
-#endif
+#endif /* 0 */
}
return error;
}
umount2_fs(const char *mntdir, u_int unmount_flags)
{
int error = 0;
+
if (unmount_flags & AMU_UMOUNT_FORCE) {
plog(XLOG_INFO, "umount2_fs: trying unmount/forced on %s", mntdir);
error = unmount(mntdir, MNT2_GEN_OPT_FORCE);
int
umount_fs(char *mntdir, const char *mnttabname, u_int unmount_flags)
{
- mntlist *mlist, *mp, *mp_save = 0;
+ mntlist *mlist, *mp, *mp_save = NULL;
int error = 0;
mp = mlist = read_mtab(mntdir, mnttabname);
* Search the mount table looking for
* the correct (ie last) matching entry
*/
- mp_save = 0;
+ mp_save = NULL;
while (mp) {
if (STREQ(mp->mnt->mnt_dir, mntdir))
mp_save = mp;
if (mp_save) {
mnt_free(mp_save->mnt);
- mp_save->mnt = 0;
+ mp_save->mnt = NULL;
rewrite_mtab(mlist, mnttabname);
}
#endif /* MOUNT_TABLE_ON_FILE */
umount2_fs(const char *mntdir, u_int unmount_flags)
{
int error = 0;
+
if (unmount_flags & AMU_UMOUNT_FORCE) {
plog(XLOG_INFO, "umount2_fs: trying unmount/forced on %s", mntdir);
error = umount2(mntdir, MNT2_GEN_OPT_FORCE); /* Solaris */
int
umount_fs(char *mntdir, const char *mnttabname, u_int unmount_flags)
{
- mntlist *mlist, *mp, *mp_save = 0;
+ mntlist *mlist, *mp, *mp_save = NULL;
int error = 0;
#ifdef HAVE_LOOP_DEVICE
- char *opt, *xopts=NULL;
+ char *opt, *xopts = NULL;
char loopstr[] = "loop=";
char *loopdev;
#endif /* HAVE_LOOP_DEVICE */
* Search the mount table looking for
* the correct (ie last) matching entry
*/
- mp_save = 0;
+ mp_save = NULL;
while (mp) {
if (STREQ(mp->mnt->mnt_dir, mntdir))
mp_save = mp;
if (mp_save) {
mnt_free(mp_save->mnt);
- mp_save->mnt = 0;
+ mp_save->mnt = NULL;
rewrite_mtab(mlist, mnttabname);
}
#endif /* MOUNT_TABLE_ON_FILE */
umount2_fs(const char *mntdir, u_int unmount_flags)
{
int error = 0;
+
if (unmount_flags & AMU_UMOUNT_FORCE) {
plog(XLOG_INFO, "umount2_fs: trying unmount/forced on %s", mntdir);
error = umount((char *)mntdir, MNT2_GEN_OPT_FORCE);
(XDRPROC_T_TYPE) xdr_dirpath,
(char *) &pathp,
(XDRPROC_T_TYPE) xdr_void,
- (char *) 0,
+ (char *) NULL,
tv)) != RPC_SUCCESS) {
fprintf(stderr, "%s:%s MOUNTPROC_UMNT: ",
host, ml->ml_directory);
if ((estat = clnt_call(client,
MOUNTPROC_UMNTALL,
(XDRPROC_T_TYPE) xdr_void,
- (char *) 0,
+ (char *) NULL,
(XDRPROC_T_TYPE) xdr_void,
- (char *) 0,
+ (char *) NULL,
tv)) != RPC_SUCCESS) {
/*
* RPC_SYSTEMERROR is returned even if all went well
if ((estat = clnt_call(client,
MOUNTPROC_DUMP,
(XDRPROC_T_TYPE) xdr_void,
- (char *) 0,
+ (char *) NULL,
(XDRPROC_T_TYPE) xdr_mountlist,
(char *) &mntdump,
tv)) != RPC_SUCCESS) {
if ((estat = clnt_call(client,
MOUNTPROC_EXPORT,
(XDRPROC_T_TYPE) xdr_void,
- (char *) 0,
+ (char *) NULL,
(XDRPROC_T_TYPE) xdr_exports,
(char *) &mntexports,
tv)) != RPC_SUCCESS) {
char *disk_fs_strings[] =
{
- "fstype", "opts", "dumpset", "passno", "freq", "mount", "log", 0,
+ "fstype", "opts", "dumpset", "passno", "freq", "mount", "log", NULL,
};
char *mount_strings[] =
{
- "volname", "exportfs", 0,
+ "volname", "exportfs", NULL,
};
char *fsmount_strings[] =
{
- "as", "volname", "fstype", "opts", "from", 0,
+ "as", "volname", "fstype", "opts", "from", NULL,
};
char *host_strings[] =
{
- "host", "netif", "config", "arch", "cluster", "os", 0,
+ "host", "netif", "config", "arch", "cluster", "os", NULL,
};
char *ether_if_strings[] =
{
- "inaddr", "netmask", "hwaddr", 0,
+ "inaddr", "netmask", "hwaddr", NULL,
};
do {
d = strrchr(p, '.');
if (d) {
- *d = 0;
+ *d = '\0';
strcat(path, d + 1);
strcat(path, "/");
} else {
analyze_dkmounts(disk_fs *dk, qelem *q)
{
int errors = 0;
- fsi_mount *mp, *mp2 = 0;
+ fsi_mount *mp, *mp2 = NULL;
int i = 0;
/*
/*
* Analyze the mount tree
*/
- errors += analyze_dkmount_tree(q, 0, dk);
+ errors += analyze_dkmount_tree(q, NULL, dk);
/*
* Analyze the export tree
*/
- errors += check_exportfs(q, 0);
+ errors += check_exportfs(q, NULL);
return errors;
}
lerror(fp->f_ioloc, "ambiguous mount: %s is a replicated filesystem", fp->f_volname);
} else {
dict_data *dd;
- fsi_mount *mp = 0;
+ fsi_mount *mp = NULL;
dd = AM_FIRST(dict_data, &de->de_q);
mp = (fsi_mount *) dd->dd_data;
if (!mp)
matched = 1;
} else
do {
- p = 0;
+ p = NULL;
de = find_volname(nn);
fsi_log("Mount: %s (trying %s)", fp->f_volname, nn);
*/
if (ISSET(fp->f_mask, FM_FROM) && !ISSET(fp->f_mask, FM_DIRECT)) {
dict_data *dd;
- fsi_mount *mp2 = 0;
+ fsi_mount *mp2 = NULL;
ITER(dd, dict_data, &de->de_q) {
fsi_mount *mp = (fsi_mount *) dd->dd_data;
}
p = strrchr(nn, '/');
if (p)
- *p = 0;
+ *p = '\0';
} while (de && p);
XFREE(nn);
{ $4->d_dev = $2; $$ = $4; }
| tFS error '}'
- { $$ = (disk_fs *) 0; }
+ { $$ = (disk_fs *) NULL; }
;
/*
{ "passno", tPASSNO },
{ "sel", tSEL },
{ "volname", tVOLNAME },
- { 0, 0 },
+ { NULL, 0 },
};
#define NRES_WORDS (sizeof(rr)/sizeof(rr[0])-1)
static void
make_banner(FILE *fp)
{
- time_t t = time((time_t *) 0);
+ time_t t = time((time_t *) NULL);
char *cp = ctime(&t);
fprintf(fp,
void
show_area_being_processed(char *area, int n)
{
- static char *last_area = 0;
+ static char *last_area = NULL;
if (verbose < 0)
return;
ap->a_ioloc = current_location();
ap->a_name = name;
- ap->a_volname = 0;
- ap->a_mount = 0;
- ap->a_opts = 0;
+ ap->a_volname = NULL;
+ ap->a_mount = NULL;
+ ap->a_opts = NULL;
show_new("automount");
return ap;
}
"u4_0", write_ultrix_dkfstab, write_ultrix_dkrmount
}, /* Ultrix */
{
- 0, 0, 0
+ NULL, NULL, NULL
}
};
static struct os_fstab_type *
find_fstab_type(host *hp)
{
- struct os_fstab_type *op = 0;
- char *os_name = 0;
+ struct os_fstab_type *op = NULL;
+ char *os_name = NULL;
again:;
if (os_name == 0) {
char *home_subdir = HOME_SUBDIR;
char *logfile = DEFAULT_LOGFILE;
char *passwdfile = NULL; /* alternate passwd file to use */
-char *slinkname = 0;
+char *slinkname = NULL;
char hostname[MAXHOSTNAMELEN + 1] = "localhost";
u_int cache_interval = DEFAULT_CACHE_INTERVAL;
gid_t hlfs_gid = (gid_t) INVALIDID;
# endif /* not defined(DEBUG) || defined(DEBUG_PRINT) */
#endif /* not HAVE_SIGACTION */
- if (setitimer(ITIMER_REAL, &reloadinterval, (struct itimerval *) 0) < 0)
+ if (setitimer(ITIMER_REAL, &reloadinterval, (struct itimerval *) NULL) < 0)
fatal("setitimer: %m");
- gettimeofday((struct timeval *) ((void *)&startup), (struct timezone *) 0);
+ gettimeofday((struct timeval *) ((void *)&startup), (struct timezone *) NULL);
/*
* If not -D daemon, then start serving here in the child,
do {
tv.tv_sec = secs;
- if (select(0, 0, 0, 0, &tv) == 0)
+ if (select(0, NULL, NULL, NULL, &tv) == 0)
break;
} while (--secs && found->child);
}
#ifdef HAVE_WAITPID
while ((child = waitpid((pid_t) -1, &status, WNOHANG)) > 0) {
#else /* not HAVE_WAITPID */
- while ((child = wait3(&status, WNOHANG, (struct rusage *) 0)) > 0) {
+ while ((child = wait3(&status, WNOHANG, (struct rusage *) NULL)) > 0) {
#endif /* not HAVE_WAITPID */
/* high chances this was the last child forked */
rootfattr.na_mtime.nt_seconds++;
rootfattr.na_uid = uid;
}
-#endif
+#endif /* 0 */
res.ns_status = NFS_OK;
res.ns_u.ns_attr_u = rootfattr;
} else if (eq_fh(argp, &slink)) {
rootfattr.na_mtime.nt_seconds++;
rootfattr.na_uid = uid;
}
-#endif
+#endif /* 0 */
res.dr_u.dr_drok_u.drok_fhandle = root;
res.dr_u.dr_drok_u.drok_attributes = rootfattr;
res.dr_status = NFS_OK;
if (getcreds(rqstp, &userid, &groupid, nfsxprt) < 0)
return (nfsreadlinkres *) NULL;
- gettimeofday((struct timeval *) &slinkfattr.na_atime, (struct timezone *) 0);
+ gettimeofday((struct timeval *) &slinkfattr.na_atime, (struct timezone *) NULL);
res.rlr_status = NFS_OK;
if (groupid == hlfs_gid) {
nfsproc_readdir_2_svc(nfsreaddirargs *argp, struct svc_req *rqstp)
{
static nfsreaddirres res;
- static nfsentry slinkent = {SLINKID, 0, {SLINKCOOKIE}};
+ static nfsentry slinkent = {SLINKID, NULL, {SLINKCOOKIE}};
static nfsentry dotdotent = {ROOTID, "..", {DOTDOTCOOKIE}, &slinkent};
static nfsentry dotent = {ROOTID, ".", {DOTCOOKIE}, &dotdotent};
if (eq_fh(&argp->rda_fhandle, &slink)) {
res.rdr_status = NFSERR_NOTDIR;
} else if (eq_fh(&argp->rda_fhandle, &root)) {
- gettimeofday((struct timeval *) &rootfattr.na_atime, (struct timezone *) 0);
+ gettimeofday((struct timeval *) &rootfattr.na_atime, (struct timezone *) NULL);
res.rdr_status = NFS_OK;
switch (argp->rda_cookie[0]) {
res.rdr_u.rdr_reply_u.dl_entries = &slinkent;
break;
case SLINKCOOKIE:
- res.rdr_u.rdr_reply_u.dl_entries = (nfsentry *) 0;
+ res.rdr_u.rdr_reply_u.dl_entries = (nfsentry *) NULL;
break;
}
res.rdr_u.rdr_reply_u.dl_eof = TRUE;
#if 0
post_op_attr obj_attributes;
post_op_attr dir_attributes;
-#endif
+#endif /* 0 */
};
typedef struct am_LOOKUP3resok am_LOOKUP3resok;
struct am_LOOKUP3resfail {
#if 0
post_op_attr dir_attributes;
-#else
+#else /* !0 */
char dummy; /* cannot have an empty declaration */
-#endif
+#endif /* !0 */
};
typedef struct am_LOOKUP3resfail am_LOOKUP3resfail;
#ifdef MOUNT_TABLE_ON_FILE
char *zopts = NULL, *xopts = NULL;
#endif /* MOUNT_TABLE_ON_FILE */
- char *mnt_dir = 0;
+ char *mnt_dir = NULL;
#ifdef NEED_AUTOFS_SPACE_HACK
- char *old_mnt_dir = 0;
+ char *old_mnt_dir = NULL;
/* perform space hack */
if (on_autofs) {
old_mnt_dir = mnt->mnt_dir;
char *sp = (char *) xmalloc(len + 1);
memmove(sp, s, len);
- sp[len] = 0;
+ sp[len] = '\0';
return sp;
}
{
char *sp = (char *) xmalloc(len + 1);
memmove(sp, str, len);
- sp[len] = 0;
+ sp[len] = '\0';
return sp;
}
#if 0
if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
return (FALSE);
-#endif
+#endif /* 0 */
return (TRUE);
}
return (FALSE);
if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
return (FALSE);
-#endif
+#endif /* 0 */
return (TRUE);
}
{"test", D_TEST}, /* Full debug - no daemon, no amq, local mtab */
{"trace", D_TRACE}, /* Protocol trace */
{"xdrtrace", D_XDRTRACE}, /* Trace xdr routines */
- {0, 0}
+ {NULL, 0}
};
#endif /* DEBUG */
{"user", XLOG_USER}, /* Non-fatal user errors */
{"warn", XLOG_WARNING}, /* Warnings */
{"warning", XLOG_WARNING}, /* Warnings */
- {0, 0}
+ {NULL, 0}
};
show_time_host_and_name(int lvl)
{
static time_t last_t = 0;
- static char *last_ctime = 0;
+ static char *last_ctime = NULL;
time_t t;
#if defined(HAVE_CLOCK_GETTIME) && defined(DEBUG)
struct timespec ts;
while (p && *p) {
int neg;
char *opt;
- struct opt_tab *dp, *dpn = 0;
+ struct opt_tab *dp, *dpn = NULL;
s = p;
p = strchr(p, ',');
char *testhost, *proto, *tmp_buf;
int nv, ret;
struct sockaddr_in *ip;
- struct hostent *hp = 0;
+ struct hostent *hp = NULL;
am_set_progname(argv[0]);