#include <string.h>#include "gwlib/gwlib.h"Include dependency graph for check_date.c:

Go to the source code of this file.
Functions | |
| void | check_reversible (void) |
| int | main (void) |
|
|
Definition at line 71 of file check_date.c. References date_format_http(), date_parse_http(), octstr_compare(), octstr_copy, octstr_destroy(), octstr_duplicate, octstr_get_cstr, octstr_read_file(), octstr_search_char(), and warning(). Referenced by main(). 00072 {
00073 Octstr *dates;
00074 long pos, endpos, tabpos;
00075 Octstr *date, *canondate;
00076 long timeval;
00077
00078 dates = octstr_read_file("checks/test_dates");
00079 if (dates == NULL)
00080 return;
00081
00082 for (pos = 0; ; pos = endpos + 1) {
00083 endpos = octstr_search_char(dates, '\n', pos);
00084 if (endpos < 0)
00085 break;
00086
00087 tabpos = octstr_search_char(dates, '\t', pos);
00088
00089 if (tabpos >= 0 && tabpos < endpos) {
00090 date = octstr_copy(dates, pos, tabpos - pos);
00091 canondate = octstr_copy(dates, tabpos + 1, endpos - tabpos - 1);
00092 } else {
00093 date = octstr_copy(dates, pos, endpos - pos);
00094 canondate = octstr_duplicate(date);
00095 }
00096
00097 timeval = date_parse_http(date);
00098 if (timeval == -1)
00099 warning(0, "Could not parse date \"%s\"", octstr_get_cstr(date));
00100 else {
00101 Octstr *newdate;
00102 newdate = date_format_http((unsigned long) timeval);
00103 if (octstr_compare(newdate, canondate) != 0) {
00104 warning(0, "Date not reversible: \"%s\" becomes \"%s\"",
00105 octstr_get_cstr(date), octstr_get_cstr(newdate));
00106 }
00107 octstr_destroy(newdate);
00108 }
00109
00110 octstr_destroy(date);
00111 octstr_destroy(canondate);
00112 }
00113
00114 octstr_destroy(dates);
00115 }
|
Here is the call graph for this function:

|
|
Definition at line 118 of file check_date.c. References check_reversible(), GW_INFO, gwlib_init(), gwlib_shutdown(), and log_set_output_level(). 00119 {
00120 gwlib_init();
00121 log_set_output_level(GW_INFO);
00122 check_reversible();
00123 gwlib_shutdown();
00124 return 0;
00125 }
|
Here is the call graph for this function:
