Home | History | Annotate | Download | only in monop

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