Commit Diff


commit - f213a54b81c6a87189349499781ed5d658cba967
commit + 607c19eea8612833ca5e3125809f8821be427d49
blob - ff57f534f345efff64dbc86b9881176932e71a85
blob + b587b957a2e87c436b60ffc39d809c7c79805cbf
--- geomant.c
+++ geomant.c
@@ -14,6 +14,8 @@ 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.
@@ -46,6 +48,10 @@ 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
@@ -58,7 +64,6 @@ char *figures[15][4] = {
 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
 }
@@ -158,8 +163,6 @@ 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 ) ;