X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=umpf.c;h=19910a4a28376c4e894ab5c62ec491b8d5fbaf76;hb=f7469b506efca7aa155899a9398b7ce490dd4ba1;hp=f868775a6183f6e3541ca53320be67c724c23327;hpb=cb47d077417b11b8bd79562045e9b9f6511e03d3;p=umpf.git diff --git a/umpf.c b/umpf.c index f868775..19910a4 100644 --- a/umpf.c +++ b/umpf.c @@ -1,4 +1,5 @@ #include +#include #include #include "umpf.h" @@ -11,21 +12,24 @@ init(void) const_tab = xmalloc(BUFSIZE); cur_const_n = 1; cur_const_s = BUFSIZE; + empty = ""; } int main(int argc, char** argv) { int res; + int i; -/* //FIXME: + if (argc < 2) + die("Usage: ./umpf conf_file [default_mailbox]"); + struct passwd* p; p = getpwuid(getuid()); - char* default_mbox = cat("/var/mail/", p->pw_name); - get_default_mailbox(default_mbox); -*/ - if (argc < 2) - die("Usage: ./umpf conf_file"); + if (argc < 3) + default_mailbox = cat("/var/mail/", p->pw_name); + else + default_mailbox = argv[2]; save_gids(); read_conf(argv[1]); @@ -37,17 +41,19 @@ main(int argc, char** argv) return res; temp_varcode_start = current_varcode; - compile(input_tree); + compile(input_tree, NULL); - print_code(); + var_tab = xmalloc((max_varcode + 1) * sizeof(char*)); + for (i = 0; i <= max_varcode; i++) { + var_tab[i] = empty; + } -// var_hash = new_var_hash(); -// current_headers = make_hlist(); -// current_body = get_body(); + current_headers = make_hlist(); // print_headers(current_headers); -// save_current_headers(var_hash); -// interp(input_tree, var_hash); -// print_vars(var_hash); + current_body = get_body(); + save_current_headers(var_hash); + + interp(&input_code, var_hash); return 0; }