summaryrefslogtreecommitdiff
path: root/test/testgrounds/testgetline.c
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-02-18 18:42:40 +0100
committerOskar <[email protected]>2024-02-18 18:42:40 +0100
commitfc966f297cc163254220c930a565484abde207d9 (patch)
tree554a1b9c13ed7aaadf4cfe32525d110ee9ab78c6 /test/testgrounds/testgetline.c
parent02baef3cfdfec7705b44c1a56c8e1a291df92f39 (diff)
Organised test directory and did some logic fixes to smode
Diffstat (limited to 'test/testgrounds/testgetline.c')
-rw-r--r--test/testgrounds/testgetline.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/testgrounds/testgetline.c b/test/testgrounds/testgetline.c
new file mode 100644
index 0000000..d186439
--- /dev/null
+++ b/test/testgrounds/testgetline.c
@@ -0,0 +1,44 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include "7ed.h"
+
+#define USAGE ""
+#define PROGRAM_NAME "7ed"
+
+int main (int argc, char *argv[]) {
+
+
+int opt;
+int returnval;
+long focus = 100;
+char *line;
+while ((opt = getopt(argc, argv, "i:")) != -1) {
+ switch (opt) {
+
+ case 'i':
+
+ returnval = GET_LINE(optarg, focus, &line);
+ if (returnval == 1) {
+ return EXIT_FAILURE;
+ }
+ printf("%s", line);
+ free(line);
+
+ break;
+
+ default:
+ fprintf(stderr, "%s", USAGE);
+ return EXIT_FAILURE;
+ }
+}
+
+ if (argc == 1) {
+ fprintf(stderr, "%s: Please provide a file.\n%s", argv[0], USAGE);
+ return EXIT_FAILURE;
+ }
+
+return EXIT_SUCCESS;
+// TEST!
+// LINE 44 YOOOOOOOOOOOOOOO!!