forked from github/server
ignore lines that contain only whitespace.
This commit is contained in:
parent
573077987c
commit
d35181b5d6
|
@ -95,15 +95,18 @@ static void handle_unit(void *userData, int no) {
|
|||
|
||||
static void handle_order(void *userData, const char *str) {
|
||||
parser_state *state = (parser_state *)userData;
|
||||
const char * tok, *input = str;
|
||||
const char * tok, *input;
|
||||
char buffer[64];
|
||||
const struct locale *lang;
|
||||
param_t p;
|
||||
faction * f = state->f;
|
||||
|
||||
lang = f ? f->locale : default_locale;
|
||||
ltrim(&str);
|
||||
if (*str == 0) return;
|
||||
input = str;
|
||||
tok = parse_token(&input, buffer, sizeof(buffer));
|
||||
p = findparam(tok, lang);
|
||||
if (tok) {
|
||||
param_t p = findparam(tok, lang);
|
||||
if (p == P_FACTION || p == P_GAMENAME) {
|
||||
tok = parse_token(&input, buffer, sizeof(buffer));
|
||||
if (tok) {
|
||||
|
@ -143,6 +146,7 @@ static void handle_order(void *userData, const char *str) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int parseorders(FILE *F)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ static parse_state *states;
|
|||
|
||||
#define TRIMMED(wc) (iswspace(wc) || iswcntrl(wc) || (wc) == 160 || (wc) == 8199 || (wc) == 8239)
|
||||
|
||||
static int ltrim(const char **str_p)
|
||||
int ltrim(const char **str_p)
|
||||
{
|
||||
int ret = 0;
|
||||
wint_t wc;
|
||||
|
|
|
@ -22,6 +22,7 @@ extern "C" {
|
|||
int getint(void);
|
||||
int getid(void);
|
||||
unsigned int atoip(const char *s);
|
||||
int ltrim(const char **str_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue