} else if(strcmp(key,RSS_TAG_LINK)==0) {
entry->link = strndup(value,i);
} else if(strcmp(key,RSS_TAG_PUBDATE)==0) {
- return -1;
+ if(NULL==strptime(
+ value, /* const char *s */
+ "%a, %d %b %Y %H:%M:%S %z", /* const char *format */
+ &(entry->pub_date) /* struct tm *tm */
+ )) { return -1; }
} else if(strcmp(key,RSS_TAG_DESCRIPTION)==0) {
entry->description = strndup(value,i);
} else if(strcmp(key,RSS_TAG_GUID)==0) {
} else if(strcmp(key,RSS_TAG_LANGUAGE)==0) {
info->language = strndup(value,i);
} else if(strcmp(key,RSS_TAG_LASTBUILDDATE)==0) {
- return -1;
+ if(NULL==strptime(
+ value, /* const char *s */
+ "%a, %d %b %Y %H:%M:%S %z", /* const char *format */
+ &(info->last_build_date) /* struct tm *tm */
+ )) { return -1; }
} else { goto panic; }
}
(*value) = strchr(buf,'=');
if(NULL==(*value)) { return -1; }
- (*value) = '\0';
+ (**value) = '\0';
(*value)++;
return buf_size - strlen(*key);
}
#define TEST_FILE_6 PREFIX "/file.torrent"
#define TEST_FILE_7 PREFIX "/file.feed"
#define TEST_FILE_8 PREFIX "/test.meta"
-#define TEST_FILE_8_CONTENTS "title=test title\nlink=https://whatisarealink.com\npubDate=0000\ndescription=I wonder if \\n this'll properly be formatted/escaped \\><?\nguid=magnet=asldkfjsldkfjslkdjfldsdjlfkjsdf"
+#define TEST_FILE_8_CONTENTS "title=test title\nlink=https://whatisarealink.com\npubDate=Wed, 29 Dec 2021 12:21:12 +0000\ndescription=I wonder if \\n this'll properly be formatted/escaped \\><?\nguid=magnet=asldkfjsldkfjslkdjfldsdjlfkjsdf"
#define TEST_FILE_9 PREFIX "/.meta"
-#define TEST_FILE_9_CONTENTS "title=TITLE\nlink=http://test.com\ndescription=what is a description\nlanguage=en-us\nlastBuildDate=0000"
+#define TEST_FILE_9_CONTENTS "title=TITLE\nlink=http://test.com\ndescription=what is a description\nlanguage=en-us\nlastBuilDate=Wed, 29 Dec 2021 12:21:12 +0000"
void clean_env();
void reset_env();