pipe-game

Un jeu de cartes à piper les une dans les autres - retour accueil

git clone git://bebou.netlib.re/pipe-game
Log | Files | Refs | README |

commit 5cecd4cf8905a5444158476eafa7103ca0bcb638
parent d426fc65d734e86b3e9f97d4158868a4a6a33f0e
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Thu, 23 Jan 2025 14:50:48 +0100

Déclaration de var juste après un case interdite

Ca semble être lié au fait qu'une déclaration de variable n'est pas un
"statement" mis une "declaration" (en anglais) et ne peut suivre un case
qu'un "statement". Mettre le "corps" du case entre {} résoud aussi ce
souci. Clairement là on est sur du niveau qui nécessite de lire un
bouquin sur le C.

Diffstat:
Minterface.c | 22+++++++++++-----------
Mtermbox2.h | 4++--
2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/interface.c b/interface.c @@ -298,17 +298,17 @@ int main(int argc, char **argv) { quit=true; break; case 109: - bool created=false; - char *token=strtok(res,"\n"); - while(token != NULL) { - if(addcardtopile(token,&args,piles)>0) created=true; - token=strtok(NULL,"\n"); - } - if(created) { - for(int i=0;i<=played.cardCount;i++) - removecardofpile(i,&played,piles); - curmenu=&hand; - } + ;bool created=false; + char *token=strtok(res,"\n"); + while(token != NULL) { + if(addcardtopile(token,&args,piles)>0) created=true; + token=strtok(NULL,"\n"); + } + if(created) { + for(int i=0;i<=played.cardCount;i++) + removecardofpile(i,&played,piles); + curmenu=&hand; + } break; default: break; diff --git a/termbox2.h b/termbox2.h @@ -2297,7 +2297,7 @@ static int init_resize_handler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = handle_resize; - if (sigaction(SIGWINCH, &sa, NULL) != 0) { + if (sigaction(SIGINT, &sa, NULL) != 0) { global.last_errno = errno; return TB_ERR_RESIZE_SIGACTION; } @@ -2430,7 +2430,7 @@ static int tb_deinit(void) { } } - sigaction(SIGWINCH, &(struct sigaction){.sa_handler = SIG_DFL}, NULL); + sigaction(SIGINT, &(struct sigaction){.sa_handler = SIG_DFL}, NULL); if (global.resize_pipefd[0] >= 0) close(global.resize_pipefd[0]); if (global.resize_pipefd[1] >= 0) close(global.resize_pipefd[1]);