diff options
Diffstat (limited to 'FICS')
| -rw-r--r-- | FICS/settings.cpp | 14 | ||||
| -rw-r--r-- | FICS/settings.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/FICS/settings.cpp b/FICS/settings.cpp index de25098..ad1cc02 100644 --- a/FICS/settings.cpp +++ b/FICS/settings.cpp @@ -113,6 +113,20 @@ check_some_settings_strictly(void) } bool +is_numeric(const char *string) +{ + if (string == nullptr || *string == '\0') + return false; + + for (const char *cp = &string[0]; *cp != '\0'; cp++) { + if (!isdigit(*cp)) + return false; + } + + return true; +} + +bool is_valid_hostname(const char *p_str, err_reason_t *p_reason) { const char legal_index[] = diff --git a/FICS/settings.h b/FICS/settings.h index 4b1f15e..b5aad98 100644 --- a/FICS/settings.h +++ b/FICS/settings.h @@ -14,6 +14,7 @@ void settings_init(void); void settings_deinit(void); void check_some_settings_strictly(void); +bool is_numeric(const char *); bool is_valid_hostname(const char *, err_reason_t *); bool is_valid_username(const char *, err_reason_t *); const char *settings_get(const char *set_name); |
