Remove building with NOCRYPTO option
[minix.git] / external / bsd / nvi / dist / ipc / ipc_cmd.c
blobadc4232c6a9d665d0afa02a09d1ce06d91273b52
1 /* $NetBSD: ipc_cmd.c,v 1.2 2013/11/22 15:52:05 christos Exp $ */
2 #include "config.h"
4 #include <sys/types.h>
5 #include <sys/queue.h>
7 #include <bitstring.h>
8 #include <limits.h>
9 #include <stdio.h>
11 #include "../common/common.h"
13 #include "ip.h"
15 static int ipc_unmarshall_a __P((IPVIWIN *, IP_BUF*, IPFunc));
16 static int ipc_unmarshall_12 __P((IPVIWIN *, IP_BUF*, IPFunc));
17 static int ipc_unmarshall __P((IPVIWIN *, IP_BUF*, IPFunc));
18 static int ipc_unmarshall_ab1 __P((IPVIWIN *, IP_BUF*, IPFunc));
19 #if 0
20 static int ipc_unmarshall_1a __P((IPVIWIN *, IP_BUF*, IPFunc));
21 #endif
22 static int ipc_unmarshall_1 __P((IPVIWIN *, IP_BUF*, IPFunc));
23 static int ipc_unmarshall_123 __P((IPVIWIN *, IP_BUF*, IPFunc));
25 #define OFFSET(t,m) ((size_t)&((t *)0)->m)
27 IPFUNLIST const ipfuns[] = {
28 /* SI_ADDSTR */
29 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, addstr)},
30 /* SI_ATTRIBUTE */
31 {"12", ipc_unmarshall_12, OFFSET(IPSIOPS, attribute)},
32 /* SI_BELL */
33 {"", ipc_unmarshall, OFFSET(IPSIOPS, bell)},
34 /* SI_BUSY_OFF */
35 {"", ipc_unmarshall, OFFSET(IPSIOPS, busy_off)},
36 /* SI_BUSY_ON */
37 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, busy_on)},
38 /* SI_CLRTOEOL */
39 {"", ipc_unmarshall, OFFSET(IPSIOPS, clrtoeol)},
40 /* SI_DELETELN */
41 {"", ipc_unmarshall, OFFSET(IPSIOPS, deleteln)},
42 /* SI_DISCARD */
43 {"", ipc_unmarshall, OFFSET(IPSIOPS, discard)},
44 /* SI_EDITOPT */
45 {"ab1", ipc_unmarshall_ab1, OFFSET(IPSIOPS, editopt)},
46 /* SI_INSERTLN */
47 {"", ipc_unmarshall, OFFSET(IPSIOPS, insertln)},
48 /* SI_MOVE */
49 {"12", ipc_unmarshall_12, OFFSET(IPSIOPS, move)},
50 /* SI_QUIT */
51 {"", ipc_unmarshall, OFFSET(IPSIOPS, quit)},
52 /* SI_REDRAW */
53 {"", ipc_unmarshall, OFFSET(IPSIOPS, redraw)},
54 /* SI_REFRESH */
55 {"", ipc_unmarshall, OFFSET(IPSIOPS, refresh)},
56 /* SI_RENAME */
57 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, rename)},
58 /* SI_REPLY */
59 {"1a", NULL, 0},
60 /* SI_REWRITE */
61 {"1", ipc_unmarshall_1, OFFSET(IPSIOPS, rewrite)},
62 /* SI_SCROLLBAR */
63 {"123", ipc_unmarshall_123, OFFSET(IPSIOPS, scrollbar)},
64 /* SI_SELECT */
65 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, select)},
66 /* SI_SPLIT */
67 {"", ipc_unmarshall, OFFSET(IPSIOPS, split)},
68 /* SI_WADDSTR */
69 {"a", ipc_unmarshall_a, OFFSET(IPSIOPS, waddstr)},
70 /* SI_EVENT_SUP */
73 static int
74 ipc_unmarshall_a(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
76 return ((IPFunc_a)func)(ipvi, ipb->str1, ipb->len1);
79 static int
80 ipc_unmarshall_12(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
82 return ((IPFunc_12)func)(ipvi, ipb->val1, ipb->val2);
85 static int
86 ipc_unmarshall(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
88 return func(ipvi);
91 static int
92 ipc_unmarshall_ab1(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
94 return ((IPFunc_ab1)func)(ipvi, ipb->str1, ipb->len1, ipb->str2, ipb->len2, ipb->val1);
97 #if 0
98 static int
99 ipc_unmarshall_1a(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
101 return ((IPFunc_1a)func)(ipvi, ipb->val1, ipb->str1, ipb->len1);
103 #endif
105 static int
106 ipc_unmarshall_1(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
108 return ((IPFunc_1)func)(ipvi, ipb->val1);
111 static int
112 ipc_unmarshall_123(IPVIWIN *ipvi, IP_BUF *ipb, IPFunc func)
114 return ((IPFunc_123)func)(ipvi, ipb->val1, ipb->val2, ipb->val3);