summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'session.c')
-rw-r--r--session.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/session.c b/session.c
index e3b8702..2991469 100644
--- a/session.c
+++ b/session.c
@@ -1,32 +1,34 @@
+#include "utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "utils.h"
-void startSession(FILE *dictionary)
+void
+startSession (FILE *dictionary)
{
- if ( dictionary != NULL )
+ if (dictionary != NULL)
{
- int totalWords = lineCounter(dictionary);
- char *word, *question = (char *) calloc(MAX_LINE, sizeof(char));;
+ int totalWords = lineCounter (dictionary);
+ char *word, *question = (char *)calloc (MAX_LINE, sizeof (char));
char reload = '\0';
- printf("WELCOME\n"
+ printf ("WELCOME\n"
"Type GOODBYE to exit\n\n");
- while( strcmp(question, "GOODBYE\n") != 0 )
+ while (strcmp (question, "GOODBYE\n") != 0)
{
- printf("Enter a question: ");
- fgets(question, MAX_LINE, stdin);
+ printf ("Enter a question: ");
+ fgets (question, MAX_LINE, stdin);
- if ( strcmp(question, "GOODBYE\n") != 0 )
+ if (strcmp (question, "GOODBYE\n") != 0)
{
- word = getLine(dictionary, getRandomNumber(1, totalWords, question));
- printf("-> %s", word);
- free(word);
+ word = getLine (dictionary,
+ getRandomNumber (1, totalWords, question));
+ printf ("-> %s", word);
+ free (word);
}
}
- free(question);
+ free (question);
}
}