proper way to handle interface errors
This commit is contained in:
parent
f9a7f19564
commit
8ba66a8603
@ -126,6 +126,8 @@ int is_same_word (const char *s, size_t l, const char *word) {
|
||||
return s && word && strlen (word) == l && !memcmp (s, word, l);
|
||||
}
|
||||
|
||||
void fail_interface (struct tgl_state *TLS, struct in_ev *ev, int error_code, const char *format, ...) __attribute__ (( format (printf, 4, 5)));
|
||||
|
||||
static void skip_wspc (void) {
|
||||
while (*line_ptr && ((unsigned char)*line_ptr) <= ' ') {
|
||||
line_ptr ++;
|
||||
@ -1140,9 +1142,7 @@ void do_send_typing (struct command *command, int arg_num, struct arg args[], st
|
||||
enum tgl_typing_status status = tgl_typing_typing; //de
|
||||
if (args[1].num != NOT_FOUND) {
|
||||
if (args[1].num > 0 && args[1].num > 10) {
|
||||
TLS->error_code = ENOSYS;
|
||||
TLS->error = strdup("illegal typing status");
|
||||
print_fail(ev);
|
||||
fail_interface (TLS, ev, ENOSYS, "illegal typing status");
|
||||
return;
|
||||
}
|
||||
status = (enum tgl_typing_status) args[1].num; // if the status parameter is given, and is in range.
|
||||
|
Loading…
x
Reference in New Issue
Block a user