and 1 BUFSIZ for the rest */
cptr = ctime (&appt->appt_id.tick);
- cptr[24] = NULL; /* strip off CR */
+ cptr[24] = '\0'; /* strip off CR */
- buf[0] = NULL;
+ buf[0] = '\0';
switch (op) {
case _DtCmsLogAdd:
sprintf(buf, "(add \"%s\" key: %ld ", cptr, appt->appt_id.key);
}
if (appt->period.enddate != 0) {
cptr = ctime (&(appt->period.enddate));
- cptr[24] = NULL; /* strip off CR */
+ cptr[24] = '\0'; /* strip off CR */
sprintf(buf2, "enddate: \"%s\" ", cptr);
strcat(buf, buf2);
}
fprintf(stderr, "*** V4 appointement: ***\n\n");
tmstr = ctime (&appt->appt_id.tick);
- tmstr[24] = NULL; /* strip off CR */
+ tmstr[24] = '\0'; /* strip off CR */
if (fprintf(stderr, "(add \"%s\" ", tmstr)==EOF) {
return (B_TRUE);
return (B_TRUE);
}
- buf[0]=NULL;
+ buf[0] = '\0';
periodtostr (appt->period.period, buf);
if (fprintf(stderr, "period: %s ", buf) == EOF)
return (B_TRUE);
}
if (appt->period.enddate != 0) {
tmstr = ctime (&(appt->period.enddate));
- tmstr[24] = NULL; /* strip off CR */
+ tmstr[24] = '\0'; /* strip off CR */
if (fprintf(stderr, "enddate: \"%s\" ", tmstr) == EOF)
return (B_TRUE);
}
if (fprintf(stderr, "tags: (") == EOF)
return (B_TRUE);
while(item != NULL) {
- buf[0]=NULL;
+ buf[0] = '\0';
tagstostr(item->tag, buf);
if (fprintf(stderr, "(%s , %d)", buf, item->showtime)
== EOF)
}
- buf[0]=NULL;
+ buf[0] = '\0';
apptstatustostr(appt->appt_status, buf);
if (fprintf(stderr, "apptstat: %s ", buf) == EOF)
return (B_TRUE);
- buf[0]=NULL;
+ buf[0] = '\0';
privacytostr(appt->privacy, buf);
if (fprintf(stderr, "privacy: %s )\n", buf) == EOF)
return (B_TRUE);
return;
/* truncate log file to specified size */
- if ((f = open(log, O_RDWR | O_APPEND | O_SYNC)) >= 0)
- ftruncate(f, size);
+ if ((f = open(log, O_RDWR | O_APPEND | O_SYNC)) >= 0) {
+ if(-1 == ftruncate(f, size)) {
+ perror(strerror(errno));
+ }
+ }
free(log);
}
tmval = time((time_t *) 0);
tm = _XLocaltime(&tmval, localtime_buf);
tmstr = _XAsctime(tm, asctime_buf);
- tmstr[24] = NULL; /* strip off CR */
+ tmstr[24] = '\0'; /* strip off CR */
if ((fd = open(file, O_WRONLY|O_TRUNC|O_SYNC)) < 0) {
if (debug)
- fprintf(stderr, "%s: failed to open %s in %s\n",
- pgname, file, _DtCmsWriteVersionString);
+ fprintf(stderr, "%s: failed to open %s\n",
+ pgname, file);
return (CSA_X_DT_E_BACKING_STORE_PROBLEM);
}
#ifdef HPUX
setuid (0);
#else
- seteuid (0);
+ if(-1 == seteuid (0)) {
+ perror(strerror(errno));
+ }
#endif
#endif
}
periodtostr(Interval_4 i, char *q)
{
if (q==NULL) return;
- q[0]=NULL;
+ q[0] = '\0';
switch (i) {
case single_4:
strcpy (q, "single");
privacytostr(Privacy_Level_4 p, char *q)
{
if (q==NULL) return;
- q[0]=NULL;
+ q[0] = '\0';
switch(p) {
case public_4:
strcpy(q, "public");
apptstatustostr(Appt_Status_4 p, char *q)
{
if (q==NULL) return;
- q[0]=NULL;
+ q[0] = '\0';
switch(p) {
case active_4:
strcpy(q, "active");
tagstostr(Event_Type_4 p, char *q)
{
if (q==NULL) return;
- q[0]=NULL;
+ q[0] = '\0';
switch(p) {
case appointment_4:
strcpy(q, "appointment");
CSA_return_code stat;
ptr = strchr(owner, '@');
- if (ptr) *ptr = NULL;
+ if (ptr) *ptr = '\0';
pw = getpwnam (owner);
if (ptr) *ptr = '@';
if (pw == NULL)
status = CSA_X_DT_E_BACKING_STORE_PROBLEM;
perror(pgname);
- ftruncate(f, file_size);
+ if(-1 == ftruncate(f, file_size)) {
+ perror(strerror(errno));
+ status = CSA_X_DT_E_BACKING_STORE_PROBLEM;
+ }
return (status);
}
if ((buf = malloc(BUFSIZ+1)) == NULL) return (NULL);
tcount = BUFSIZ;
- for (i = 1, count = 0, *buf = NULL; i <= num_attr; i++) {
+ for (i = 1, count = 0, *buf = '\0'; i <= num_attr; i++) {
if (attrs[i].value == NULL || (entryattrs &&
(i == CSA_ENTRY_ATTR_NUMBER_RECURRENCES_I ||
/* value string */
body = NULL;
- *tmpbuf2 = NULL;
+ *tmpbuf2 = '\0';
switch (attrs[i].value->type) {
case CSA_VALUE_ENUMERATED:
case CSA_VALUE_SINT32:
tcount += BUFSIZ;
}
strcat(buf, tmpbuf);
- if (*tmpbuf2 != NULL) strcat(buf, tmpbuf2);
+ if (*tmpbuf2 != '\0') strcat(buf, tmpbuf2);
if (body) strcat(buf, body);
strcat(buf, "\")\n");
if (body) free(body);
k++;
}
}
- newstr[k] = NULL;
+ newstr[k] = '\0';
return(newstr);
}