Enlightenment CVS committal

Author  : sarajervi
Project : misc
Module  : erss

Dir     : misc/erss/src


Modified Files:
        erss.c parse.c 


Log Message:
fix the lame time_format code into something more spiffy..
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/erss.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- erss.c      13 Jan 2004 22:52:00 -0000      1.15
+++ erss.c      13 Jan 2004 23:04:25 -0000      1.16
@@ -77,32 +77,10 @@
        curtime = time(NULL);
        ts = localtime(&curtime);
 
-       str = malloc (21);
-       
-       if (ts->tm_hour < 10 && ts->tm_min < 10 && ts->tm_sec < 10)
-               snprintf (str, 20, "0%d:0%d:0%d", 
-                               ts->tm_hour, ts->tm_min, ts->tm_sec);
-       else if (ts->tm_hour < 10 && ts->tm_min < 10)
-               snprintf (str, 20, "0%d:0%d:%d",
-                               ts->tm_hour, ts->tm_min, ts->tm_sec);
-       else if (ts->tm_hour < 10 && ts->tm_sec < 10)
-               snprintf (str, 20, "0%d:%d:0%d",
-                               ts->tm_hour, ts->tm_min, ts->tm_sec);
-       else if (ts->tm_min < 10 && ts->tm_sec < 10)
-               snprintf (str, 20, "%d:0%d:0%d",
-                               ts->tm_hour, ts->tm_min, ts->tm_sec);
-       else if (ts->tm_hour < 10)
-               snprintf (str, 20, "0%d:%d:%d",
-                               ts->tm_hour, ts->tm_min, ts->tm_sec);
-       else if (ts->tm_min < 10)
-               snprintf (str, 20, "%d:0%d:%d",
-                               ts->tm_hour, ts->tm_min, ts->tm_sec);
-       else if (ts->tm_sec < 10)
-                snprintf (str, 20, "%d:%d:0%d",
-                                ts->tm_hour, ts->tm_min, ts->tm_sec);
-       else
-               snprintf (str, 20, "%d:%d:%d",
-                               ts->tm_hour, ts->tm_min, ts->tm_sec);
+       str = malloc (11);
+
+       snprintf (str, 20, "%02d:%02d:%02d", 
+                       ts->tm_hour, ts->tm_min, ts->tm_sec);
 
        return str;
 }
===================================================================
RCS file: /cvsroot/enlightenment/misc/erss/src/parse.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- parse.c     13 Jan 2004 22:57:33 -0000      1.13
+++ parse.c     13 Jan 2004 23:04:25 -0000      1.14
@@ -107,8 +107,7 @@
 
 void remove_garbage (char *c, char *garbage)
 {
-       char *str;
-       char *tmp;
+       char *str, *tmp;
 
        if (!garbage)
                return;
@@ -154,6 +153,8 @@
                 * We have a new story, allocate an item for it
                 */
                item = malloc (sizeof (Article));
+               item->description = NULL;
+               item->url = NULL;
                memset(item, 0, sizeof(Article));
 
                return;
@@ -261,8 +262,7 @@
 int parse_rc_file ()
 {
        FILE *fp;
-       char *line;
-       char *c;
+       char *line, *c;
        char file[PATH_MAX];
 
        snprintf (file, PATH_MAX, "%s/.erssrc", getenv ("HOME"));




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to