dtcm: Resolve CID 87562
[oweals/cde.git] / cde / programs / dtcm / dtcm / format.c
index 5484489b742ffab4bf204ad8f72557ce9c3b0090..da4db1432e24e27f1d5fa93c7d57d243763c67d2 100644 (file)
@@ -1,3 +1,25 @@
+/*
+ * CDE - Common Desktop Environment
+ *
+ * Copyright (c) 1993-2012, The Open Group. All rights reserved.
+ *
+ * These libraries and programs are free software; you can
+ * redistribute them and/or modify them under the terms of the GNU
+ * Lesser General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * These libraries and programs are distributed in the hope that
+ * they will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with these librararies and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+ */
 /*******************************************************************************
 **
 **  format.c
@@ -47,6 +69,9 @@ static char sccsid[] = "@(#)format.c 1.27 95/01/19 Copyr 1991 Sun Microsystems,
 
 #define XOS_USE_XT_LOCKING
 #define X_INCLUDE_TIME_H
+#if defined(linux)
+#undef SVR4
+#endif
 #include <X11/Xos_r.h>
 
 /*
@@ -60,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;
@@ -132,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; 
@@ -169,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;
@@ -202,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)
@@ -237,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;
@@ -311,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;
@@ -357,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);