- data[1] will contain day of retrieval */
- if( strchr(buf, '\t') ) {
- data = g_strsplit(buf,"\t",2);
- snprintf(data[1], sizeof(data[1]), "%d", g_date_day_of_year(curdate) );
- }
- else {
- data[0] = g_strdup(buf);
- snprintf(data[1], sizeof(data[1]), "%d", g_date_day_of_year(curdate) );
- }
- g_hash_table_insert(table, g_strdup(data[0]), g_strdup(data[1]));
+ * data[1] will contain day of retrieval */
+
+ /*
+ * FIXME: convoluted implementation. need to find
+ * a better way to split the string.
+ */
+ if (strchr(buf, '\t')) {
+ data = g_strsplit(buf, "\t", 2);
+ if (data) {
+ g_hash_table_insert(table, g_strdup(data[0]), g_strdup(data[1]));
+ g_strfreev(data);
+ }
+ } else {
+ g_date_set_time(&curdate, time(NULL));
+ g_hash_table_insert(table, g_strdup(buf),
+ g_strdup_printf("%d", g_date_day_of_year(&curdate)));
+ }