]> mj.ucw.cz Git - umpf.git/blob - umpf.c
78ea955950ac3cf9522727e946f8f02926e9b127
[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 /*      //FIXME:
22         struct passwd* p;
23         p = getpwuid(getuid());
24         char* default_mbox = cat("/var/mail/", p->pw_name);
25         get_default_mailbox(default_mbox);
26 */
27         if (argc < 2)
28                 die("Usage: ./umpf conf_file");
29
30         save_gids();
31         read_conf(argv[1]);
32         init();
33 //      yydebug=1;
34         res = yyparse ();
35
36         if (res)
37                 return res;
38
39         temp_varcode_start = current_varcode;
40         compile(input_tree, NULL);
41
42 //      print_code();
43
44         current_headers = make_hlist();
45         current_body = get_body();
46         print_headers(current_headers);
47         save_current_headers(var_hash);
48         interp(&input_code);
49         print_vars(var_hash);
50
51         return 0;
52 }