if (ptr2 && strequal(ptr, ptr2)) { /* domains same, can eliminate */
host = Xe_make_ntype(ptr-host_spec+1, XeChar);
strncpy(host, host_spec, ptr-host_spec); /* copy only up to "." */
- host[ptr-host_spec] = NULL; /* NULL terminate copy */
+ host[ptr-host_spec] = '\0'; /* NULL terminate copy */
}
else
host = strdup(host_spec);
if (status = gethostname(buffer, bufsize))
return status; /* failed gethostname */
if (ptr = strstr(buffer, (XeString)"."))
- *ptr = NULL; /* delete domain name if there is one */
+ *ptr = '\0'; /* delete domain name if there is one */
return 0;
}
len = size-1;
strncpy(buf, current_dir, len);
- buf[len] = NULL;
+ buf[len] = '\0';
/* Make sure $PWD is the same as "." before we trust it. */
/* All this is still much faster the getcwd() esp. on UX discless. */
* as done.
*/
if (SPC_pid_list != NULL) {
- for (indx=0; SPC_pid_list[indx] != NULL; indx++)
+ for (indx=0; SPC_pid_list[indx] != 0; indx++)
if (SPC_pid_list[indx] == pid) {
SPC_pid_list[indx] = SPCD_DEAD_PROCESS;
break;
print_protocol_request((XeString) (XeString)" <-- INTERNAL APPLICATION_DIED", prot);
}
else {
- SPC_Change_State(channel, NULL, -1, 0);
+ SPC_Change_State(channel, 0, -1, 0);
if(channel->Terminate_Handler) {
XeSPCGetProcessStatus(channel, &type, &cause);
(* channel->Terminate_Handler)
* If a dead pid entry exists, reuse it; otherwise, must create
* room for the new pid.
*/
- for (i = 0; SPC_pid_list[i] != NULL; i++)
+ for (i = 0; SPC_pid_list[i] != 0; i++)
if (SPC_pid_list[i] == SPCD_DEAD_PROCESS) {
SPC_pid_list[i] = pid;
reuse_pid = 1;
}
if (!reuse_pid) {
SPC_pid_list[i] = pid;
- SPC_pid_list[i+1] = NULL;
+ SPC_pid_list[i+1] = 0;
}
_DtSvcProcessUnlock();
struct servent *service;
- conn->sid=socket(type, SOCK_STREAM, NULL);
+ conn->sid=socket(type, SOCK_STREAM, 0);
if(conn->sid == ERROR) {
SPC_Error(SPC_Bad_Socket);
return(SPC_ERROR);
#if defined(__aix)
if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))==ERROR) {
#else
- if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, NULL, NULL)==ERROR) {
+ if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, NULL, 0)==ERROR) {
#endif
SPC_Error(SPC_Bad_Reuse);
return(SPC_ERROR);
/*----------------------------------------------------------------------+*/
{
object *p=(object *) XeMalloc((unsigned) c->object_size);
- memset(p, NULL, (int) c->object_size);
+ memset(p, 0, (int) c->object_size);
return(p);
}
(XeString) "/dev/null", /* Master PTY */
(XeString) "/dev/null", /* Slave PTY */
0, 0, /* Toolkit IDs */
- NULL /* pointer to next wire */
+ 0 /* pointer to next wire */
};
/*----------------------------------------------------------------------+*/
{
int type, cause;
- SPC_Change_State(channel, NULL, -1, 0);
+ SPC_Change_State(channel, 0, -1, 0);
/* Set the close timeout. If we are on a PTY, we will return
after two seconds if we are waiting for EOF */
/* Move to the "Running & (possibly) data ready" state */
- SPC_Change_State(channel, NULL, flag, 1);
+ SPC_Change_State(channel, 0, flag, 1);
return(TRUE);
_DtSvcProcessLock();
conn=(SPC_Connection_Ptr) XeMalloc(sizeof(SPC_Connection));
/* Zero the connection */
- memset(conn, NULL, sizeof(SPC_Connection));
+ memset(conn, 0, sizeof(SPC_Connection));
conn->queued_remote_data = Xe_make_queue(FALSE);
conn->termination_id = (-1);
/* Init the socket id to "-1" because "0" is a valid file descriptor. */
if(!connection->connected)
return(SPC_ERROR);
- if((prot=SPC_New_Protocol_Ptr(NULL, NULL, NULL))==SPC_ERROR) {
+ if((prot=SPC_New_Protocol_Ptr(NULL, 0, 0))==SPC_ERROR) {
SPC_Close_Connection(connection);
return(SPC_ERROR);
}
if(this_str == NULL)
this_str = NULL_STR;
- if(*this_str == NULL)
+ if(*this_str == '\0')
this_str = EMPTY_STR;
tmp_len=strlen(this_str)+1; /* Room for NULL char */
if((bytes_left-tmp_len) < 1) {
- *buf=NULL;
+ *buf='\0';
prot->dataptr->len=numbytes+1;
SPC_Write_Single_Prot_Request(connection, name, prot);
SPC_Free_Protocol_Ptr(prot);
}
if(numbytes) {
- *buf=NULL;
+ *buf='\0';
prot->dataptr->len=numbytes+1;
SPC_Write_Single_Prot_Request(connection, (XeString)" <-- ENVIRON_RESET", prot);
SPC_Free_Protocol_Ptr(prot);
len=strlen(bufptr)+1; /* len is string SIZE (with room for NULL) */
*tmpidx=(XeString)XeMalloc(len);
strncpy(*tmpidx, bufptr, len);
- (*tmpidx)[len-1]=NULL;
+ (*tmpidx)[len-1]='\0';
bufptr+= len;
}
*tmpidx=NULL;
Wire *tmp_wire;
tmp_wire=(Wire *)XeMalloc(sizeof(Wire));
- memset(tmp_wire, NULL, sizeof(Wire));
+ memset(tmp_wire, 0, sizeof(Wire));
tmp_wire->master_name=(XeString)XeMalloc(PTY_NAMLEN);
- memset(tmp_wire->master_name, NULL, PTY_NAMLEN);
+ memset(tmp_wire->master_name, 0, PTY_NAMLEN);
tmp_wire->slave_name =(XeString)XeMalloc(PTY_NAMLEN);
- memset(tmp_wire->slave_name, NULL, PTY_NAMLEN);
+ memset(tmp_wire->slave_name, 0, PTY_NAMLEN);
tmp_wire->fd[0] = tmp_wire->fd[1] = (-1);
tmp_wire->read_toolkit_id = (-1);
tmp_wire->except_toolkit_id = (-1);
int retval;
/* Dup file descriptors. If a null descriptor, then use /dev/null */
- static int devnull = NULL;
+ static int devnull = 0;
if (from == to)
return(TRUE);
av = (XeString *)XeMalloc((n + 1) * sizeof(XeString));
/* Zero the space so we don't have to worry about trailing NULL */
- memset((XeString) av, NULL, (n + 1) * sizeof(XeString));
+ memset((XeString) av, 0, (n + 1) * sizeof(XeString));
return(av);
}
if(next_colon) { /* found colon */
path_component_len = next_colon-path_rest;
strncpy(buffer, path_rest, path_component_len);
- buffer[path_component_len]=NULL;
+ buffer[path_component_len]='\0';
path_rest=next_colon+1;
if(!*path_rest)
/* We've seen a ':' at the end of the string. Make path_rest be "."
if(!buffer[0]) {
buffer[0] = '.';
- buffer[1] = NULL;
+ buffer[1] = '\0';
}
/*
if (SPC_Fd_Mapping == NULL) {
SPC_Fd_Mapping = (SPC_Callback_Struct **)
XeMalloc (FD_SETSIZE * sizeof (SPC_Callback_Struct *));
- memset(SPC_Fd_Mapping, NULL, FD_SETSIZE * sizeof(SPC_Callback_Struct *));
+ memset(SPC_Fd_Mapping, 0, FD_SETSIZE * sizeof(SPC_Callback_Struct *));
}
structptr=SPC_LOOKUP_FD_MAPPING(source);
if (SPC_Fd_Mapping == NULL) {
SPC_Fd_Mapping = (SPC_Callback_Struct **)
XeMalloc (FD_SETSIZE * sizeof (SPC_Callback_Struct *));
- memset(SPC_Fd_Mapping, NULL, FD_SETSIZE * sizeof(SPC_Callback_Struct *));
+ memset(SPC_Fd_Mapping, 0, FD_SETSIZE * sizeof(SPC_Callback_Struct *));
}
structptr=SPC_LOOKUP_FD_MAPPING(source);
_DtSvcProcessUnlock();
}
- return NULL;
+ return 0;
}
/*-----------------------------------------------------------------------+*/
*/
return NULL;
}
- myassert(invp->id != NULL );
+ myassert(invp->id != 0);
SET_INV_PENDING(invp->state);
invp->w = w;
- invp->numChildren = NULL;
+ invp->numChildren = 0;
invp->childRec = NULL;
/*
CallbackData *data=(CallbackData *)XtMalloc((Cardinal)sizeof(CallbackData));
ActionPtr action = request->clonedAction;
- tmpFileBuf[0]=NULL; /* seed the buffer with a null string */
+ tmpFileBuf[0]='\0'; /* seed the buffer with a null string */
/*
* Generate the procId option string for dtexec
/*
* The string generated for procId should never exceed the procId buf size.
*/
- sprintf(procIdBuf,"%s_%d_%d",
+ sprintf(procIdBuf,"%s_%d_%lu",
_DtActNULL_GUARD(procId),
- request->invocId,
+ (int) request->invocId,
request->childId );
myassert( strlen(procIdBuf) < sizeof(procIdBuf) );
* Create the full path name relative to curHost
*/
- buf[0]=NULL; /* empty string to start with */
+ buf[0]='\0'; /* empty string to start with */
if ( dir )
strcpy(buf,dir);
}
/* We should have constructed a file name string now */
- myassert(buf[0] != NULL);
+ myassert(buf[0] != '\0');
if (newHost)
{
_DtACTION_DT_NGROUP, _ActDb_DT_NGROUP_SET,
_DtPFX _DtACTION_DTN_VALUE, _ActDb_DT_ARGN_VAL_SET,
#endif /* _DT_ALLOW_DT_MSGS */
- NULL, NULL
+ NULL, 0
};
#define NUM_FIELD_NAMES sizeof(_DtActNamesAndBits)/sizeof(_DtActNameAndBit) - 1
#endif /* _DT_ALLOW_DT_MSGS */
if ( !np )
- return NULL;
+ return 0;
/*
* Check for [DT]T_ARGn_ fields
* The following code assumes that a unique suffix identifying each
#endif /* _DT_ALLOW_DT_MSGS */
if ( !np )
- return NULL;
+ return 0;
for ( j = 0; j < NUM_FIELD_NAMES; j++ )
if ( !strcmp(_DtActNamesAndBits[j].name,np) )
/*
* temporarily truncate string for testing
*/
- *p = NULL;
+ *p = '\0';
if ( strcmp(_DtACT_ANY,start) &&
strcmp(_DtACTION_FILE,start) &&
strcmp(_DtACTION_BUFFER,start) )
return (char *) -1;
}
}
- if (*p == NULL)
+ if (*p == '\0')
{
/* looks like an error */
buf = malloc(_DtAct_MAX_BUF_SIZE);
_DtSvcProcessUnlock();
return(True);
}
- else if ( fields[1].fieldName == NULL)
+ else if ( fields[1].fieldName == 0)
{
/* The record contains no fields */
buf = XtMalloc(_DtAct_MAX_BUF_SIZE);
/* find the corresponding field entry and bitmask */
- if ((ThisBit = _DtActFieldBitLookup(XrmQuarkToString(fields[i].fieldName))) != NULL)
+ if ((ThisBit = _DtActFieldBitLookup(XrmQuarkToString(fields[i].fieldName))) != 0)
{
switch ((int)(fieldVal=_DtActValidateFieldValue(ThisBit,
fields[i].fieldValue, fields[0].fieldValue,
static unsigned long
_DtActMMParseArgTypesList(char *tlist, DtShmBoson **quarkAddr, int *countp)
{
- static DtShmBoson quark_for_wild_char = NULL;
- unsigned long mask = NULL;
+ static DtShmBoson quark_for_wild_char = 0;
+ unsigned long mask = 0;
int tcount;
DtShmBoson *qp;
char **typeVec, **tvp;
char buf[_DtAct_MAX_BUF_SIZE];
char *bp;
char **classVec, **cvp;
- unsigned long mask = NULL;
+ unsigned long mask = 0;
if ( !DtStrchr(clist, _DtACT_LIST_SEPARATOR_CHAR ) )
{
static unsigned long
_DtActMMParseArgCountString( char *countStr, int *countp)
{
- unsigned long mask = NULL;
+ unsigned long mask = 0;
if ( !strcmp(countStr,_DtACT_ANY) )
return SET_ARG_COUNT_WILD(mask);
static unsigned long
_DtActMMParseActionType(char *actionTypeStr)
{
- unsigned long mask = NULL;
+ unsigned long mask = 0;
if ( !strcmp(actionTypeStr,_DtACTION_COMMAND) )
return SET_CMD_ACTION(mask);
return NULL;
/* Work on a local copy of the original string */
- *p = NULL;
+ *p = '\0';
(void)strcpy(p,s);
#ifdef _Dt_HOST_COLON_PATH_SUPPORT
myassert( *basep == '/');
if ( basep == p )
return XtNewString(basep);
- *basep = NULL; /* replace trailing slash */
+ *basep = '\0'; /* replace trailing slash */
if ( (basep = DtStrrchr(p,'/')) == NULL )
return XtNewString(p);
}
/* Work on a local copy of the original string */
- *p = NULL;
+ *p = '\0';
(void)strcpy(p,s);
#ifdef _Dt_HOST_COLON_PATH_SUPPORT
* -- then try again else break
*/
if ( slashp == DtPrevChar(p,p + strlen(p)) )
- *slashp = NULL;
+ *slashp = '\0';
else
break;
}
* directory name.
*/
dirp = XtNewString(p);
- *(dirp + (slashp - p)) = NULL;
+ *(dirp + (slashp - p)) = '\0';
return dirp;
}
* Make a local copy of the string to avoid problems modifying
* "const" strings.
*/
- *p = NULL;
+ *p = '\0';
(void) strcpy(p,s);
/* if ( (slashp > s) && (*(slashp -1) == ':' )) */
if ( (slashp > s) && (*DtPrevChar(s,slashp) == ':' ))
{
/* *(p + (slashp - s - 1)) = NULL; */
- *(p + (DtPrevChar(s,slashp) - s)) = NULL;
+ *(p + (DtPrevChar(s,slashp) - s)) = '\0';
host = XtNewString(p);
return host;
}
}
tmpName = XtMalloc(MAXHOSTNAMELEN + 5);
- tmpName[0] = NULL;
+ tmpName[0] = '\0';
if ( dp )
{
strcpy(tmpName,DisplayString(dp));
if ( tmp = DtStrrchr(tmpName,':') )
{
- *tmp = NULL;
+ *tmp = '\0';
displayHostName = XtNewString(tmpName);
}
}
strcpy(tmpName,getenv("DISPLAY"));
if ( tmp = DtStrrchr(tmpName,':') )
{
- *tmp = NULL;
+ *tmp = '\0';
displayHostName = XtNewString(tmpName);
}
}
return NULL; /* failed gethostname */
}
if (ptr = DtStrchr(hostNameBuf, '.'))
- *ptr = NULL; /* delete domain name if there is one */
+ *ptr = '\0'; /* delete domain name if there is one */
localHostName = hostNameBuf;
_DtSvcProcessUnlock();
* to their short form before doing the compare.
*/
if ( (tp = DtStrchr(hostName1,'.')) != NULL )
- *tp = NULL;
+ *tp = '\0';
if ( (tp = DtStrchr(hostName2,'.')) != NULL )
- *tp = NULL;
+ *tp = '\0';
/*
* Try to avoid querying the name server (or /etc/hosts).
*/
strcpy(hostName1, host_ret->h_name);
if ( (tp = DtStrchr(hostName1,'.')) != NULL )
- *tp = NULL;
+ *tp = '\0';
/*
* Try comparing again -- avoiding another gethostbyname
* of the tmp file name (i.e. no %s in format) then
* there is no sense trying more than once.
*/
- if ( countTrys > 0 && (strcmp(f,nameBuf) == NULL))
+ if ( countTrys > 0 && (strcmp(f,nameBuf) == 0))
return NULL;
base = XtNewString(nameBuf);
for ( p = DtPrevChar(*s,*s + strlen(*s));
DtIsspace(p) && (p > *s);
p=DtPrevChar(*s,p))
- *p = NULL;
+ *p = '\0';
}
if (IS_BUFFER_OBJ(infop->mask) && IS_FILE_OBJ(infop->mask))
{
- myassert((infop->name!=NULL) && (*infop->name!=NULL));
+ myassert((infop->name != NULL) && (*infop->name != '\0'));
if ( !infop->name )
continue;
/*
tchildRec = invRec->childRec[invRec->numChildren - 1]; /* shorthand */
- memset(tchildRec, NULL, sizeof(_DtActChildRecT));
+ memset(tchildRec, 0, sizeof(_DtActChildRecT));
tchildRec->childId = invRec->numChildren; /* serial # of sorts */
/* tchildRec->u.* = initialized elsewhere */
buf = (char *) XtMalloc(MAX_BUF_SIZE);
for (size=0, space=MAX_BUF_SIZE;
- (bytes=read(fd,buf+size,space)) != NULL;
+ (bytes=read(fd,buf+size,space)) != 0;
size += bytes )
{
if ( bytes < 0 )
strlen (pNode->exec_host) +
cmdlen + 4);
cmdp = (char *) XtMalloc(cmdlen + 1);
- *cmdp = NULL;
+ *cmdp = '\0';
for (i = 0; pNode->argv[i]; i++) {
strcat(cmdp,pNode->argv[i]);
strcat(cmdp, " ");
switch ( windowTypeMask )
{
case _DtAct_NO_STDIO_BIT:
- winTypeNum = NULL;
+ winTypeNum = 0;
break;
case _DtAct_TERMINAL_BIT:
winTypeNum = TERMINAL;
*NumberFieldsAllocated += NUMBER_FIELDS_INCREMENT;
}
- (*fields)[*slotToUse].fieldName = NULL;
+ (*fields)[*slotToUse].fieldName = 0;
(*fields)[*slotToUse].fieldValue = NULL;
/* A NULL ptr is how we force a NULL entry to terminate the array */
static XID contextXID;
_DtSvcProcessLock();
- if (contextXID == NULL) {
+ if (contextXID == 0) {
contextXID = XCreatePixmap(display,
DefaultRootWindow(display), 1, 1, 1);
}
if((info->buffer = mmap(NULL,
buf->st_size,
PROT_READ, MAP_PRIVATE,
- info->file_fd, NULL)) == (char *)-1)
+ info->file_fd, 0)) == (char *)-1)
{
info->mmap_size_to_free = -1;
info->size_to_free = buf->st_size+1;
MAP_SHARED,
#endif
mmaped_fd,
- NULL);
+ 0);
if(mmaped_db != (void *) -1)
{
success = TRUE;
Window wroot, wparent, *pchildren;
unsigned int nchildren;
- *pMwmWindow = NULL;
+ *pMwmWindow = 0;
if ((rcode=XGetWindowProperty(display,root,
property,0L, PROP_MWM_INFO_ELEMENTS,
False,property,
************************************<+>*************************************/
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
/*********************************************************************
* _DtQualifyWithFirst
Window wroot, wparent, *pchildren;
unsigned int nchildren;
- *pSmWindow = NULL;
+ *pSmWindow = 0;
if ((rcode=XGetWindowProperty(display,root,
property,0L, PROP_DT_SM_WINDOW_INFO_ELEMENTS,
False,property,
char *string;
Atom atom;
} smAtomList[] = {
- {_XA_DT_SM_STATE_INFO, NULL},
- {_XA_DT_SM_SAVER_INFO, NULL},
+ {_XA_DT_SM_STATE_INFO, 0},
+ {_XA_DT_SM_SAVER_INFO, 0},
};
static Atom
int ret = *bucket;
- if(*bucket == NULL) /* new */ {
+ if(*bucket == 0) /* new */ {
unsigned char ** sptr;
*isnew = 1;
*bucket = ret = ptr->sl_charcount;
* then put our dt string just ahead of
* "/usr/bin/X11" in the new PATH
*/
- *(ptr - 1) = NULL;
+ *(ptr - 1) = '\0';
sprintf(_postDtEnvironment.binPath,
"%s=%s:%s:%s",
BIN_PATH_ENVIRON,
* "/usr/bin" in the new PATH
*/
- *(ptr - 1) = NULL;
+ *(ptr - 1) = '\0';
sprintf(_postDtEnvironment.binPath,
"%s=%s:%s:%s",
BIN_PATH_ENVIRON,
if (status = gethostname(buffer, bufsize))
return status; /* failed gethostname */
if (ptr = strstr(buffer, (char *)"."))
- *ptr = NULL; /* delete domain name if there is one */
+ *ptr = '\0'; /* delete domain name if there is one */
return 0;
}
/*** otherwise, make it relative to the current directory ***/
/* get user's current working directory */
- if (getcwd(tmpPath, MAXPATHLEN) == NULL) return NULL; /* RETURN: error */
+ if (getcwd(tmpPath, MAXPATHLEN) == 0) return NULL; /* RETURN: error */
/*** add a slash to end of path component, if needed ***/
/* get end of the string */
int actualFormat;
unsigned long nitems, leftover;
- if((data == NULL) || (*data == NULL))
+ if((data == NULL) || (*data == '\0'))
{
return;
}