dtcm: Resolve 303 compiler warnings.
authorPeter Howkins <flibble@users.sf.net>
Tue, 13 Jan 2015 14:22:25 +0000 (14:22 +0000)
committerPeter Howkins <flibble@users.sf.net>
Tue, 13 Jan 2015 14:22:25 +0000 (14:22 +0000)
44 files changed:
cde/programs/dtcm/dtcm/MonthPanel.c
cde/programs/dtcm/dtcm/blist.c
cde/programs/dtcm/dtcm/browser.c
cde/programs/dtcm/dtcm/calendarA.c
cde/programs/dtcm/dtcm/cm_delete.c
cde/programs/dtcm/dtcm/cm_insert.c
cde/programs/dtcm/dtcm/cm_lookup.c
cde/programs/dtcm/dtcm/dayglance.c
cde/programs/dtcm/dtcm/dnd.c
cde/programs/dtcm/dtcm/dssw.c
cde/programs/dtcm/dtcm/dtcm_editor.c
cde/programs/dtcm/dtcm/editor.c
cde/programs/dtcm/dtcm/find.c
cde/programs/dtcm/dtcm/font.c
cde/programs/dtcm/dtcm/format.c
cde/programs/dtcm/dtcm/goto.c
cde/programs/dtcm/dtcm/graphics.c
cde/programs/dtcm/dtcm/group_editor.c
cde/programs/dtcm/dtcm/help.c
cde/programs/dtcm/dtcm/icon.c
cde/programs/dtcm/dtcm/misc.c
cde/programs/dtcm/dtcm/monthglance.c
cde/programs/dtcm/dtcm/print.c
cde/programs/dtcm/dtcm/props_pu.c
cde/programs/dtcm/dtcm/session.c
cde/programs/dtcm/dtcm/submit.c
cde/programs/dtcm/dtcm/todo.c
cde/programs/dtcm/dtcm/weekglance.c
cde/programs/dtcm/dtcm/x_graphics.c
cde/programs/dtcm/libDtCmP/cm_tty.c
cde/programs/dtcm/libDtCmP/timeops.c
cde/programs/dtcm/libDtCmP/util.c
cde/programs/dtcm/server/callback.c
cde/programs/dtcm/server/cmscalendar.c
cde/programs/dtcm/server/cmsfunc.c
cde/programs/dtcm/server/lexit.c
cde/programs/dtcm/server/log.c
cde/programs/dtcm/server/parser.y
cde/programs/dtcm/server/reclotick.c
cde/programs/dtcm/server/repeat.c
cde/programs/dtcm/server/rerule.c
cde/programs/dtcm/server/reutil.c
cde/programs/dtcm/server/svcmain.c
cde/programs/dtcm/server/v5ops.c

index d884f84178ac08f43df04bafa85f389ab4c2dccb..8290e198b6ef487bf93d77619062cf2df516a47a 100644 (file)
@@ -389,7 +389,7 @@ Initialize( Widget rw, Widget nw, ArgList args, Cardinal *num_args )
           if (new_w->month_panel.active_days) {
                btn = XmCreatePushButtonGadget((Widget)new_w, buf, wargs, 1);
                XtAddCallback(btn, XmNactivateCallback, DayCallback,
-                       (XtPointer)(i+1));
+                       (XtPointer) (intptr_t) (i+1));
           }
           else {
                btn = XmCreateLabelGadget((Widget) new_w, buf, wargs, 1);
@@ -906,7 +906,7 @@ static void DayCallback(Widget w, XtPointer client, XtPointer call)
    XmMonthPanelCallbackStruct data;
 
    data.type = DAY_SELECTION;
-   data.day = (int) client;
+   data.day = (intptr_t) client;
 
    XtCallCallbackList((Widget) mp, mp->month_panel.callback, &data);
 }
