commit f213a54b81c6a87189349499781ed5d658cba967 from: Sylvain Saboua date: Mon Apr 28 12:53:55 2025 UTC less global variable declaration commit - a69969bb41e2c502e4be5f49030826be53ead621 commit + f213a54b81c6a87189349499781ed5d658cba967 blob - b587b957a2e87c436b60ffc39d809c7c79805cbf blob + ff57f534f345efff64dbc86b9881176932e71a85 --- geomant.c +++ geomant.c @@ -14,8 +14,6 @@ int mantize ( int n_bodypart, int n_figure ) ; int generate() ; int main() ; -char *txt_topic ; size_t txt_topic_size = 0UL ; - // arrays displaying which figure part the user is generating. // used between the mantize() function that gathers/parses user input, // and generate() that generates the figures from it. @@ -48,10 +46,6 @@ char *figures[15][4] = { {" ", " ", " ", " "} } ; -// used to temporarily store user input, which may be anything other than \0 and \n -char *txt_raw_scrap = NULL ; -size_t txt_raw_scrap_size = 0UL ; - /* * "mantize" : input fuction * This function gathers a string of user input @@ -64,6 +58,7 @@ size_t txt_raw_scrap_size = 0UL ; int mantize ( int n_bodypart, int n_figure ) { printf ( "Hold or repeatedly press a key or keys to generate the %s of the %s mother, then press Enter:\n", body_parts[n_bodypart], mother_figures[n_figure] ) ; + char *txt_raw_scrap = NULL ; size_t txt_raw_scrap_size = 0UL ; getline ( &txt_raw_scrap, &txt_raw_scrap_size, stdin ) ; return ( ( strlen ( txt_raw_scrap ) -1 ) % 2 ) ; // substracting 1 as the \n character } @@ -163,6 +158,8 @@ int generate(){ int main(){ + char *txt_topic ; size_t txt_topic_size = 0UL ; + printf("What is the subject title of your enquiry ?\n"); getline ( &txt_topic, &txt_topic_size, stdin ) ;