From: H.G. Muller Date: Mon, 3 Sep 2012 10:21:42 +0000 (+0200) Subject: Check for validity of category/board when placing seek ad X-Git-Url: http://winboard.nl/cgi-bin?p=capablanca.git;a=commitdiff_plain;h=7d037802a9d8567fd720a8b14b2345e5a3dbe947 Check for validity of category/board when placing seek ad Code was copied for this from the match command --- diff --git a/lasker-2.2.3/src/seekproc.c b/lasker-2.2.3/src/seekproc.c index 399dfbe..43ffe66 100644 --- a/lasker-2.2.3/src/seekproc.c +++ b/lasker-2.2.3/src/seekproc.c @@ -78,6 +78,22 @@ int com_seek(int p, param_list param) return COM_OK; /* couldn't parse */ } + if (category[0]) { + if (!board[0] && strcmp(category,"bughouse")) { + pprintf(p, "You must specify a board and a category.\n"); + return COM_OK; + + } else if (board[0]) { /* not bughouse */ + char fname[MAX_FILENAME_SIZE]; + + sprintf(fname, "%s/%s/%s", BOARD_DIR, category, board); + if (!file_exists(fname)) { + pprintf(p, "No such category/board: %s/%s\n", category, board); + return COM_OK; + } + } + } + seek_globals.ads[num].status = SEEKCLOSED; // params are valid; create ad if(wt < 0) wt = pp->d_time; if(bt < 0) bt = wt;