Bug 1013: Don't assume errno is between 0 and 100000
[elinks.git] / src / protocol / test / stub.c
blobdcf7125dca2759cc5f40824ddd3fd863368c9adb
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
5 #include <stdarg.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
10 #include "elinks.h"
12 #include "bfu/msgbox.h"
13 #include "main/module.h"
14 #include "protocol/user.h"
15 #include "session/session.h"
16 #include "util/test.h"
18 #define STUB_MODULE(name) \
19 struct module name = struct_module( \
20 /* name: */ "Stub " #name, \
21 /* options: */ NULL, \
22 /* hooks: */ NULL, \
23 /* submodules: */ NULL, \
24 /* data: */ NULL, \
25 /* init: */ NULL, \
26 /* done: */ NULL \
28 STUB_MODULE(auth_module);
29 STUB_MODULE(bittorrent_protocol_module);
30 STUB_MODULE(cgi_protocol_module);
31 STUB_MODULE(file_protocol_module);
32 STUB_MODULE(finger_protocol_module);
33 STUB_MODULE(fsp_protocol_module);
34 STUB_MODULE(ftp_protocol_module);
35 STUB_MODULE(gopher_protocol_module);
36 STUB_MODULE(http_protocol_module);
37 STUB_MODULE(nntp_protocol_module);
38 STUB_MODULE(smb_protocol_module);
39 STUB_MODULE(uri_rewrite_module);
40 STUB_MODULE(user_protocol_module);
42 static void
43 stub_called(const unsigned char *fun)
45 die("FAIL: stub %s\n", fun);
48 #define STUB_PROTOCOL_HANDLER(name) \
49 void \
50 name(struct connection *conn) \
51 { \
52 stub_called(#name); \
53 } \
54 protocol_handler_T name /* consume semicolon */
55 #define STUB_PROTOCOL_EXTERNAL_HANDLER(name) \
56 void \
57 name(struct session *ses, struct uri *uri) \
58 { \
59 stub_called(#name); \
60 } \
61 protocol_external_handler_T name /* consume semicolon */
62 STUB_PROTOCOL_HANDLER(about_protocol_handler);
63 STUB_PROTOCOL_HANDLER(bittorrent_protocol_handler);
64 STUB_PROTOCOL_HANDLER(data_protocol_handler);
65 STUB_PROTOCOL_EXTERNAL_HANDLER(ecmascript_protocol_handler);
66 STUB_PROTOCOL_HANDLER(file_protocol_handler);
67 STUB_PROTOCOL_HANDLER(finger_protocol_handler);
68 STUB_PROTOCOL_HANDLER(fsp_protocol_handler);
69 STUB_PROTOCOL_HANDLER(ftp_protocol_handler);
70 STUB_PROTOCOL_HANDLER(gopher_protocol_handler);
71 STUB_PROTOCOL_HANDLER(http_protocol_handler);
72 STUB_PROTOCOL_HANDLER(news_protocol_handler);
73 STUB_PROTOCOL_HANDLER(nntp_protocol_handler);
74 STUB_PROTOCOL_HANDLER(proxy_protocol_handler);
75 STUB_PROTOCOL_HANDLER(smb_protocol_handler);
76 STUB_PROTOCOL_EXTERNAL_HANDLER(user_protocol_handler);
78 /* declared in "protocol/user.h" */
79 unsigned char *
80 get_user_program(struct terminal *term, unsigned char *progid, int progidlen)
82 stub_called("get_user_program");
83 return NULL;
86 /* declared in "session/session.h" */
87 void
88 print_error_dialog(struct session *ses, struct connection_state state,
89 struct uri *uri, enum connection_priority priority)
91 stub_called("print_error_dialog");
94 /* declared in "bfu/msgbox.h" */
95 unsigned char *
96 msg_text(struct terminal *term, unsigned char *format, ...)
98 stub_called("msg_text");
99 return NULL;
102 /* declared in "bfu/msgbox.h" */
103 struct dialog_data *
104 msg_box(struct terminal *term, struct memory_list *mem_list,
105 enum msgbox_flags flags, unsigned char *title, enum format_align align,
106 unsigned char *text, void *udata, int buttons, ...)
108 /* mem_list should be freed here but because this is just a
109 * test program it won't matter. */
110 stub_called("msg_box");
111 return NULL;