Lines Matching refs:txt

68 static int restore_parseline(char *txt);
69 static int restore_toplevel_attr(const char *attribute, char *txt);
70 static int restore_player_attr(const char *attribute, char *txt);
71 static int restore_deck_attr(const char *attribute, char *txt);
72 static int restore_square_attr(const char *attribute, char *txt);
73 static int getnum(const char *what, char *txt, int min, int max, int *ret);
74 static int getnum_withbrace(const char *what, char *txt, int min, int max,
459 restore_parseline(char *txt) in restore_parseline() argument
466 if (!strncmp(txt, "NetBSD monop format v", 21)) { in restore_parseline()
467 return getnum("format version", txt+21, in restore_parseline()
477 if (!strcmp(txt, "}")) { in restore_parseline()
488 s = txt; in restore_parseline()
502 txt = s; in restore_parseline()
507 return restore_toplevel_attr(attribute, txt); in restore_parseline()
511 return restore_player_attr(attribute, txt); in restore_parseline()
515 return restore_deck_attr(attribute, txt); in restore_parseline()
519 return restore_square_attr(attribute, txt); in restore_parseline()
527 restore_toplevel_attr(const char *attribute, char *txt) in restore_toplevel_attr() argument
532 if (getnum("numplayers", txt, 2, MAX_PL, &num_play) < 0) { in restore_toplevel_attr()
544 if (getnum("currentplayer", txt, 0, num_play-1, &player) < 0) { in restore_toplevel_attr()
553 if (getnum("doubles", txt, 0, 2, &num_doub) < 0) { in restore_toplevel_attr()
557 if (getnum_withbrace("player", txt, 0, num_play-1, in restore_toplevel_attr()
563 if (getnum_withbrace("deck", txt, 0, 1, in restore_toplevel_attr()
569 if (getnum_withbrace("square", txt, 0, N_SQRS-1, in restore_toplevel_attr()
582 restore_player_attr(const char *attribute, char *txt) in restore_player_attr() argument
599 if (strlen(txt) > 256) { in restore_player_attr()
600 txt[256] = 0; in restore_player_attr()
602 pp->name = strdup(txt); in restore_player_attr()
607 if (getnum(attribute, txt, 0, INT_MAX, &pp->money) < 0) { in restore_player_attr()
612 if (getnum(attribute, txt, 0, N_SQRS, &tmp) < 0) { in restore_player_attr()
617 if (getnum(attribute, txt, 0, 2, &tmp) < 0) { in restore_player_attr()
622 if (getnum(attribute, txt, 0, 3, &tmp) < 0) { in restore_player_attr()
638 restore_deck_attr(const char *attribute, char *txt) in restore_deck_attr() argument
647 if (getnum(attribute, txt, dp->num_cards, dp->num_cards, in restore_deck_attr()
652 if (getnum(attribute, txt, 0, dp->num_cards, in restore_deck_attr()
657 if (getnum(attribute, txt, 0, 1, &tmp) < 0) { in restore_deck_attr()
663 s = txt; in restore_deck_attr()
684 restore_square_attr(const char *attribute, char *txt) in restore_square_attr() argument
690 if (getnum(attribute, txt, -1, num_play-1, &tmp) < 0) { in restore_square_attr()
701 if (getnum(attribute, txt, 0, 1, &tmp) < 0) { in restore_square_attr()
710 if (getnum(attribute, txt, 0, 5, &tmp) < 0) { in restore_square_attr()
722 getnum(const char *what, char *txt, int min, int max, int *ret) in getnum() argument
728 l = strtol(txt, &s, 10); in getnum()
741 getnum_withbrace(const char *what, char *txt, int min, int max, int *ret) in getnum_withbrace() argument
744 s = strchr(txt, ' '); in getnum_withbrace()
760 return getnum(what, txt, min, max, ret); in getnum_withbrace()