00001
00002
00003
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include <string.h>
00007 #include <stdarg.h>
00008 #include "../str.h"
00009
00010
00011 #define EXTRA_DEBUG
00012 #include "../parser/parse_to.c"
00013 #include "../dprint.c"
00014
00015
00016 int ser_error=0;
00017 int log_stderr=1;
00018 int process_no=0;
00019 struct process_table* pt=0;
00020 int phone2tel=1;
00021
00022 int my_pid() {return 0; };
00023
00024 struct cfg_group_core default_core_cfg = {
00025 L_DBG,
00026 LOG_DAEMON,
00027 #ifdef USE_DST_BLACKLIST
00028
00029 0,
00030 DEFAULT_BLST_TIMEOUT,
00031 DEFAULT_BLST_MAX_MEM,
00032 #endif
00033
00034 #ifdef USE_IPV6
00035 1,
00036 #else
00037 0,
00038 #endif
00039 0,
00040 30,
00041 20,
00042 10,
00043 20,
00044 -1,
00045 -1,
00046 -1,
00047 1,
00048 1,
00049 0,
00050
00051 #ifdef USE_DNS_CACHE
00052 1,
00053 0,
00054 0,
00055 0,
00056 DEFAULT_DNS_NEG_CACHE_TTL,
00057 DEFAULT_DNS_CACHE_MIN_TTL,
00058 DEFAULT_DNS_CACHE_MAX_TTL,
00059 DEFAULT_DNS_MAX_MEM,
00060 0,
00061 #endif
00062 #ifdef PKG_MALLOC
00063 0,
00064 #endif
00065 #ifdef SHM_MEM
00066 0,
00067 #endif
00068 };
00069
00070 void *core_cfg = &default_core_cfg;
00071
00072 void dprint(char * format, ...)
00073 {
00074 va_list ap;
00075
00076 fprintf(stderr, "%2d(%d) ", process_no, my_pid());
00077 va_start(ap, format);
00078 vfprintf(stderr,format,ap);
00079 fflush(stderr);
00080 va_end(ap);
00081 }
00082
00083
00084
00085 int main (int argc, char** argv)
00086 {
00087
00088 int r;
00089 struct to_body to_b;
00090 struct to_param *p;
00091
00092 if (argc<2){
00093 printf("usage: %s to_body [, to_body...]\n", argv[0]);
00094 exit(1);
00095 }
00096
00097 for (r=1; r<argc; r++){
00098
00099 if (parse_to(argv[r], argv[r]+strlen(argv[r]), &to_b)==0 ||
00100 to_b.error!=1){
00101 printf("error: parsing %s\n", argv[r]);
00102 continue;
00103 }
00104 printf("body: [%.*s]\n", to_b.body.len, to_b.body.s);
00105 printf("uri: [%.*s]\n", to_b.uri.len, to_b.uri.s);
00106 printf("display: [%.*s]\n", to_b.display.len, to_b.display.s);
00107 printf("tag: [%.*s]\n\n", to_b.tag_value.len, to_b.tag_value.s);
00108 for (p=to_b.param_lst; p; p=p->next){
00109 printf(" param type: %d\n", p->type);
00110 printf(" param name: [%.*s]\n", p->name.len, p->name.s);
00111 printf(" param value: [%.*s]\n\n", p->value.len, p->value.s);
00112 }
00113 printf("\n");
00114 }
00115 return 0;
00116 }