diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-07-09 01:07:19 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-07-09 01:07:19 +0200 |
commit | 24e2f5f6da5cb4f5d0b45db138242e0168171708 (patch) | |
tree | ab1f709d87127ca859efbddde5a2f186b466e41d /FICS/variable.c | |
parent | 52fceb1ec65dc3fe23e98cafd1c0460f775800b4 (diff) |
Changed set_interface()
Diffstat (limited to 'FICS/variable.c')
-rw-r--r-- | FICS/variable.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/FICS/variable.c b/FICS/variable.c index f8a4014..532243c 100644 --- a/FICS/variable.c +++ b/FICS/variable.c @@ -33,6 +33,8 @@ #include "stdinclude.h" #include "common.h" +#include <stdbool.h> + #include "board.h" #include "command.h" #include "comproc.h" @@ -404,13 +406,23 @@ set_inc(int p, char *var, char *val) PRIVATE int set_interface(int p, char *var, char *val) { -// int v = -1; + bool truncated = false; + char *cp; + size_t size; - if (!val) + if (val == NULL || strcmp(val, "") == 0) return VAR_BADVAL; -// parray[p].xxx = v; - pprintf(p, "Interface set to %s.\n", val); + cp = &(parray[p].interface[0]); + size = ARRAY_SIZE(parray[p].interface); + + if (strlcpy(cp, val, size) >= size) + truncated = true; + + pprintf(p, "Interface set to %s.\n", cp); + + if (truncated) + pprintf(p, "Interface was truncated!\n"); return VAR_OK; } |