cp: define a FIXME macro that leaves a sclp message
[hvf.git] / cp / nucleus / config.y
blob055e94480bf68fabb38104a770245e065ab25740
1 %{
2 /*
3 * (C) Copyright 2007-2011 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
5 * This file is released under the GPLv2. See the COPYING file for more
6 * details.
7 */
9 #include <slab.h>
11 static void copy_fn(char *dst, char *src)
13 int len;
15 len = strnlen(src, 8);
17 memcpy(dst, src, 8);
18 if (len < 8)
19 memset(dst + len, ' ', 8 - len);
22 static void __logo(int local, u64 devtype, char *fn, char *ft)
24 struct logo *logo;
26 if (devtype > 0xffff)
27 goto out;
29 logo = malloc(sizeof(struct logo), ZONE_NORMAL);
30 if (!logo)
31 goto out;
33 INIT_LIST_HEAD(&logo->list);
34 INIT_LIST_HEAD(&logo->lines);
36 /* save the <conn, devtype, fn, ft> pair */
38 if (local)
39 logo->conn = LOGO_CONN_LOCAL;
40 else
41 goto out_free;
43 logo->devtype = devtype;
45 copy_fn(logo->fn, fn);
46 copy_fn(logo->ft, ft);
48 list_add_tail(&logo->list, &sysconf.logos);
50 return;
52 out_free:
53 free(logo);
54 out:
55 BUG();
58 static void __rdev(u64 devnum, u64 devtype)
60 assert(devtype <= 0xffff);
61 assert(devnum <= 0xffff);
63 FIXME("save the <devnum,devtype> pair");
66 static void __oper_con(u64 devnum)
68 assert(devnum <= 0xffff);
70 sysconf.oper_con = devnum;
73 static void __oper_userid(char *name)
75 strncpy(sysconf.oper_userid, name, 8);
76 sysconf.oper_userid[8] = '\0';
79 static void __direct(char *fn, char *ft)
81 copy_fn(sysconf.direct_fn, fn);
82 copy_fn(sysconf.direct_ft, ft);
87 %union {
88 char *ptr;
89 u64 num;
92 %token <ptr> WORD
93 %token <num> NUM
94 %token OPERATOR RDEV LOGO CONSOLE USERID LOCAL DIRECTORY
95 %token NLINE COMMENT
99 stmts : stmts stmt
100 | stmt
103 stmt : OPERATOR CONSOLE NUM NLINE { __oper_con($3); }
104 | OPERATOR USERID WORD NLINE { __oper_userid($3);
105 free($3);
107 | OPERATOR USERID OPERATOR NLINE { __oper_userid("OPERATOR"); }
108 | RDEV NUM NUM NLINE { __rdev($2, $3); }
109 | LOGO LOCAL NUM WORD WORD NLINE { __logo(1, $3, $4, $5);
110 free($4);
111 free($5);
113 | LOGO LOCAL NUM WORD LOGO NLINE { __logo(1, $3, $4, "LOGO");
114 free($4);
116 | DIRECTORY WORD WORD NLINE { __direct($2, $3);
117 free($2);
118 free($3);
120 | COMMENT NLINE
121 | NLINE