#include #include #include #include "etc.h" /* Input d'une chaine avec question et valeur par defaut. */ export void simple_inputs ( const char *question, char *reponse, const char *defaut) /* Si NULL, il faut absoluement une réponse */ /* non vide */ { while (1){ if (defaut == NULL){ printf ("%s : ",question); }else{ printf ("%s [%s] : ",question,defaut); } fgets (reponse,100,stdin); strip_end (reponse); if (reponse[0] == '\0'){ if (defaut != NULL){ strcpy (reponse,defaut); break; } }else{ break; } } } /* Demande autoristation, retourne != 0 si oui. */ export int simple_yesno (const char *msg) { char rep[20]; printf ("%s",msg); fgets(rep,sizeof(rep)-1,stdin); return rep[0] == 'o' || rep[0] == 'O'; }