index 3d30226b75a4bc5c1a61fd3ca4237666d10538ce..37bcd9031d8074a04a0d710f7160224cd6cd4d3c 100644 (file)
@@ -248,7 +248,7 @@ blist_name_append(Calendar *c, char *name, BlistTag t) {
         bd = (BlistData *)ckalloc(sizeof(BlistData));
         bd->name = cm_strdup(name);
         bd->tag = t;
-        bd->cal_handle = NULL;
+        bd->cal_handle = 0;
         CmDataListAdd(bl->blist_data, (void *)bd, location);
  
         return location;
@@ -290,7 +290,7 @@ blist_addname(Widget widget, XtPointer client_data, XtPointer cbs) {
               ((*(end_ptr - 1) == ' ') || (*(end_ptr - 1) == '\t')))
                end_ptr--;
 
-       *end_ptr = NULL;
+       *end_ptr = '\0';
 
 
        if (blank_buf(new_name)) {
@@ -453,7 +453,7 @@ blist_init_names(Calendar *c) {
        blist_name_append(c, get_char_prop(p, CP_DEFAULTCAL), BLIST_ACTIVE);
 
         namelist = cm_strdup(get_char_prop(p, CP_DAYCALLIST));
-        if (namelist == NULL || *namelist == NULL )
+        if (namelist == NULL || *namelist == '\0' )
                return;
 
        name = strtok(namelist, " ");
@@ -496,7 +496,7 @@ blist_clean(Browselist *bl, Boolean clean_all) {
        cnt = bl->blist_data->count;
        for (i = 1; i <= cnt; i++) {
                bd = (BlistData *)CmDataListGetData(bl->blist_data, left_cnt);
-               if (bd && bd->cal_handle == NULL &&
+               if (bd && bd->cal_handle == 0 &&
                    (clean_all || bd->tag != BLIST_ACTIVE)) {
                        if (bd->name)
                                free(bd->name);
index ff51914a8fd534445396e75bf2f5624b3765d0a6..94fb735be79cd99a6063a1f1810fa1b5c356903c 100644 (file)
@@ -376,7 +376,7 @@ make_browser(Calendar *c)
         * remember - this returns a RowColumn widget!
         */
        b->gotomenu = XmVaCreateSimpleOptionMenu(b->upper_form,
-                "goToOptionMenu", goto_label, NULL, 0, gotomenu_cb,
+                "goToOptionMenu", goto_label, 0, 0, gotomenu_cb,
                 XmVaPUSHBUTTON, prev_week, NULL, NULL, NULL,
                 XmVaPUSHBUTTON, this_week, NULL, NULL, NULL,
                 XmVaPUSHBUTTON, next_week, NULL, NULL, NULL,
@@ -749,7 +749,7 @@ void mb_update_busystatus(Browser *b, Calendar *c)
 
                if (bd->cache == NULL) {
                        setup_range(&range_attrs, &ops, &r_cnt, start, stop, 
-                                       CSA_TYPE_EVENT, NULL, B_FALSE, bd->version);
+                                       CSA_TYPE_EVENT, 0, B_FALSE, bd->version);
                        stat = csa_list_entries(bd->cal_handle, r_cnt, range_attrs, ops, &num_entries, &entries, NULL);
                                free_range(&range_attrs, &ops, r_cnt);
                        backend_err_msg(b->frame, bd->name, stat,
@@ -884,7 +884,7 @@ get_mail_address_list(Calendar *c) {
        }
 
        address = calloc(address_len+1, 1);
-       address[0] = NULL;
+       address[0] = '\0';
 
        for (i = 0; i < pos_cnt; i++) {
                bd = (BlistData *)CmDataListGetData(bl->blist_data,
@@ -972,7 +972,7 @@ nt */
 static void
 gotomenu_cb(Widget w, XtPointer data, XtPointer cbs) 
 {
-       int     item_no = (int) data;
+       int     item_no = (int) (intptr_t) data;
        /* should really be getting this from the widget */
        Calendar *c = calendar;
 
@@ -1061,7 +1061,7 @@ mb_update_array(char *entry_text, Calendar *c)
        if (bd->cache == NULL) {
                setup_range(&range_attrs, &ops, &r_cnt, start, 
                        stop, CSA_TYPE_EVENT,
-                       NULL, B_FALSE, bd->version);
+                       0, B_FALSE, bd->version);
                stat = csa_list_entries(bd->cal_handle, r_cnt, range_attrs, 
                                        ops, &num_entries, &entries, NULL);
                free_range(&range_attrs, &ops, r_cnt);
@@ -1216,7 +1216,7 @@ mb_deregister_names(char *name, Calendar *c)
                        backend_err_msg(b->frame, bd->name, stat,
                                        p->xm_error_pixmap);
                }
-               bd->cal_handle = NULL;
+               bd->cal_handle = '\0';
                blist_clean(bl, False);
         }
 }
index a53f8db513f9c11883859077857e8104306d8962..300d5b58f8ca62935820a4b5fcf67dd5a0e2c352 100644 (file)
@@ -964,25 +964,25 @@ set_default_view(Calendar *c)
  */
 void view_day_cb(Widget w, XtPointer data, XtPointer cbs)
 {
-       if ((int) data == 0)
+       if ((intptr_t) data == 0)
                day_button(w, data, cbs);
 }
 
 void view_week_cb(Widget w, XtPointer data, XtPointer cbs)
 {
-       if ((int) data == 0)
+       if ((intptr_t) data == 0)
                week_button(w, data, cbs);
 }
 
 void view_month_cb(Widget w, XtPointer data, XtPointer cbs)
 {
-       if ((int) data == 0)
+       if ((intptr_t) data == 0)
                month_button(w, data, cbs);
 }
 
 void view_year_cb( Widget w, XtPointer data, XtPointer cbs)
 {
-       if ((int) data == 0)
+       if ((intptr_t) data == 0)
                (void) year_button(w, data, cbs);
 }
 
@@ -1112,9 +1112,9 @@ edit_cb( Widget w, XtPointer item_no, XtPointer cbs)
        Calendar *c = calendar;
 
        _DtTurnOnHourGlass(c->frame);
-       if ((int) item_no == 1)
+       if ((intptr_t) item_no == 1)
                show_props_pu(c);
-       else if ((int) item_no == 3)
+       else if ((intptr_t) item_no == 3)
                make_find(c);
        _DtTurnOffHourGlass(c->frame);
 }
@@ -1175,7 +1175,7 @@ appt_cb(Widget w, XtPointer item_no, XtPointer cbs)
        Calendar *c = calendar;
 
        _DtTurnOnHourGlass(c->frame);
-       switch((int) item_no) {
+       switch((intptr_t) item_no) {
        case 0:
                show_editor(c, 0, 0, False);
                break;
@@ -1223,7 +1223,7 @@ edit_menu_cb(Widget w, XtPointer cl_data, XtPointer cbs)
 
 static void 
 browse_cb(Widget w, XtPointer client_data, XtPointer cbs) {
-       int             rcode, idx = (int)client_data;
+       int             rcode, idx = (int) (intptr_t) client_data;
        char            buf[MAXNAMELEN];
        Calendar        *c = calendar;
        Props_pu        *p = (Props_pu *)c->properties_pu;
@@ -1556,7 +1556,7 @@ update_browse_menu_names(Calendar *c) {
                str = (!strcmp(bd->name, c->calname)) ? "calName" : "myName";
                item = XmCreatePushButtonGadget(c->browse_menu, str, al, ac);
                XtAddCallback(item, XmNactivateCallback, browse_cb,
-                             (XtPointer)i);
+                             (XtPointer) (intptr_t) i);
                XmStringFree(xmstr);
        }
 
@@ -2160,12 +2160,12 @@ open_user_calendar(Calendar *c, Boolean retry)
                        NULL, NULL);
 
                /* create the calendar */
-               if ((status = csa_add_calendar(NULL, &csa_user, 1, &attr, NULL))
+               if ((status = csa_add_calendar(0, &csa_user, 1, &attr, NULL))
                    == CSA_E_UNSUPPORTED_ATTRIBUTE) {
                        /* server with version 4 or less does not support
                         * the CSA_CAL_ATTR_CHARACTER_SET cal attribute
                         */
-                       status = csa_add_calendar(NULL, &csa_user, 0, NULL,
+                       status = csa_add_calendar(0, &csa_user, 0, NULL,
                                        NULL);
                }
                if (val.item.string_value) free(val.item.string_value);
@@ -2294,7 +2294,7 @@ logon_retry(XtPointer data, XtIntervalId *dummy)
 {
        Calendar        *c = (Calendar *)data;
        /* retry once */
-       if (c->my_cal_handle == NULL && (open_user_calendar(c, False) == True))
+       if (c->my_cal_handle == 0 && (open_user_calendar(c, False) == True))
        {
                _DtTurnOnHourGlass(c->frame);
                reset_timer(c);
@@ -2461,7 +2461,7 @@ get_user_calendar()
 
        uname = cm_get_uname();
        if ((loc = get_char_prop((Props *)calendar->properties, CP_CALLOC)) &&
-           *loc != NULL) {
+           *loc != '\0') {
                loc = strdup(loc);
                needfree = True;
        } else
@@ -2559,7 +2559,7 @@ init_calendar(argc, argv)
                
                while (*s_ptr)
                        *d_ptr++ = *s_ptr++;
-               *d_ptr++ = NULL;
+               *d_ptr++ = '\0';
        }
        d_ptr = NULL;
 
index 1358698c121aa605dd3450f14ed8d53e4e888b8b..e354115a14f3f809a5fb034a72598a8177fd621c 100644 (file)
@@ -118,7 +118,7 @@ cm_args(int argc, char **argv)
                        argv = grab(++argv,cm_view,'-');
                        break;
                default:
-                       fprintf(stderr,catgets(DT_catd, 1, 187, "Usage:\n\tdtcm_delete [-c calendar] [-d <mm/dd/yy>] [-v view]\n"));
+                       fprintf(stderr, "%s", catgets(DT_catd, 1, 187, "Usage:\n\tdtcm_delete [-c calendar] [-d <mm/dd/yy>] [-v view]\n"));
                        exit(1);
                }
        }
@@ -186,7 +186,7 @@ int main(int argc, char **argv)
                        free(loc);
                        exit(0);
                }
-               fprintf(stdout, catgets(DT_catd, 1, 190,
+               fprintf(stdout, "%s", catgets(DT_catd, 1, 190,
                                       "Item to delete (number)? "));
                fgets(index, 9, stdin);
                fprintf(stdout,"\n\n");
index 05d2281b47f8a47e903062dcd5b502bb6b441f23..5edb3e5f9991013b4b1a53c1cc6b99f4966a729a 100644 (file)
@@ -225,7 +225,7 @@ prompt_for_insert(Props *p) {
 
        printf("%s", catgets(DT_catd, 1, 205, 
                "What (you may enter up to 5 lines, use ^D to finish):\n"));
-       cm_what[0] = NULL;
+       cm_what[0] = '\0';
        for (index = 0; index < 5; index++)
        {
                *what_buffer = '\0';
index f8829ca1ad4111f5b265d462bf4420d34271769f..215dfb3df944b20d8e9e5c3f620b257ac1760f9b 100644 (file)
@@ -115,7 +115,7 @@ cm_args(int argc, char **argv)
                        argv = grab(++argv,cm_view,'-');
                        break;
                default:
-                       fprintf(stderr,catgets(DT_catd, 1, 207, "Usage:\n\tdtcm_lookup [ -c calendar ][ -d <mm/dd/yy> ] [ -v view ]\n"));
+                       fprintf(stderr, "%s", catgets(DT_catd, 1, 207, "Usage:\n\tdtcm_lookup [ -c calendar ][ -d <mm/dd/yy> ] [ -v view ]\n"));
                        exit(1);
                }
        }
index 12aef5cef0fcc1435fa0bcbb053f7969ca18c1ac..0bc9ccf694a421fbb8ab3fde2f7c5315a149d24e 100644 (file)
@@ -211,7 +211,7 @@ paint_dayview_appts(Calendar *c, Paint_cache *cache, int a_total, void *rect)
        for (i = begin_time - 1; i < end_time; i++) {
                hr = i;
                if (i < begin_time)
-                       (void) sprintf(buf, "");
+                       buf[0] = '\0';
                else if (disp_t == HOUR12) {
                        am = adjust_hour(&hr);
                        (void) sprintf(buf, "%d%s", hr, am ? "a" : "p");
@@ -267,7 +267,7 @@ paint_dayview_appts(Calendar *c, Paint_cache *cache, int a_total, void *rect)
                                                appt_str, end_tick, 
                                                cache[i].show_time, disp_t);
                                }
-                               appt_str[cm_strlen(appt_str)]=NULL;
+                               appt_str[cm_strlen(appt_str)] = '\0';
 
 /* REVISIT: unclear why we're still distinguishing between gr_text[_rgb]
                                if (c->xcontext->screen_depth >= 8) 
@@ -337,7 +337,7 @@ paint_dayview_appts(Calendar *c, Paint_cache *cache, int a_total, void *rect)
                                                appt_str, end_tick, 
                                                cache[i].show_time, disp_t);
                                }
-                               appt_str[cm_strlen(appt_str)]=NULL;
+                               appt_str[cm_strlen(appt_str)] = '\0';
 
 /* REVISIT: unclear why we're still distinguishing between gr_text[_rgb]
                                if (c->xcontext->screen_depth >= 8) 
@@ -620,7 +620,7 @@ paint_dayview(Calendar *c, Boolean repaint, XRectangle *rect, Boolean update_mon
        if (c->paint_cache == NULL) {
                start = (time_t) lower_bound(0, c->view->date);
                stop = (time_t) next_nhours(start, end+1) - 1;
-               setup_range(&range_attrs, &ops, &j, start, stop, CSA_TYPE_EVENT, NULL,
+               setup_range(&range_attrs, &ops, &j, start, stop, CSA_TYPE_EVENT, 0,
                        B_FALSE, c->general->version);
                csa_list_entries(c->cal_handle, j, range_attrs, ops, &a_total, &list, NULL);
        
@@ -811,7 +811,7 @@ count_day_pages(Calendar *c, int lines_per_page, Tick tick)
                start = (time_t) lower_bound(i, tick);
                end = (time_t) next_nhours(start+1, 1) - 1;
                setup_range(&range_attrs, &ops, &j, start, end,
-                           CSA_TYPE_EVENT, NULL, B_FALSE, c->general->version);
+                           CSA_TYPE_EVENT, 0, B_FALSE, c->general->version);
                csa_list_entries(c->cal_handle, j, range_attrs, ops, &a_total, &list, NULL);
                free_range(&range_attrs, &ops, j);
 
@@ -888,7 +888,7 @@ _print_day(Calendar *c,
       start = (time_t) lower_bound(i, tick);
       stop = (time_t) next_nhours(start+1, 1) - 1;
       setup_range(&range_attrs, &ops, &j, start, stop,
-                 CSA_TYPE_EVENT, NULL, B_FALSE, c->general->version);
+                 CSA_TYPE_EVENT, 0, B_FALSE, c->general->version);
 
       csa_list_entries(c->cal_handle, j, range_attrs,
                       ops, &a_total, &list, NULL);
index 553c058e214292061e57c96f208c4e7fa27ff288..eeab0afe582e2f189867dca5b60107d840610978 100644 (file)
@@ -178,7 +178,7 @@ handle_animate_cb(
                        drag_load_proc(dnd_filename, c);
        
                        unlink(dnd_filename);
-                       dnd_filename[0] = NULL;
+                       dnd_filename[0] = '\0';
                        break;
                default:
                        return;
@@ -257,7 +257,7 @@ handle_drop_cb(
        
                        if (validate_dropped_appt(dnd_filename, c) == False) {
                                unlink(dnd_filename);
-                               dnd_filename[0] = NULL
+                               dnd_filename[0] = '\0'
                                transfer_info->status = DtDND_FAILURE;
                        }
 #ifdef NOT
@@ -547,7 +547,7 @@ get_appt_struct(DragContext *context) {
                XtFree(ident);
                XtFree(text);
                XtFree(title);
-                return(NULL);
+                return(0);
         }
  
 
@@ -577,7 +577,7 @@ get_appt_struct(DragContext *context) {
                XtFree(ident);
                XtFree(title);
                 XtFree((XtPointer)item_list);
-                return(NULL);
+                return(0);
         }
 
        return entry;
@@ -630,11 +630,11 @@ GetIcon(Calendar *calendar)
         Editor          *e = (Editor *) calendar->editor;
         GEditor         *ge = (GEditor *) calendar->geditor;
  
-        if (e->drag_bitmap == NULL) {
+        if (e->drag_bitmap == 0) {
                 e->drag_bitmap = XCreateBitmapFromData(display,
                         window, (char *) drag_xbm_bits,
                         drag_xbm_width, drag_xbm_height);
-                if (e->drag_bitmap == NULL) {
+                if (e->drag_bitmap == 0) {
 
                         printf("%s", catgets(calendar->DT_catd, 1, 237, "XCreateBitmapFromData() failed for bitmap.\n"));
                         return;
@@ -642,11 +642,11 @@ GetIcon(Calendar *calendar)
                 else
                         ge->drag_bitmap = e->drag_bitmap;
         }
-        if (e->drag_mask == NULL) {
+        if (e->drag_mask == 0) {
                 e->drag_mask = XCreateBitmapFromData(display,
                         window, (char *) drag_mask_xbm_bits,
                         drag_mask_xbm_width, drag_mask_xbm_height);
-                if (e->drag_mask == NULL) {
+                if (e->drag_mask == 0) {
                         printf("%s", catgets(calendar->DT_catd, 1, 238, "XCreateBitmapFromData() failed for mask.\n"));
                         return;
                 }
index f518d9efdd7557215ba0e9f4303526c7adb2a82c..8ab3c8df07f478df7f6cb2cf222289e264df3826 100644 (file)
@@ -116,8 +116,8 @@ dssw_set_start_hour(Widget w, XtPointer client_data, XtPointer cbs) {
        XtVaGetValues(w, XmNuserData, &user_data, NULL);
 
        if (user_data == NO_TIME) {
-               sprintf(dssw->start_val.val, "\0");
-               sprintf(dssw->stop_val.val, "\0");
+               dssw->start_val.val[0] = '\0';
+               dssw->stop_val.val[0]  = '\0';
                dssw->start_val.block = dssw->stop_val.block = TIME_AM;
         } else if (user_data == ALL_DAY) {
                if (dt == HOUR12) {
@@ -172,7 +172,7 @@ dssw_set_stop_hour(Widget w, XtPointer client_data, XtPointer cbs) {
        XtVaGetValues(w, XmNuserData, &user_data, NULL);
 
        if (user_data == NO_TIME) {
-               sprintf(dssw->stop_val.val, "\0");
+               dssw->stop_val.val[0] = '\0';
                dssw->stop_val.block = TIME_AM;
        } else {
                hrs = user_data / hrsec;
@@ -693,7 +693,7 @@ dssw_form_to_todo(DSSW *dssw, Dtcm_appointment *a, char *name, Tick t)
         * Todo does not have end time.  So to distinguish between this
         * and the editor, zero this out.
         */
-       sprintf(dssw->stop_val.val, "\0");
+       dssw->stop_val.val[0] = '\0';
        if (blank_buf(dssw->date_val)) {
                editor_err_msg(dssw->parent, name, MISSING_DATE,
                               pu->xm_error_pixmap);
@@ -833,7 +833,7 @@ dssw_attrs_to_form(DSSW *dssw, Dtcm_appointment *appt) {
                                        minute(end_tick));
                } else {
                        /* no end time */
-                       sprintf(dssw->stop_val.val, "\0");
+                       dssw->stop_val.val[0] = '\0';
                        dssw->stop_val.block = TIME_AM;
                }
        }
@@ -842,7 +842,7 @@ dssw_attrs_to_form(DSSW *dssw, Dtcm_appointment *appt) {
 
        if (what) {
                strncpy(dssw->what_val, what, WHAT_LEN - 1);
-               dssw->what_val[WHAT_LEN-1] = NULL;
+               dssw->what_val[WHAT_LEN-1] = '\0';
        }
 
        set_dssw_vals(dssw, tick);
index 0c41f72a2b6399eb9e7b5e47bb3bf34054945073..5e6b7465481c629f24f196b9a9716e7f9484b30c 100644 (file)
@@ -244,22 +244,22 @@ GetIcon(DTCM_editor *de)
         Window          window = XtWindow(calendar->frame);
         unsigned char  *bitmapData, *bitmapMask;
  
-        if (de->drag_bitmap == NULL) {
+        if (de->drag_bitmap == 0) {
                 de->drag_bitmap = XCreateBitmapFromData(display,
                         window, (char *) drag_xbm_bits,
                         drag_xbm_width, drag_xbm_height);
-                if (de->drag_bitmap == NULL) {
+                if (de->drag_bitmap == 0) {
 
-                        printf(catgets(calendar->DT_catd, 1, 237, "XCreateBitmapFromData() failed for bitmap.\n"));
+                        printf("%s", catgets(calendar->DT_catd, 1, 237, "XCreateBitmapFromData() failed for bitmap.\n"));
                         return;
                 }
         }
-        if (de->drag_mask == NULL) {
+        if (de->drag_mask == 0) {
                 de->drag_mask = XCreateBitmapFromData(display,
                         window, (char *) drag_mask_xbm_bits,
                         drag_mask_xbm_width, drag_mask_xbm_height);
-                if (de->drag_mask == NULL) {
-                        printf(catgets(calendar->DT_catd, 1, 238, "XCreateBitmapFromData() failed for mask.\n"));
+                if (de->drag_mask == 0) {
+                        printf("%s", catgets(calendar->DT_catd, 1, 238, "XCreateBitmapFromData() failed for mask.\n"));
                         return;
                 }
         }
@@ -394,7 +394,7 @@ StandaloneApptDragStart(
                NULL)
             == NULL) {
  
-                printf(catgets(c->DT_catd, 1, 239, "DragStart returned NULL.\n"));
+                printf("%s", catgets(c->DT_catd, 1, 239, "DragStart returned NULL.\n"));
         }
 }
 
index b8adc71e82c5382a15f8a02f60cdc03c42c5bd31..ad29c047727e9f97b180eb24704d593012111467 100644 (file)
@@ -1210,7 +1210,7 @@ build_editor_list(Editor *e, Tick date, Glance glance,
        }
 
        setup_range(&range_attr, &ops, &range_count, start, stop,
-                   CSA_TYPE_EVENT, NULL, B_FALSE, e->cal->general->version);
+                   CSA_TYPE_EVENT, 0, B_FALSE, e->cal->general->version);
 
        status = csa_list_entries(e->cal->cal_handle, range_count, range_attr, ops, count, entry_list, NULL);
        backend_err_msg(e->frame, e->cal->view->current_calendar, status,
@@ -1409,7 +1409,7 @@ trim_end_date_from_rule(char *rule, char *newrule)
        if (ptr = strchr(rule, 'Z')) {
                while (*ptr != ' ')
                        ptr--;
-               *ptr = NULL;
+               *ptr = '\0';
        }
        strcpy(newrule, rule);
 
index ac4245c4158feb238b2e160c4bddf5b72a30fe94..f413ef82c56b3e92ac8488b862f3df64ff78ebb3 100644 (file)
@@ -587,7 +587,7 @@ XmPushButtonCallbackStruct *cbs;
 
        astr = XmTextGetString(f->apptstr);
 
-        if (astr == NULL || *astr == NULL) {
+        if (astr == NULL || *astr == '\0') {
                sprintf(message, "%s", catgets(c->DT_catd, 1, 290, "Specify Appt String to Match."));
                set_message(f->find_message, message);
                 return;
@@ -666,7 +666,7 @@ XmPushButtonCallbackStruct *cbs;
        _DtTurnOnHourGlass(f->frame);
         for (; stop <= end_of_time;) {
                setup_range(&range_attrs, &ops, &range_count, start, stop,
-                           CSA_TYPE_EVENT, NULL, B_FALSE, c->general->version);
+                           CSA_TYPE_EVENT, 0, B_FALSE, c->general->version);
                stat = csa_list_entries(c->cal_handle, range_count, range_attrs, ops, &num_entries, &entries, NULL);
 
                if (stat != CSA_SUCCESS) {
@@ -684,7 +684,7 @@ XmPushButtonCallbackStruct *cbs;
                                return;
                        }
 
-                       for (j = 0; appt->what->value->item.string_value[j] != NULL; j++)
+                       for (j = 0; appt->what->value->item.string_value[j] != '\0'; j++)
                                if (strncasecmp(astr, &(appt->what->value->item.string_value[j]),
                                        comparison_length) == 0) {
                                        new_tick = (Tick_list *) ckalloc(sizeof(Tick_list));
index 47304ef1a989c6d537b62665680cfb619b2473ac..3a7f9b6f1545f596073021401ee42a96ab4fea52 100644 (file)
@@ -275,12 +275,12 @@ load_app_font(
         * version available.
         */
        if (!strcmp(cal->app_data->app_font_family, "application")) {
-               sprintf (font_name, "-dt-%s-%s-r-normal-sans-%d-*-*-*-p-*",
+               sprintf (font_name, "-dt-%s-%s-r-normal-sans-%lu-*-*-*-p-*",
                                cal->app_data->app_font_family,
                                (weight == BOLD)?"bold":"medium",
                                pixel_size);
        } else {
-               sprintf (font_name, "-dt-%s-%s-r-normal--%d-*-*-*-*-*",
+               sprintf (font_name, "-dt-%s-%s-r-normal--%lu-*-*-*-*-*",
                                cal->app_data->app_font_family,
                                (weight == BOLD)?"bold":"medium",
                                pixel_size);
index 29f6e940c715b502036eb3bdd14a0746efc171f6..da4db1432e24e27f1d5fa93c7d57d243763c67d2 100644 (file)
@@ -85,7 +85,7 @@ format_date(Tick t, OrderingType order, char *buf, int day_and_date,
        struct tm *tm;
        _Xltimeparams localtime_buf;
 
-       buf[0]=NULL;
+       buf[0] = '\0';
        tm = _XLocaltime(&t, localtime_buf);
        m = tm->tm_mon+1;
        d = tm->tm_mday;
@@ -157,7 +157,7 @@ format_date3(Tick t, OrderingType order, SeparatorType sep, char *buf)
        char *str = (char *) separator_str(sep);
        _Xltimeparams localtime_buf;
 
-       buf[0]=NULL;
+       buf[0] = '\0';
        tm = _XLocaltime(&t, localtime_buf); 
 
        m = tm->tm_mon+1; 
@@ -194,7 +194,7 @@ format_line(Tick tick,
        _Xltimeparams localtime_buf;
 
         if (buf==NULL) return pad;
-        buf[0]=NULL;
+        buf[0] = '\0';
        tm = _XLocaltime(&tick, localtime_buf);
         hr = tm->tm_hour;
         mn = tm->tm_min;
@@ -227,16 +227,16 @@ format_line(Tick tick,
                        width, so I have to line it up myself.. */
                        if (display == HOUR12) {
                                if (hr > 9)
-                                               (char *)sprintf(buf, "%2d:%.2d%s ", 
+                                               sprintf(buf, "%2d:%.2d%s ", 
                                                        hr, mn, am ? "a" : "p");
                                else {
-                                               (char *)sprintf(buf, "%d:%.2d%s ", 
+                                               sprintf(buf, "%d:%.2d%s ", 
                                                        hr, mn, am ? "a" : "p");
                                        pad = TRUE;
                                }
                        }
                        else
-                                (char *)sprintf(buf, "%02d%02d ", hr, mn);
+                                sprintf(buf, "%02d%02d ", hr, mn);
                 }
         }
        if (what)
@@ -262,7 +262,7 @@ format_maxchars(Dtcm_appointment *appt, char *buf1, int maxchars,
        if (appt->end_time)
                _csa_iso8601_to_tick(appt->end_time->value->item.string_value,
                        &end_tick);
-        *buf1 = NULL;
+        *buf1 = '\0';
         if (appt == NULL || appt->what->value->item.string_value == NULL) return;
         tm = _XLocaltime(&tick, localtime_buf);
         hour1 = tm->tm_hour;
@@ -336,7 +336,7 @@ format_line2(Dtcm_appointment *appt, char *buf1, char *buf2,
          * Extract an appointment and format it into 2 lines of no more
          * then maxchars
          */
-        *buf1 = *buf2 = NULL;
+        *buf1 = *buf2 = '\0';
         if (appt == NULL || appt->what->value->item.string_value == NULL) return;
         tm = _XLocaltime(&tick, localtime_buf);
         hour1 = tm->tm_hour;
@@ -382,7 +382,7 @@ format_line2(Dtcm_appointment *appt, char *buf1, char *buf2,
          
         if (lines == NULL || lines->s == NULL ||                        
                 (cm_strlen(lines->s) == 1 && lines->s[0] == ' '))
-                buf2[0] = NULL;
+                buf2[0] = '\0';
         else
                 sprintf(buf2, " %s", lines->s);
         destroy_lines(lines);
index b233aba97ddaa5617a9ba18615c1264878f88ea5..c73c26e0c4098aa63239d7d3538265ba6196f4ec 100644 (file)
@@ -258,7 +258,7 @@ goto_date(Widget widget, XtPointer client_data, XmPushButtonCallbackStruct *cbs)
         g = (Goto*)c->goTo;
  
        date = XmTextGetString(g->datetext);
-       if ((*date == NULL) || (date == NULL)) {
+       if ((date == NULL) || (*date == '\0')) {
                sprintf(message, "%s", catgets(c->DT_catd, 1, 297, "Please type in a date"));
                set_message(g->goto_message, message);
                 return;
index c8b4103e4f409c233db716d630b68559669c515e..409dcb69f7e2c272f95acaafd25fd1fa21acc6a1 100644 (file)
@@ -629,7 +629,7 @@ gr_create_stipple(new_XContext *xc, unsigned char *data, int datawidth, int data
         if ((*stipple = XCreateBitmapFromData(xc->display,
                 xc->xid,
         /*      RootWindow(xc->display, DefaultScreen(xc->display)),  */
-                (char *)data, datawidth, dataheight)) == NULL) {
+                (char *)data, datawidth, dataheight)) == 0) {
                         ok = False;
                 }
         else {
index eaba8b18ca9a991d78578262b65cd4e546e64640..62980542367813ab0369b7c1aa87c43a614aea6c 100644 (file)
@@ -315,7 +315,7 @@ get_mail_address_list(Calendar *c) {
        }
 
        address = calloc(address_len+1, 1);
-       memset(address, NULL, address_len);
+       memset(address, 0, address_len);
 
        for (i = 0; i < pos_cnt; i++) {
                ad = (Access_data *)CmDataListGetData(ge->access_data,
@@ -1803,7 +1803,7 @@ add_all_gappt(GEditor *ge) {
                        continue;
 
                setup_range(&range_attr, &ops, &range_count, start, stop,
-                       CSA_TYPE_EVENT, NULL, B_FALSE, step->version);
+                       CSA_TYPE_EVENT, 0, B_FALSE, step->version);
                csa_list_entries(step->cal_handle, range_count, range_attr,
                        ops, &entry_count, &entry_list, NULL);
                free_range(&range_attr, &ops, range_count);
index e610a45ebe2417b43ae09e9c45c4c15494c87037..4f51b1310678cbabffb83efdd46bb2d5ab22aec1 100644 (file)
@@ -120,7 +120,7 @@ void show_main_help(Widget w, XtPointer clientData, XtPointer cbs)
  
         ac = 0;
         XtSetArg(al[ac], DtNhelpType, DtHELP_TYPE_TOPIC); ac++;
-        switch ((int)clientData) {
+        switch ((intptr_t)clientData) {
             case HELP_OVERVIEW:
                XtSetArg(al[ac], DtNhelpVolume, "Calendar"); ac++;
                 XtSetArg(al[ac], DtNlocationId, "_HOMETOPIC"); ac++;
@@ -149,7 +149,7 @@ void show_main_help(Widget w, XtPointer clientData, XtPointer cbs)
                while (!XtIsSubclass(w, applicationShellWidgetClass))
                    w = XtParent(w);
  
-               status = DtHelpReturnSelectedWidgetId(w, NULL, &selWidget);     
+               status = DtHelpReturnSelectedWidgetId(w, 0, &selWidget);     
                switch ((int)status)
                   {
                     case DtHELP_SELECT_ERROR:
index a8721736a629902bc0002df9ff0bbf48045aadf9..e42ecec68aa14305671fdfb8083fc77ec565614f 100644 (file)
@@ -160,8 +160,8 @@ load_icons(
 
        /* See if the resolution size we have chosen is acceptable by the WM */
        if (!(size = wm_icon_preference(XtDisplay(c->frame), screen, size))) {
-               c->icon->icon = NULL;
-               c->icon_inverted->icon = NULL;
+               c->icon->icon = 0;
+               c->icon_inverted->icon = 0;
                return (FALSE);
        }
 
@@ -205,22 +205,22 @@ load_icon(
 
        if (!(icon_filename = XmGetIconFileName(screen, NULL, icon_name, 
                                                                NULL, size))) {
-               icon->icon = NULL;
+               icon->icon = 0;
                return (FALSE);
        }
 
        if ((icon->icon = XmGetPixmap(screen, icon_filename, fg, bg)) ==
                                                        XmUNSPECIFIED_PIXMAP) {
                free(icon_filename);
-               icon->icon = NULL;
+               icon->icon = 0;
                return (FALSE);
        }
 
        if ((icon->icon_mask = _DtGetMask(screen, icon_filename)) ==
                                                        XmUNSPECIFIED_PIXMAP) {
                free(icon_filename);
-               icon->icon = NULL;
-               icon->icon_mask = NULL;
+               icon->icon = 0;
+               icon->icon_mask = 0;
                return (FALSE);
        }
 
@@ -247,12 +247,12 @@ free_icon(
        if (icon->icon)
                XmDestroyPixmap(XtScreen(c->frame), icon->icon);
 
-       icon->icon = NULL;
+       icon->icon = 0;
 
        if (icon->icon_mask)
                XmDestroyPixmap(XtScreen(c->frame), icon->icon_mask);
 
-       icon->icon_mask = NULL;
+       icon->icon_mask = 0;
 }
 
 static void
index 1a9bc2f08e74df8cfb475f85e741353010b07538..2633846d6b0e3bb4e98f2bafe1f88b69900041bc 100644 (file)
@@ -583,7 +583,7 @@ create_all_pixmaps(Props_pu *p, Widget w)
 
         if ((p->drag_icon_xbm = XmGetPixmap(s, "DtCMdnd.m.pm", fg, bg)) ==
                                                        XmUNSPECIFIED_PIXMAP) {
-               p->drag_icon_xbm = NULL;
+               p->drag_icon_xbm = 0;
        }
 }
 
@@ -663,10 +663,10 @@ cm_mbchar(char *str) {
 static void
 response(Widget w, XtPointer client_data, XtPointer cbs) {
        XtPointer userData = (XtPointer)0;
-       int *answerP = (int *)client_data;
+       int *answerP = (int *) (intptr_t)client_data;
 
        XtVaGetValues(w, XmNuserData, &userData, NULL);
-       *answerP = (int)userData;
+       *answerP = (intptr_t)userData;
 }
 
 /*
index 9d8e1fe066aa489b4c274e6f8fb29690b827422c..906c41d779a8474e922b850dc85f8938fa9f992e 100644 (file)
@@ -209,14 +209,14 @@ paint_day_entries(
                                                                w - pad_width, 
                                                                buf, pf);
                                                if (cm_strlen(buf) > maxchars)
-                                                       buf[maxchars] = NULL;
+                                                       buf[maxchars] = '\0';
                                                (void)gr_text(xc, x + pad_width,
                                                              y, pf, buf, rect);
                                        } else {
                                                maxchars = gr_nchars(w, buf, 
                                                                     pf);
                                                if (cm_strlen(buf) > maxchars)
-                                                       buf[maxchars] = NULL;
+                                                       buf[maxchars] = '\0';
                                                (void)gr_text(xc, x, y, pf, 
                                                              buf, rect);
                                        }
@@ -306,7 +306,7 @@ paint_month(Calendar *c, Tick key, XRectangle *rect)
                start = (time_t) lowerbound(day);
                stop = (time_t) last_dom(day);
                setup_range(&range_attrs, &ops, &j, start, stop, CSA_TYPE_EVENT,
-                       NULL, B_FALSE, c->general->version);
+                       0, B_FALSE, c->general->version);
                csa_list_entries(c->cal_handle, j, range_attrs, ops, &a_total, &list, NULL);
        
                free_range(&range_attrs, &ops, j);
@@ -571,7 +571,7 @@ get_time_str (Dtcm_appointment *appt, char *buf)
        _Xltimeparams   localtime_buf;
 
        _csa_iso8601_to_tick(appt->time->value->item.date_time_value, &start_tick);
-       buf[0] = NULL;
+       buf[0] = '\0';
 
         if (appt==NULL || !showtime_set(appt) || magic_time(start_tick))
                 return;
@@ -724,7 +724,7 @@ count_month_pages(Calendar *c, Tick start_date, int lines_per_box)
                 start = (time_t) lowerbound (day);
                 stop = (time_t) next_ndays(day, 1) - 1;
                setup_range(&range_attrs, &ops, &j, start, stop,
-                           CSA_TYPE_EVENT, NULL, B_FALSE,
+                           CSA_TYPE_EVENT, 0, B_FALSE,
                            c->general->version);
                csa_list_entries(c->cal_handle, j, range_attrs, ops,
                                 &a_total, &list, NULL);
@@ -804,7 +804,7 @@ print_month ( Calendar *c,
          lo_hour = (time_t)lowerbound (day);
          hi_hour = (time_t) next_ndays(day, 1) - 1;
          setup_range(&range_attrs, &ops, &j, lo_hour, hi_hour,
-                     CSA_TYPE_EVENT, NULL, B_FALSE, c->general->version);
+                     CSA_TYPE_EVENT, 0, B_FALSE, c->general->version);
          csa_list_entries(c->cal_handle, j, range_attrs,
                           ops, &a_total, &list, NULL);
          free_range(&range_attrs, &ops, j);
@@ -924,7 +924,7 @@ static void
 quick_button_cb(Widget widget, XtPointer client, XtPointer call)
 {
         Calendar *c = calendar;
-       int      dom = (int) client;
+       int      dom = (int) (intptr_t) client;
 
        c->view->olddate = c->view->date;
        c->view->date = next_ndays(first_dom(c->view->date), dom);
@@ -1059,7 +1059,7 @@ allocator(Calendar *c)
                        XmCreatePushButton(c->canvas, buf, NULL, 0);
                XtVaSetValues(m->hot_button[n], XmNlabelString, str, NULL);
                XtAddCallback(m->hot_button[n],XmNactivateCallback, 
-                       quick_button_cb, (XtPointer)n);
+                       quick_button_cb, (XtPointer) (intptr_t) n);
                XmStringFree(str);
        }
 }
index 1edc5371bce996f70dd511fb6fe3cf728335fb1f..64eff5265e91e8b5766c520f6cd934a19b15f0f0 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include <EUSCompat.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -984,7 +985,7 @@ create_print_dialog(Calendar *c)
           */
          pd->report_type = PR_DAY_VIEW;
          pd->report_type_option = XmVaCreateSimpleOptionMenu(pd->form,
-               "TypeOptionMenu", view, NULL,
+               "TypeOptionMenu", view, 0,
                pd->report_type, report_option_cb,
                XmVaPUSHBUTTON,         day_view, NULL, NULL, NULL,
                XmVaPUSHBUTTON,         week_view, NULL, NULL, NULL,
@@ -1489,7 +1490,7 @@ print_report(Calendar *c)
 static void
 report_option_cb(Widget w, XtPointer client_data, XtPointer call_data)
 {
-  int choice = (int) client_data;
+  int choice = (int) (intptr_t) client_data;
   Calendar *c = calendar;
 
   pd_set_report_managed(c, choice);
index f7ff7f2ddd559b226ff9d7469a983dc5f0fd29ff..bc92948e4330c2692056cfd3537dad06e5b27db9 100644 (file)
@@ -2404,7 +2404,7 @@ p_make_props_pu(Calendar *c) {
 
        p->category_menu = widgets[0] = 
                XmVaCreateSimpleOptionMenu(p->base_form_mgr,
-               "category_menu",  label, NULL, 0, p_category_notify,
+               "category_menu",  label, 0, 0, p_category_notify,
                XmVaPUSHBUTTON, Pane_XmStrs[EDITOR_PANE], NULL, NULL, NULL,
                XmVaPUSHBUTTON, Pane_XmStrs[DISPLAY_PANE], NULL, NULL, NULL,
                XmVaPUSHBUTTON, Pane_XmStrs[GROUP_ACCESS_PANE], NULL, NULL,NULL,
index 812e26d4531ec46b8c185b4dae69c7f1d88dd122..d55a04bebd6de657d0ab85674deb355576531898 100644 (file)
@@ -176,7 +176,7 @@ CMSaveSessionCB (
        if (save_session) {
                memcpy(command + command_len, "-session", 8);
                command_len += 8;
-               command[command_len] = NULL;
+               command[command_len] = '\0';
                command_len++;
                memcpy(command + command_len, name, strlen(name));
                command_len += strlen(name);
@@ -234,7 +234,7 @@ GetSessionInfo(
 
     if (path) XtFree(path);
 
-    xrm_name[1] = NULL;
+    xrm_name[1] = '\0';
  
     /* get default view */
     xrm_name[0] = XrmStringToQuark ("defaultView");
index ebbb1949f925f49a6a0bb5ca14ebb76cc7875a09..265fd42a1247ba7b0fbd1c4f3dd2777bdfdeae97 100644 (file)
@@ -54,6 +54,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <sys/wait.h>
 #include <LocaleXlate.h>
 #include <RFCMIME.h>
@@ -372,7 +373,10 @@ deliver(char ** addrs, char * msg)
     }
     argv[cp + 1] = NULL;
 
-    pipe(fd);
+    if(-1 == pipe(fd)) {
+       fprintf(stderr, "pipe() failed %d '%s'\n", errno, strerror(errno));
+       exit(EXIT_FAILURE);    
+    }
 
     c_pid = fork();
     if (c_pid < 0) {
@@ -386,7 +390,10 @@ deliver(char ** addrs, char * msg)
        _exit(1); /* This had better never happen! */
     }
     else { /* The parent. */
-       write(fd[1], msg, strlen(msg));
+       if(-1 == write(fd[1], msg, strlen(msg))) {
+           fprintf(stderr, "write() failed %d '%s'\n", errno, strerror(errno));
+           exit(EXIT_FAILURE);    
+       }
        close(fd[0]);
        close(fd[1]);
 
index 924957130b1298f84dbe2a3cfb86d838c0446dca..05eb0aec07e833af188da89396bfd4ad63eca75c 100644 (file)
@@ -2224,7 +2224,7 @@ build_todo_view(ToDo *t, Glance glance, Boolean redisplay) {
                                XmNvalueChangedCallback, t_view_change_proc, t);
 
                        step->next = NULL;
-                       step->appt = NULL;
+                       step->appt = 0;
                        if (last) {
                                XtVaSetValues(step->view_item_number,
                                        XmNtopAttachment, XmATTACH_WIDGET,
@@ -2241,7 +2241,7 @@ build_todo_view(ToDo *t, Glance glance, Boolean redisplay) {
                        XtManageChild(step->view_item_number);
                        XtManageChild(step->view_item_toggle);
                }
-               if (step->appt != NULL)
+               if (step->appt != 0)
                        csa_free((CSA_buffer) step->appt);
                step->appt = entry_list[cnt - 1];
                step->modified = False;
@@ -2294,7 +2294,7 @@ build_todo_view(ToDo *t, Glance glance, Boolean redisplay) {
        **  possibly filled with old stuff -- unmanage these widgets.
        */
        while (step) {
-               if (step->appt != NULL)
+               if (step->appt != 0)
                        csa_free((CSA_buffer) step->appt);
                XtUnmanageChild(step->view_item_number);
                XtUnmanageChild(step->view_item_toggle);
index 2e398e90bda027e81cf14c3ada472560234217ae..9f3734a2abf5ac58da18695dc565d5ffd5b43e37 100644 (file)
@@ -157,7 +157,7 @@ count_week_pages (Calendar *c, int lines_per_page, Tick start_date)
                 start = (time_t) lowerbound (start_date);
                 stop = (time_t) next_ndays(start_date, 1) - 1;
                setup_range(&range_attrs, &ops, &j, start, stop,
-                           CSA_TYPE_EVENT, NULL, B_FALSE, c->general->version);
+                           CSA_TYPE_EVENT, 0, B_FALSE, c->general->version);
                csa_list_entries(c->cal_handle, j, range_attrs, ops, &a_total, &list, NULL);
                free_range(&range_attrs, &ops, j);
 
@@ -250,7 +250,7 @@ print_week (Calendar *c,
          start = (time_t) lowerbound (start_date);
          stop = (time_t) next_ndays(start_date, 1) - 1;
          setup_range(&range_attrs, &ops, &j, start, stop,
-                     CSA_TYPE_EVENT, NULL, B_FALSE, c->general->version);
+                     CSA_TYPE_EVENT, 0, B_FALSE, c->general->version);
          csa_list_entries(c->cal_handle, j, range_attrs,
                           ops, &a_total, &list, NULL);
          free_range(&range_attrs, &ops, j);
@@ -459,7 +459,7 @@ allocator(Calendar *c)
                w->hot_button[n] =
                        XmCreatePushButton(c->canvas, "week2day", args, 1);
                XtAddCallback(w->hot_button[n],XmNactivateCallback, 
-                       quick_button_cb, (XtPointer)n);
+                       quick_button_cb, (XtPointer) (intptr_t) n);
        }
 
        /* selection info (and init its permanent attributes) */
@@ -864,7 +864,7 @@ draw_week(Calendar *c, XRectangle *rect, Boundary boundary)
 
         if (c->paint_cache == NULL) {
                setup_range(&range_attrs, &ops, &i, start, stop, CSA_TYPE_EVENT,
-                       NULL, B_FALSE, c->general->version);
+                       0, B_FALSE, c->general->version);
                csa_list_entries(c->cal_handle, i, range_attrs, ops, 
                                 &a_total, &list, NULL);
                free_range(&range_attrs, &ops, i);
@@ -1031,7 +1031,7 @@ format_entry(Paint_cache *cache_entry, char *buf1, char *buf2,
          * Extract an appointment and format it into 2 lines of no more
          * then maxchars
          */
-        *buf1 = *buf2 = NULL;
+        *buf1 = *buf2 = '\0';
         if (cache_entry == NULL || cache_entry->summary == NULL) return;
         tm = _XLocaltime(&tick, localtime_buf);
         hour1 = tm->tm_hour;
@@ -1076,7 +1076,7 @@ format_entry(Paint_cache *cache_entry, char *buf1, char *buf2,
          
         if (lines == NULL || lines->s == NULL ||                        
                 (cm_strlen(lines->s) == 1 && lines->s[0] == ' '))
-                buf2[0] = NULL;
+                buf2[0] = '\0';
         else
                 sprintf(buf2, " %s", lines->s);
         destroy_lines(lines);
@@ -1100,15 +1100,15 @@ paint_entry(Calendar *c, int x, int y, int maxchars, Paint_cache *cache_entry, X
         if (maxchars >= 40)             /* maxed out possible=40 */
                 maxchars = 40;
                  
-        buf1[0]=NULL; buf2[0]=NULL;
+        buf1[0] = '\0'; buf2[0] = '\0';
  
         format_entry(cache_entry, buf1, buf2, dt);
 
        tick = cache_entry->start_time;
  
-        if (cache_entry->show_time && !magic_time(tick) && (buf1[0] != NULL)) {
+        if (cache_entry->show_time && !magic_time(tick) && (buf1[0] != '\0')) {
                 maxchars = gr_nchars(w->day_width - 5, buf1,c->fonts->boldfont); 
-                buf1[min(cm_strlen(buf1), maxchars)]=NULL;
+                buf1[min(cm_strlen(buf1), maxchars)] = '\0';
                 gr_text(xc, x, y, c->fonts->boldfont, buf1, rect);
                 nlines++;
                CalFontExtents(c->fonts->boldfont, &fontextents);
@@ -1117,7 +1117,7 @@ paint_entry(Calendar *c, int x, int y, int maxchars, Paint_cache *cache_entry, X
         if (buf2[0] != '\0') {
                 maxchars = gr_nchars(w->day_width - 5, buf2, 
                                                c->fonts->viewfont);
-               buf2[min(cm_strlen(buf2), maxchars)]=NULL;
+               buf2[min(cm_strlen(buf2), maxchars)] = '\0';
                 gr_text(xc, x, y, c->fonts->viewfont, buf2, rect);
                 nlines++;
         }
@@ -1391,7 +1391,7 @@ quick_button_cb(Widget widget, XtPointer client, XtPointer call)
 {
         Calendar *c = calendar;
         Week    *w = (Week *)c->view->week_info;
-       int dow = (int) client;
+       int dow = (int) (intptr_t) client;
        char buf[BUFSIZ];
 
        if (c->view->date != get_bot()) {
index 9458b6f3f4abcb35c05b076cb407bcfa2fa15eb5..bfee10c797d1d6942c8f96909e463430529759a9 100644 (file)
@@ -2887,7 +2887,7 @@ x_print_multi_appts(void *gInfoP,
     /* HH:MM xm - HH:MM xm format */
     format_line2(appt, buf1, buf2, dt);
 
-    indented = (*buf1 != NULL);
+    indented = (*buf1 != '\0');
     indentAmt = (view == dayGlance) ? 0 : 1;
     if (indented)
       indentAmt += 2;
@@ -2992,7 +2992,7 @@ x_print_list_range(Calendar *c, CSA_sint32 appt_type, int item_data,
                                     "Appt List Beginning: %s"), buf2);
 
        setup_range(&range_attrs, &ops, &i, start, end, appt_type,
-                   NULL, B_FALSE, c->general->version);
+                   0, B_FALSE, c->general->version);
        stat = csa_list_entries(c->cal_handle, i, range_attrs,
                                ops, &a_total, &list, NULL);
        if (stat != CSA_SUCCESS) {
@@ -3939,7 +3939,7 @@ x_print_month_appts(void *gInfoP, CSA_entry_handle *list,
     {
       get_time_str(appt, buf1);
 
-      indented = (*buf1 != NULL);
+      indented = (*buf1 != '\0');
 
       lines = text_to_lines(appt->what->value->item.string_value, 1);
       line_counter++;
index e8e29d013785f58c77317b4930debf8261229d30..f8d7077573aeccb6b5735b52fafbe07ad2a4680c 100644 (file)
@@ -196,13 +196,13 @@ mini_err_msg(
        char    *buf, *ptr;
 
        if (type == TTY_Insert)
-               fprintf(stderr, "%s %s", 
+               fprintf(stderr, "%s", 
                        catgets(catd, 1, 1042, "Insert Access Denied: "));
        else if (type == TTY_Delete)
-               fprintf(stderr, "%s %s", 
+               fprintf(stderr, "%s", 
                        catgets(catd, 1, 1043, "Delete Access Denied: "));
        else
-               fprintf(stderr, "%s %s", 
+               fprintf(stderr, "%s", 
                        catgets(catd, 1, 1044, "Lookup Access Denied: "));
 
        if (appt_what && appt_what[0] != '\0') {
@@ -398,7 +398,7 @@ scrub_attr_list(Dtcm_appointment *appt) {
        for (i = 0; i < appt->count; i++) {
                if (appt->attrs[i].value->type == CSA_VALUE_REMINDER) {
                        if ((appt->attrs[i].value->item.reminder_value->lead_time == NULL) || 
-                            (appt->attrs[i].value->item.reminder_value->lead_time[0] == NULL)) {
+                            (appt->attrs[i].value->item.reminder_value->lead_time[0] == '\0')) {
                                free(appt->attrs[i].name);
                                appt->attrs[i].name = NULL;
                        }
@@ -613,7 +613,7 @@ cm_tty_lookup(nl_catd catd, CSA_session_handle target, int version, char *date,
        start = lowerbound(tick - (day * daysec));
        stop = next_ndays(start, span) - 1;
        setup_range(&range_attrs, &ops, &i, start, stop, CSA_TYPE_EVENT,
-                   NULL, B_FALSE, version);
+                   0, B_FALSE, version);
        status = csa_list_entries(target, i, range_attrs, ops, &a_total, list, NULL);
        free_range(&range_attrs, &ops, i);
 
@@ -653,7 +653,7 @@ cm_tty_lookup(nl_catd catd, CSA_session_handle target, int version, char *date,
                        if (appt->end_time)
                                format_time(end_tick, dt, end_buf);
                        else
-                               *end_buf = NULL;
+                               *end_buf = '\0';
                        sprintf(buf, "%s%c%7s ", start_buf,
                                (*end_buf ? '-' : ' '), end_buf);
                }
@@ -964,7 +964,7 @@ build_new_attrval(CSA_attribute *attrval, char *name, char *tag, char *value)
        if (!strcmp(tag, "caluser")) {
                vptr->type = CSA_VALUE_CALENDAR_USER;
                s_ptr = strchr(value, ':');
-               *s_ptr = NULL;
+               *s_ptr = '\0';
                vptr->item.calendar_user_value = calloc(sizeof(CSA_calendar_user), 1);
                vptr->item.calendar_user_value->user_name = cm_strdup(s_ptr + 1);
                vptr->item.calendar_user_value->user_type = atoi(value);
@@ -983,7 +983,7 @@ build_new_attrval(CSA_attribute *attrval, char *name, char *tag, char *value)
        if (!strcmp(tag, "reminder")) {
                vptr->type = CSA_VALUE_REMINDER;
                s_ptr = strchr(value, ':');
-               *s_ptr = NULL;
+               *s_ptr = '\0';
                
                vptr->item.reminder_value = calloc(sizeof(CSA_reminder), 1);
                
@@ -1012,13 +1012,13 @@ build_new_attrval(CSA_attribute *attrval, char *name, char *tag, char *value)
                                l_ptr = calloc(sizeof(CSA_access_rights), 1);
 
                                s_ptr = strchr(b_ptr, ':');
-                               *s_ptr = NULL;
+                               *s_ptr = '\0';
 
                                l_ptr->rights = atoi(b_ptr);
 
                                b_ptr = s_ptr + 1;
                                if (s_ptr = strchr(b_ptr, '\n'))
-                                       *s_ptr = NULL;
+                                       *s_ptr = '\0';
 
                                l_ptr->user->user_name = cm_strdup(b_ptr);
 
@@ -1112,7 +1112,7 @@ read_new_appt(FILE *fp, Dtcm_appointment **appt, Props *p, int version)
                        strcat(a_value, "\n");
                        strcat(a_value, b_ptr);
 
-                       a_value[strlen(a_value) - 1] = NULL;
+                       a_value[strlen(a_value) - 1] = '\0';
 
                        continue;
                }
@@ -1161,7 +1161,7 @@ read_new_appt(FILE *fp, Dtcm_appointment **appt, Props *p, int version)
                b_ptr = line;
                if (c_ptr = strchr(line, ':'))
                {
-                       *c_ptr = NULL;
+                       *c_ptr = '\0';
                        a_name = cm_strdup(b_ptr);
                }
                else
@@ -1175,7 +1175,7 @@ read_new_appt(FILE *fp, Dtcm_appointment **appt, Props *p, int version)
 
                if (c_ptr = strchr(b_ptr, ':'))
                 {       
-                        *c_ptr = NULL;
+                        *c_ptr = '\0';
                         a_tag = cm_strdup(b_ptr);
                 }
                 else
@@ -1187,7 +1187,7 @@ read_new_appt(FILE *fp, Dtcm_appointment **appt, Props *p, int version)
                if (!*b_ptr)
                        break;
                else
-                       b_ptr[strlen(b_ptr) - 1] = NULL;
+                       b_ptr[strlen(b_ptr) - 1] = '\0';
 
                a_value =  cm_strdup(b_ptr);
        }
@@ -1667,7 +1667,7 @@ cat_indented_string(char **catbuf, char *string)
                        *b_ptr++ = '\t';
                p_str++;
        }
-       *b_ptr = NULL;
+       *b_ptr = '\0';
 
        growcat(catbuf, buf);
 
@@ -1683,12 +1683,12 @@ attrs_to_string(CSA_attribute * attrs, int num_attrs)
        char            tmp_buf[MAXNAMELEN];
        int             advance_time;
 
-       buffer[0] = NULL;
+       buffer[0] = '\0';
         for (i = 0; i < num_attrs; i++) {
                if (!attrs[i].name || (attrs[i].value == NULL))
                        continue;
 
-               tmp_buf[0] = NULL;
+               tmp_buf[0] = '\0';
                 sprintf(tmp_buf, "%s:", attrs[i].name);
                switch (attrs[i].value->type) {
                case CSA_VALUE_SINT32: 
@@ -1765,7 +1765,7 @@ attrs_to_string(CSA_attribute * attrs, int num_attrs)
                                a_ptr = attrs[i].value->item.access_list_value;
                                while (a_ptr) {
                                        sprintf(tmp_buf, "\t%d:%s\n",
-                                               a_ptr->rights, a_ptr->user->user_name);
+                                               (int) a_ptr->rights, a_ptr->user->user_name);
                                        growcat(&buffer, tmp_buf);
                                        a_ptr = a_ptr->next;
                                }
@@ -1865,11 +1865,11 @@ parse_attrs_to_string(Dtcm_appointment *appt, Props *p, char *attr_string) {
        CSA_uint32      repeat_times;
         static char *format_string = "\n\n\t** Calendar Appointment **\n%s:string:begin\n%s%s:string:end\n\tDate: %s\n\tStart: %s\n\tEnd: %s\n\tRepeat: %s\n\tFor: %s\n\tWhat: %s";
 
-       s_buf[0] = NULL;
-       e_buf[0] = NULL;
-       w_buf[0] = NULL;
-       r_buf[0] = NULL;
-       f_buf[0] = NULL;
+       s_buf[0] = '\0';
+       e_buf[0] = '\0';
+       w_buf[0] = '\0';
+       r_buf[0] = '\0';
+       f_buf[0] = '\0';
 
        _csa_iso8601_to_tick(appt->time->value->item.date_time_value, &tick);
        if (appt->end_time) 
@@ -2144,7 +2144,7 @@ str_to_period(char *ps, CSA_sint32 *repeat_type, int *repeat_nth) {
        boolean_t       compute_times = B_FALSE;
        char            *ps2, *ptr, *ptr2, *unit;
  
-       *repeat_type = NULL;
+       *repeat_type = '\0';
        *repeat_nth = 0;
         if (ps == NULL)
                return;
@@ -2186,7 +2186,7 @@ str_to_period(char *ps, CSA_sint32 *repeat_type, int *repeat_nth) {
                 ps2 = cm_strdup(unit);
                 ptr = strchr(ps2, ' ');
                if (ptr != NULL)
-                       *ptr = NULL;
+                       *ptr = '\0';
                else
                        return;
 
@@ -2235,13 +2235,13 @@ periodstr_from_period(CSA_sint32 repeat_type, int repeat_nth) {
                sprintf(pstr, "%s", periodstrings[6]);
                break;
         case CSA_X_DT_REPEAT_EVERY_NDAY:
-               sprintf(pstr, "Every %ld %s", repeat_nth, periodstrings[7]);
+               sprintf(pstr, "Every %d %s", repeat_nth, periodstrings[7]);
                break;
         case CSA_X_DT_REPEAT_EVERY_NWEEK:
-               sprintf(pstr, "Every %ld %s", repeat_nth, periodstrings[8]);
+               sprintf(pstr, "Every %d %s", repeat_nth, periodstrings[8]);
                break;
         case CSA_X_DT_REPEAT_EVERY_NMONTH:
-               sprintf(pstr, "Every %ld %s", repeat_nth, periodstrings[9]);
+               sprintf(pstr, "Every %d %s", repeat_nth, periodstrings[9]);
                break;
         case CSA_X_DT_REPEAT_OTHER:
                sprintf(pstr, "%s", periodstrings[10]);
index dcb722bae2fa63703c7cd21e5caa73777118def3..c17d4b5c321509031c3984815ef8476619cf11cf 100644 (file)
@@ -923,7 +923,7 @@ xytoclock(int x, int y, Tick t)
        Tick tick;
        _Xltimeparams localtime_buf;
 
-       memset(&timestruct, NULL, sizeof(struct tm));
+       memset(&timestruct, 0, sizeof(struct tm));
 
        tm      = *_XLocaltime(&t, localtime_buf);
        mn      = tm.tm_mon + 1;
@@ -1094,7 +1094,7 @@ monthdayyear(int m, int d, int y)
 
        struct tm timestruct;
 
-       memset(&timestruct, NULL, sizeof(struct tm));
+       memset(&timestruct, 0, sizeof(struct tm));
        timestruct.tm_mon = m - 1;
        timestruct.tm_mday = d;
        timestruct.tm_year = y - 1900;
index 69ad7482d9c5fa4d30df51073f4c21d46a611c28..94f46bcee3c4d459cd3bad27038b9c14c43e9713 100644 (file)
@@ -146,7 +146,7 @@ cm_def_printer()
        }
 #else
        tmp = (char*)getenv("PRINTER");
-       if (tmp != NULL && *tmp != NULL) {
+       if (tmp != NULL && *tmp != '\0') {
                printer_name = (char*)malloc(strlen(tmp)+1);
                strcpy(printer_name, tmp);
        }
@@ -187,7 +187,7 @@ cm_strlen(register char *s)
 {
         register int n;
  
-       if (s==NULL) return NULL;
+       if (s==NULL) return 0;
        return (strlen(s));
 }
 
@@ -246,7 +246,7 @@ str_to_cr(char *s)
                 }
                 k++;
         }
-        newstr[k] = NULL;
+        newstr[k] = '\0';
         return(newstr);
 }
 
@@ -286,7 +286,7 @@ cr_to_str(char *s)
                        k++;
                }
        }
-       newstr[k] = NULL;
+       newstr[k] = '\0';
        return(newstr);
 }
 
@@ -504,7 +504,7 @@ get_head(char *str, char sep)
         if (ptr == buf)
                 return(NULL);
         else {
-                *ptr = NULL;
+                *ptr = '\0';
                 return(cm_strdup(buf));
         }
 }
@@ -584,7 +584,10 @@ cm_get_local_domain()
 #if defined(sun) || defined(USL) || defined(__uxp__)
                 sysinfo(SI_SRPC_DOMAIN, local_domain, DOM_NM_LN);
 #else
-               (void) getdomainname(local_domain, BUFSIZ);
+               if(-1 == getdomainname(local_domain, BUFSIZ)) {
+                       fprintf(stderr, "getdomainname() failed %d '%s'\n", errno, strerror(errno));
+               }
+               
 #endif /* sun || USL || __uxp__ */
        }
         return(local_domain);
@@ -733,10 +736,10 @@ match_forward(char *str1, char *str2)
                get_component(&str2, com2, '.');
 
                if (*com1) {
-                       if (*com2 == NULL)
+                       if (*com2 == '\0')
                                return (B_TRUE);
                } else {
-                       if (*com2 == NULL)
+                       if (*com2 == '\0')
                                return (B_TRUE);
                        else
                                return (B_FALSE);
@@ -747,18 +750,18 @@ match_forward(char *str1, char *str2)
 
                /* take care of case: a.b a. */
                if (strcmp(str2, ".") == 0
-                   && (strcmp(str1, ".") != 0 || *str1 != NULL))
+                   && (strcmp(str1, ".") != 0 || *str1 != '\0'))
                        return (B_FALSE);
 
                /* skip "." */
                if (*str1 == '.') {
-                       if (*str2 == NULL)
+                       if (*str2 == '\0')
                                return (B_TRUE);
                        else {
                                str1++;
                                str2++;
                        }
-               } else if (strcmp(str2, ".") == 0 || *str2 == NULL)
+               } else if (strcmp(str2, ".") == 0 || *str2 == '\0')
                        return (B_TRUE);
                else
                        return (B_FALSE);
@@ -796,10 +799,10 @@ match_backward(char *str1, char *str2)
                get_last_component(str2, &ptr2, com2, '.');
 
                if (*com1) {
-                       if (*com2 == NULL)
+                       if (*com2 == '\0')
                                return (B_TRUE);
                } else {
-                       if (*com2 == NULL)
+                       if (*com2 == '\0')
                                return (B_TRUE);
                        else
                                return (B_FALSE);
@@ -1041,9 +1044,9 @@ parse_date(OrderingType order, SeparatorType sep, char *datestr, char *m,
         char *tmp_date, *str = separator_str(sep);
        _Xstrtokparams strtok_buf;
  
-        m[0] = NULL;
-        d[0] = NULL;
-        y[0] = NULL;
+        m[0] = '\0';
+        d[0] = '\0';
+        y[0] = '\0';
  
         if (datestr == NULL)
                 return 0;
@@ -1098,7 +1101,7 @@ extern int
 datestr2mdy(char *datestr, OrderingType order, SeparatorType sep, char *buf) {
         char m[3], d[3], y[5];
  
-        buf[0] = NULL;
+        buf[0] = '\0';
         if (datestr == NULL)
                 return 0;
  
@@ -1124,7 +1127,7 @@ format_tick(Tick tick, OrderingType order, SeparatorType sep, char *buff) {
         struct tm      *tm;
        _Xltimeparams   localtime_buf;
  
-        buff[0] = NULL;
+        buff[0] = '\0';
         tm = _XLocaltime(&tick, localtime_buf);
  
         switch (order) {
@@ -1150,7 +1153,7 @@ format_time(Tick t, DisplayType dt, char *buffer) {
        boolean_t       am;
 
        if (t == 0) {
-               sprintf(buffer, "\0");
+               buffer[0] = '\0';
 
        } else if (dt == HOUR12) {
                am = adjust_hour(&hr);
@@ -1234,7 +1237,7 @@ Dtcm_appointment *allocate_appt_struct (Allocation_reason reason, int version, .
         */
        idx = sizeof(Dtcm_appointment);
        appt = (Dtcm_appointment *)ckalloc(idx);
-       memset(appt, NULL, idx);
+       memset(appt, 0, idx);
        appt->reason = reason;
        appt->version = version;
 
@@ -1246,7 +1249,7 @@ Dtcm_appointment *allocate_appt_struct (Allocation_reason reason, int version, .
        api_idx = va_arg(pvar, int);
        while (api_idx) {
                if ((reason == appt_read) || !entry_ident_index_ro(api_idx, version))
-                       CmDataListAdd(api_ids, (void *)api_idx, 0);
+                       CmDataListAdd(api_ids, (void *) (intptr_t) api_idx, 0);
                api_idx = va_arg(pvar, int);
        }
        va_end(pvar);
@@ -1268,7 +1271,7 @@ Dtcm_appointment *allocate_appt_struct (Allocation_reason reason, int version, .
                for (idx = 0; idx < def_attr_count; idx++) {
                        if ((reason == appt_write) && entry_ident_index_ro(default_appt_attrs[idx], version))
                                continue;
-                       CmDataListAdd(api_ids, (void *)default_appt_attrs[idx], 0);
+                       CmDataListAdd(api_ids, (void *) (intptr_t) default_appt_attrs[idx], 0);
                }
        }
 
@@ -1281,20 +1284,20 @@ Dtcm_appointment *allocate_appt_struct (Allocation_reason reason, int version, .
        appt->num_names = api_ids->count;
        idx = sizeof(CSA_attribute_reference *) * appt->num_names;
        appt->names = (CSA_attribute_reference *)ckalloc(idx);
-       memset(appt->names, NULL, idx);
+       memset(appt->names, 0, idx);
 
        appt->count = api_ids->count;
        if (reason == appt_write) {
                idx = sizeof(CSA_attribute) * appt->count;
                appt->attrs = (CSA_attribute *)ckalloc(idx);
-               memset(appt->attrs, NULL, idx);
+               memset(appt->attrs, 0, idx);
        }
 
        /*
         * Now loop through and set the names and initialize the attributes
         */
        for (idx = 0; idx < appt->count; idx++) {
-               api_idx = (int)CmDataListGetData(api_ids, idx + 1);
+               api_idx = (int) (intptr_t) CmDataListGetData(api_ids, idx + 1);
                appt->names[idx] = strdup(_CSA_entry_attribute_names[api_idx]);
                if (reason == appt_write)
                        initialize_entry_attr(api_idx, &appt->attrs[idx], reason, version);
@@ -1303,7 +1306,7 @@ Dtcm_appointment *allocate_appt_struct (Allocation_reason reason, int version, .
        if (reason == appt_write)
                set_appt_links(appt);
 
-       CmDataListDestroy(api_ids, NULL);
+       CmDataListDestroy(api_ids, 0);
        return appt;
 }
 
@@ -1356,7 +1359,7 @@ allocate_cal_struct(Allocation_reason reason, int version, ...) {
         */
        idx = sizeof(Dtcm_calendar);
        cal = (Dtcm_calendar *)ckalloc(idx);
-       memset(cal, NULL, idx);
+       memset(cal, 0, idx);
        cal->reason = reason;
        cal->version = version;
 
@@ -1368,7 +1371,7 @@ allocate_cal_struct(Allocation_reason reason, int version, ...) {
        api_idx = va_arg(pvar, int);
        while (api_idx) {
                if ((reason == appt_read) || !cal_ident_index_ro(api_idx, version))
-                       CmDataListAdd(api_ids, (void *)api_idx, 0);
+                       CmDataListAdd(api_ids, (void *) (intptr_t) api_idx, 0);
                api_idx = va_arg(pvar, int);
        }
        va_end(pvar);
@@ -1380,7 +1383,7 @@ allocate_cal_struct(Allocation_reason reason, int version, ...) {
                for (idx = 0; idx < DEF_CAL_ATTR_COUNT; idx++) {
                        if ((reason == appt_write) && cal_ident_index_ro(default_cal_attrs[idx], version))
                                continue;
-                       CmDataListAdd(api_ids, (void *)default_cal_attrs[idx], 0);
+                       CmDataListAdd(api_ids, (void *) (intptr_t) default_cal_attrs[idx], 0);
                }
        }
 
@@ -1393,20 +1396,20 @@ allocate_cal_struct(Allocation_reason reason, int version, ...) {
        cal->num_names = api_ids->count;
        idx = sizeof(CSA_attribute_reference) * cal->num_names;
        cal->names = (CSA_attribute_reference *)ckalloc(idx);
-       memset(cal->names, NULL, idx);
+       memset(cal->names, 0, idx);
 
        cal->count = api_ids->count;
        if (reason == appt_write) {
                idx = sizeof(CSA_attribute) * cal->count;
                cal->attrs = (CSA_attribute *)ckalloc(idx);
-               memset(cal->attrs, NULL, idx);
+               memset(cal->attrs, 0, idx);
        }
 
        /*
         * Now loop through and set the names and initialize the attributes
         */
        for (idx = 0; idx < cal->count; idx++) {
-               api_idx = (int)CmDataListGetData(api_ids, idx + 1);
+               api_idx = (int) (intptr_t) CmDataListGetData(api_ids, idx + 1);
                cal->names[idx] = strdup(_CSA_calendar_attribute_names[api_idx]);
                if (reason == appt_write)
                        initialize_cal_attr(api_idx, &cal->attrs[idx], reason, version);
@@ -1415,7 +1418,7 @@ allocate_cal_struct(Allocation_reason reason, int version, ...) {
        if (reason == appt_write) 
                set_cal_links(cal);
 
-       CmDataListDestroy(api_ids, NULL);
+       CmDataListDestroy(api_ids, 0);
 
 
        return cal;
@@ -1455,7 +1458,7 @@ scrub_cal_attr_list(Dtcm_calendar *cal) {
        for (i = 0; i < cal->count; i++) {
                if (cal->attrs[i].value->type == CSA_VALUE_REMINDER) {
                        if ((cal->attrs[i].value->item.reminder_value->lead_time == NULL) || 
-                            (cal->attrs[i].value->item.reminder_value->lead_time[0] == NULL)) {
+                            (cal->attrs[i].value->item.reminder_value->lead_time[0] == '\0')) {
                                free(cal->attrs[i].name);
                                cal->attrs[i].name = NULL;
                        }
@@ -1665,7 +1668,7 @@ initialize_cal_attr(int id, CSA_attribute *attrs, Allocation_reason reason, int
        if ((reason == appt_write) && !cal_ident_index_ro(id, version)) {
                size = sizeof(CSA_attribute_value);
                attrs->value = (CSA_attribute_value *)ckalloc(size);
-               memset(attrs->value, NULL, size);
+               memset(attrs->value, 0, size);
                attrs->value->type = cal_ident_index_tag(id);
                if (attrs->value->type == CSA_VALUE_REMINDER)
                        attrs->value->item.reminder_value = (CSA_reminder *) calloc(sizeof(CSA_reminder), 1);
@@ -1709,7 +1712,7 @@ initialize_entry_attr(int id, CSA_attribute *attrs, Allocation_reason reason, in
        if ((reason == appt_write) && !entry_ident_index_ro(id, version)) {
                size = sizeof(CSA_attribute_value);
                attrs->value = (CSA_attribute_value *)ckalloc(size);
-               memset(attrs->value, NULL, size);
+               memset(attrs->value, 0, size);
                attrs->value->type = entry_ident_index_tag(id);
                if (attrs->value->type == CSA_VALUE_REMINDER)
                        attrs->value->item.reminder_value = (CSA_reminder *) calloc(sizeof(CSA_reminder), 1);
@@ -1900,11 +1903,11 @@ setup_range(CSA_attribute **attrs, CSA_enum **ops, int *count, time_t start,
 
        a_size = sizeof(CSA_attribute) * (*count);
        attr_ptr = (CSA_attribute *)ckalloc(a_size);
-       memset(attr_ptr, NULL, a_size);
+       memset(attr_ptr, 0, a_size);
 
        o_size = sizeof(CSA_enum) * (*count);
        op_ptr = (CSA_enum *)ckalloc(o_size);
-       memset(op_ptr, NULL, o_size);
+       memset(op_ptr, 0, o_size);
 
        initialize_entry_attr(CSA_ENTRY_ATTR_START_DATE_I, &attr_ptr[0], appt_write, version);
        attr_ptr[0].value->item.string_value = malloc(BUFSIZ);
index bd5e88ee301c37cd7a0e0e5c6d06b793f6663f2e..a530e9bdd3e69df3f41dd355acd33ca543c7fe12 100644 (file)
@@ -539,7 +539,7 @@ _DtCmsDoUpdateEntryCallback(
        if (newid > 0)
                sprintf(nbuf, "%ld", newid);
        else
-               nbuf[0] = NULL;
+               nbuf[0] = '\0';
        udata.newid = nbuf;
        udata.scope = scope;
        udata.time = time;
index e981e6d6e4e7c869ae8c62d56909e6ff3371b34d..4b4d95c252c81d44e2963bf496047a3bdb2b6689 100644 (file)
@@ -292,7 +292,7 @@ _DtCmsSetFileVersion(_DtCmsCalendar *cal, int version)
                if ((cal->types = (int *)calloc(1, sizeof(int) *
                    (_DtCm_entry_name_tbl->size + 1))) == NULL) {
                        _DtCmsFreeCalendar(cal);
-                       return (NULL);
+                       return (0);
                } else
                        _DtCm_get_attribute_types(_DtCm_entry_name_tbl->size,
                                cal->types);
@@ -476,7 +476,7 @@ _DtCmsGetCalendarByName(char *target, boolean_t load, _DtCmsCalendar **cal)
        _DtCmsCalendar *clist = calendar_list;
 
        if ((name = get_calname(target)) == NULL)
-               return (NULL);
+               return (0);
 
        while (clist != NULL) {
                if (strcmp (name, clist->calendar) == 0) {
@@ -1033,7 +1033,7 @@ get_calname(char *target)
        if (ptr == NULL) {
                return (strdup(target));
        } else {
-               *ptr = NULL;
+               *ptr = '\0';
                name = strdup(target);
                *ptr = '@';
                return (name);
index a5f3bc2715021f76f19e76da13adf220affe6646..618d15a78f0feceb3d8241cfa1c8ea23802f6d8c 100644 (file)
@@ -1239,7 +1239,7 @@ _DtCmsCreateCallog(char *user, cms_create_args *args, _DtCmsCalendar **newcal)
 
        /* use passed in char set if client does not supply one */
        if (cal->attrs[CSA_CAL_ATTR_CHARACTER_SET_I].value == NULL &&
-            args->char_set && *args->char_set != NULL) {
+            args->char_set && *args->char_set != '\0') {
                if ((stat = _DtCm_set_string_attrval(args->char_set,
                    &cal->attrs[CSA_CAL_ATTR_CHARACTER_SET_I].value,
                    CSA_VALUE_STRING)) != CSA_SUCCESS) {
@@ -1335,7 +1335,7 @@ _grow_char_array(void *ptr, uint oldcount, uint newcount)
        void *nptr;
 
        if (nptr = realloc(ptr, newcount)) {
-               memset((void *)((char *)nptr + oldcount), NULL,
+               memset((void *)((char *)nptr + oldcount), 0,
                        newcount - oldcount);
                return (nptr);
        } else
index 2d44d0efdf0d10ef607b16014fc3cfe344d50b1a..5c79ed52175236cfd0ce1dad62735d8a9c28a1fc 100644 (file)
@@ -112,7 +112,7 @@ static u_int  sendit_value[255];
 #define TVAL(a,b) { #a,-1, -1, &externTag.tag,b,TAGSVAL }
 #define SVAL(a,b) { #a,-1, -1, &externPrivacy,b,PRIVACYVAL}
 
-#define EMP(a,b) {#a,-1, -1, NULL,NULL,b}
+#define EMP(a,b) {#a,-1, -1, 0, 0,b}
 
 token_data_t tokens[] = {
   PVAL(single, single_4),
@@ -305,7 +305,7 @@ yyylex()
 
       unput_char();
 
-      *ptr = NULL;
+      *ptr = '\0';
 
       externNumberVal=atoi((char *)parse_buffer); 
       return(NUMBER);
@@ -320,7 +320,7 @@ yyylex()
 
        unput_char();
 
-       *ptr = NULL;
+       *ptr = '\0';
 
        if ((bucket = tokens[hash_string((char *) parse_buffer)].first_token)
            == -1) {
index 9b44ecb29c14b4fe474f359e010e74c0e600d7fb..e7a9e7c2215d48f8ac7f80cf588510acbf0a1c6e 100644 (file)
@@ -319,9 +319,9 @@ _DtCmsAppendAppt4ByFD(int f, Appt_4 *appt, _DtCmsLogOps op)
                                               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);
@@ -354,7 +354,7 @@ _DtCmsAppendAppt4ByFD(int f, Appt_4 *appt, _DtCmsLogOps op)
                }
                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);
                }
@@ -494,7 +494,7 @@ _DtCmsPrintAppt4(caddr_t data)
        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);
@@ -520,7 +520,7 @@ _DtCmsPrintAppt4(caddr_t data)
                        return (B_TRUE);
        }
 
-       buf[0]=NULL;  
+       buf[0] = '\0';  
        periodtostr (appt->period.period, buf);
        if (fprintf(stderr, "period: %s ", buf) == EOF)
                return (B_TRUE);
@@ -531,7 +531,7 @@ _DtCmsPrintAppt4(caddr_t data)
        }
        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);
        }
@@ -573,7 +573,7 @@ _DtCmsPrintAppt4(caddr_t data)
                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)
@@ -585,12 +585,12 @@ _DtCmsPrintAppt4(caddr_t data)
        }
 
 
-       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);
@@ -647,8 +647,11 @@ _DtCmsTruncateFile(char *calendar, int size)
                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);
 }
@@ -691,12 +694,12 @@ _DtCmsWriteVersionString(char *file, int version)
        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);
        }
 
@@ -733,7 +736,9 @@ _DtCmsSetFileMode(
 #ifdef HPUX
                setuid (0);
 #else
-               seteuid (0);
+               if(-1 == seteuid (0)) {
+                       perror(strerror(errno));
+               }
 #endif
 #endif
        }
@@ -784,7 +789,7 @@ static void
 periodtostr(Interval_4 i, char *q)
 {
        if (q==NULL) return;
-       q[0]=NULL;
+       q[0] = '\0';
        switch (i) {
                case single_4:
                        strcpy (q, "single");
@@ -838,7 +843,7 @@ static void
 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");
@@ -859,7 +864,7 @@ static void
 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");
@@ -889,7 +894,7 @@ static void
 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");
@@ -933,7 +938,7 @@ create_log(char *owner, char *file, int version)
        CSA_return_code stat;
 
        ptr = strchr(owner, '@');
-       if (ptr) *ptr = NULL;
+       if (ptr) *ptr = '\0';
        pw = getpwnam (owner);
        if (ptr) *ptr = '@';
        if (pw == NULL)
@@ -993,7 +998,10 @@ append_log(int f, char *buf)
                        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);        
        }
 
@@ -1068,7 +1076,7 @@ attrs_to_attrliststr(
        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 ||
@@ -1089,7 +1097,7 @@ attrs_to_attrliststr(
 
                /* value string */
                body = NULL;
-               *tmpbuf2 = NULL;
+               *tmpbuf2 = '\0';
                switch (attrs[i].value->type) {
                case CSA_VALUE_ENUMERATED:
                case CSA_VALUE_SINT32:
@@ -1207,7 +1215,7 @@ attrs_to_attrliststr(
                        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);
@@ -1280,7 +1288,7 @@ cr_to_str(char *s, int size)
                        k++;
                }
        }
-       newstr[k] = NULL;
+       newstr[k] = '\0';
        return(newstr);
 }
 
index 1f71577453f9a0e4a4c7ddf2e08f4b3f63f01028..4df1c1a17688a7e5433406aa4396e6cf1eaa95ce 100644 (file)
@@ -272,7 +272,7 @@ appointmentBody     : tick key what details duration period nth enddate ntimes excep
                                        newp->author = $12;
                                        newp->attr = $13;
 
-                                       if (temp != NULL && (*temp)!=NULL) {
+                                       if (temp != NULL && (*temp)!='\0') {
                                                item = newp->attr;
                                                while(item!=NULL) {
                                                        if(strcmp(item->attr, "ml")==0) {
@@ -372,7 +372,7 @@ mailto              : /* empty */
 
 duration       : /* empty */
                        {
-                               $$ = NULL;
+                               $$ = '\0';
                        }
                | DURATION COLON number
                        {
@@ -693,7 +693,7 @@ str_to_cr(char *s)
                 }
                 k++;
         }
-        newstr[k] = NULL;
+        newstr[k] = '\0';
         return(newstr);
 }
 
@@ -763,7 +763,7 @@ convert_2_tick(char *datestr)
        if (datestr == NULL)
                return (-1);
 
-       memset((void *)&tmstr, NULL, sizeof(struct tm));
+       memset((void *)&tmstr, 0, sizeof(struct tm));
 
        strcpy(datebuf, datestr);
 
@@ -791,7 +791,7 @@ convert_2_tick(char *datestr)
                if ((tptr = strchr(ptr, ':')) == NULL)
                        return (-1);
                else {
-                       *tptr = NULL;
+                       *tptr = '\0';
                        tmstr.tm_hour = atoi(ptr);
                }
 
@@ -799,7 +799,7 @@ convert_2_tick(char *datestr)
                if ((tptr = strchr(ptr, ':')) == NULL)
                        return (-1);
                else {
-                       *tptr = NULL;
+                       *tptr = '\0';
                        tmstr.tm_min = atoi(ptr);
                }
 
@@ -907,11 +907,11 @@ get_attr_value(int type, char *valstr, cms_attribute_value **attrval)
                stat = _DtCm_set_string_attrval(valstr, attrval, type);
                break;
        case CSA_VALUE_REMINDER:
-               memset((void *)&remval, NULL, sizeof (CSA_reminder));
+               memset((void *)&remval, 0, sizeof (CSA_reminder));
                if (ptr1 = strchr(valstr, ':')) {
-                       *ptr1++ = NULL;
+                       *ptr1++ = '\0';
                        if (ptr2 = strchr(ptr1, ':')) {
-                               *ptr2++ = NULL;
+                               *ptr2++ = '\0';
                                ptr3 = strchr(ptr2, ':');
                        }
                }
@@ -929,9 +929,9 @@ get_attr_value(int type, char *valstr, cms_attribute_value **attrval)
                        stat = _DtCm_set_reminder_attrval(&remval, attrval);
                } else {
                        /* format = "string:string:number:number:string" */
-                       *ptr3++ = NULL;
+                       *ptr3++ = '\0';
                        if (ptr4 = strchr(ptr3, ':')) {
-                               *ptr4++ = NULL;
+                               *ptr4++ = '\0';
                                remval.lead_time = valstr;
                                remval.snooze_time = ptr1;
                                remval.repeat_count = atoi(ptr2);
@@ -953,7 +953,7 @@ get_attr_value(int type, char *valstr, cms_attribute_value **attrval)
                break;
        case CSA_VALUE_OPAQUE_DATA:
                if (ptr1 = strchr(valstr, ':')) {
-                       *ptr1++ = NULL;
+                       *ptr1++ = '\0';
                        opqval.size = atoi(valstr);
                        opqval.data = (unsigned char *)ptr1;
                        stat = _DtCm_set_opaque_attrval(&opqval, attrval);
@@ -1042,7 +1042,7 @@ get_user_access_entry(char *string, cms_access_entry **a)
                return (CSA_E_INSUFFICIENT_MEMORY);
        }
 
-       *ptr = NULL;
+       *ptr = '\0';
        if ((item->user = strdup(string)) == NULL) {
                free(item);
                return (CSA_E_INSUFFICIENT_MEMORY);
@@ -1070,7 +1070,7 @@ grow_attr_array(_attr_array *attrs)
        attrs->total += _DEFAULT_ARRAY_SIZE;
        attrs->attrs = newptr;
 
-       memset((void *)&attrs->attrs[attrs->current], NULL,
+       memset((void *)&attrs->attrs[attrs->current], 0,
                sizeof(cms_attribute)*_DEFAULT_ARRAY_SIZE);
 }
 
index 5733241a4644460c6fc6536605df3081ca3f0f0a..5109a5966be27c9809dcc82caa8573fb4add5a6d 100644 (file)
@@ -352,7 +352,7 @@ DoWeek(
        if (_target_time) {
                if (!(unused = InitRepeatEventState(re)))
                        return (Tick)NULL;
-               start_time = DoWeek(NULL, _start_time, re, unused);
+               start_time = DoWeek(0, _start_time, re, unused);
                free(unused);
                if (_target_time < start_time)
                        target_time = start_time;
@@ -677,7 +677,7 @@ DoYearByMonth(
        if (_target_time) {
                if (!(unused = InitRepeatEventState(re)))
                        return (Tick)NULL;
-               start_time = DoYearByMonth(NULL, _start_time, re, unused);
+               start_time = DoYearByMonth(0, _start_time, re, unused);
                free(unused);
                if (_target_time < start_time)
                        target_time = start_time;
@@ -781,7 +781,7 @@ DoYearByDay(
        if (_target_time) {
                if (!(unused = InitRepeatEventState(re)))
                        return (Tick)NULL;
-               start_time = DoYearByDay(NULL, _start_time, re, unused);
+               start_time = DoYearByDay(0, _start_time, re, unused);
                free(unused);
                if (_target_time < start_time)
                        target_time = start_time;
index 89fa9e4c5aae6c1a3b41cc1b4a247cd9eb5c085f..dcc6fec696c4714be4575bff753044c6eb2eaf4f 100644 (file)
@@ -76,7 +76,7 @@ static int monthsecs[12] = {
        31*daysec,      30*daysec,      31*daysec
 };
 
-extern int monthdays[12] = {
+int monthdays[12] = {
        31,     28,     31,
        30,     31,     30,
        31,     31,     30,
index 63bf98fe5ebeeca2ee82b4e5857fcfd39651e1d0..fc9f3169d914e7d2b73100a911f192cf0d661e70 100644 (file)
@@ -106,7 +106,7 @@ ReToString(
                        strcat (cmd_buf, subcommand);
                }
 
-               memset (subcommand, NULL, 1024);
+               memset (subcommand, 0, 1024);
 
                re = re->re_next;
        }
index bb4f7ed6dbc8a024e2ec207403ae7e8e2951a4bb..d97830ee7004eb38e4942ad906e128c9c8313715 100644 (file)
@@ -305,7 +305,7 @@ DeriveNewStartTime(
         * time should be.
         */
        while (--num_events &&
-              (an_event = PrevTick(an_event, NULL, new_re, res))) {
+              (an_event = PrevTick(an_event, 0, new_re, res))) {
               ;
        }
 
index d329f6846954acf2786f4955de2c03ad02035263..7e14fc8539ff1d809443f8f5d16954c941025ad4 100644 (file)
@@ -112,7 +112,7 @@ _GetGtime(char *timestr)
        }
 
        minute = atoi(&timestr[len - 2]);
-       timestr[len - 2] = NULL;
+       timestr[len - 2] = '\0';
        hour = atoi(timestr);
 
        if (hour > 23 || minute > 59)
@@ -273,7 +273,9 @@ init_dir()
        }
 
        /* Change current directory, so core file can be dumped. */
-       chdir (dir);
+       if(-1 == chdir (dir)) {
+               perror(strerror(errno));
+       }
 }
 
 /*
@@ -754,8 +756,12 @@ main(int argc, char **argv)
        setgid (daemon_gid);
        setuid (daemon_uid);
 #else
-       setegid (daemon_gid);
-       seteuid (daemon_uid);
+       if(-1 == setegid (daemon_gid)) {
+               perror(strerror(errno));
+       }
+       if(-1 == seteuid (daemon_uid)) {
+               perror(strerror(errno));
+       }
 #endif /* HPUX */
 #endif /* AIX */
 
index 1c0c55147e1de2820213135d4f26282c3b233dc2..0acf876cccc1de2bc709737a8383ff5155220f60 100644 (file)
@@ -319,14 +319,14 @@ _DtCmsUpdateDurationInRule(cms_entry *entry, uint remain)
 
        sprintf(buf, "#%d", remain);
        if (ptr = strchr(vptr->item.string_value, '#')) {
-               *ptr = NULL;
+               *ptr = '\0';
                strcpy(newrule, vptr->item.string_value);
                strcat(newrule, buf);
                if (ptr = strchr(ptr + 1, ' '))
                        strcat(newrule, ptr);
        } else {
                if (ptr = strchr(vptr->item.string_value, ' ')) {
-                       *ptr = NULL;
+                       *ptr = '\0';
                        sprintf(newrule, "%s %s %s", vptr->item.string_value,
                                buf, ptr+1);
                } else