summaryrefslogtreecommitdiffstats
path: root/read_functions.c
diff options
context:
space:
mode:
authorgonzo <gonzo@toniatuh.com>2023-06-10 00:22:33 +0200
committergonzo <gonzo@toniatuh.com>2023-06-10 00:22:33 +0200
commitb2ab7c3665c0a9eee6e8f208f1974253ce37eec9 (patch)
treec2c62aa5577ddd610e2c61eb265f08cf6622e18d /read_functions.c
parentf643587923125479281e4ba23d9bef01190b1bb3 (diff)
downloadloan_calc-b2ab7c3665c0a9eee6e8f208f1974253ce37eec9.tar.gz
user may now select loan_type
Diffstat (limited to 'read_functions.c')
-rw-r--r--read_functions.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/read_functions.c b/read_functions.c
new file mode 100644
index 0000000..d60b19e
--- /dev/null
+++ b/read_functions.c
@@ -0,0 +1,12 @@
+#include "loans.h"
+
+loan_type read_loan_type(char **contract_subtypes, char *lt) {
+ int i = 0;
+ for (i = 0; lt[i]; i++)
+ if (lt[i] == ' ') lt[i] = '\0';
+
+ for (i = 0; contract_subtypes[i]; i++)
+ if (!strcmp(contract_subtypes[i], lt))
+ return (loan_type)i;
+ return MORTGAGE;
+}