]> mj.ucw.cz Git - umpf.git/blob - umpf.c
cope with old locks
[umpf.git] / umpf.c
1 #include <stdio.h>
2 #include <pwd.h>
3
4 #include "umpf.h"
5
6 void
7 init(void)
8 {
9         list_init(&input_code);
10         var_hash = new_var_hash();
11         const_tab = xmalloc(BUFSIZE);
12         cur_const_n = 1;
13         cur_const_s = BUFSIZE;
14 }
15
16 int
17 main(int argc, char** argv)
18 {
19         int res;
20         
21         if (argc < 2)
22                 die("Usage: ./umpf conf_file [default_mailbox]");
23
24         struct passwd* p;
25         p = getpwuid(getuid());
26         if (argc < 3)
27                  default_mailbox = cat("/var/mail/", p->pw_name);
28         else
29                  default_mailbox = argv[2];
30
31         save_gids();
32         read_conf(argv[1]);
33         init();
34 //      yydebug=1;
35         res = yyparse ();
36
37         if (res)
38                 return res;
39
40         temp_varcode_start = current_varcode;
41         compile(input_tree, NULL);
42
43         current_headers = make_hlist();
44 //      print_headers(current_headers);
45         current_body = get_body();
46         save_current_headers(var_hash);
47
48         interp(&input_code, var_hash);
49
50         return 0;
51 }