summaryrefslogtreecommitdiff
path: root/7ed.c
diff options
context:
space:
mode:
authorOskar <[email protected]>2023-12-13 22:51:32 +0100
committerOskar <[email protected]>2023-12-13 22:51:32 +0100
commit84b2e02080b5fded466e18694426d7d26db8e194 (patch)
treeebc7387760175f8d8b6615ebeda0ab4f6b4eeb95 /7ed.c
parent754f7875bec4bf60d7bb8c23a588c32de255d038 (diff)
fixed bug where newline was not created because the file did not end with one
Diffstat (limited to '7ed.c')
-rw-r--r--7ed.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/7ed.c b/7ed.c
index a2dd4e1..25f254f 100644
--- a/7ed.c
+++ b/7ed.c
@@ -10,30 +10,29 @@
int main (int argc, char *argv[]) {
-int opt;
-int returnval;
-while ((opt = getopt(argc, argv, "i:")) != -1) {
+ int opt;
+ int returnval;
+ while ((opt = getopt(argc, argv, "i:")) != -1) {
switch (opt) {
-
- case 'i':
+ case 'i':
returnval = startmode(optarg);
if (returnval == 1) {
return EXIT_FAILURE;
}
- break;
+ 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_FAILURE;
}
-return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
} \ No newline at end of file