Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72eb70edbc | ||
|
|
127af1b85e |
@@ -1,24 +0,0 @@
|
||||
From b9d64d63e995a768c677990ef39ff1857cb466c5 Mon Sep 17 00:00:00 2001
|
||||
From: DeOwl <daniil@shvetsov.business>
|
||||
Date: Wed, 9 Sep 2026 16:27:15 +0300
|
||||
Subject: [PATCH 1/3] Use proper grammar.
|
||||
|
||||
---
|
||||
main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/main.c b/main.c
|
||||
index f6e7abe..80cf29a 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -6,6 +6,6 @@ int main(int argc, char **argv)
|
||||
printf("Enter your name: ");
|
||||
fgets(name, 255, stdin);
|
||||
name[strlen(name)-1] = '\0'; /* remove the newline at the end */
|
||||
- printf("Hello %s!\n", name);
|
||||
+ printf("Hello, %s!\n", name);
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.55.0
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
From 6b91325623e4a8ea04e56b3c8950aea053d37495 Mon Sep 17 00:00:00 2001
|
||||
From: DeOwl <daniil@shvetsov.business>
|
||||
Date: Wed, 9 Sep 2026 16:47:55 +0300
|
||||
Subject: [PATCH 2/3] Move the ask name code into its own function and file
|
||||
|
||||
---
|
||||
askname.c | 10 ++++++++++
|
||||
askname.h | 1 +
|
||||
main.c | 8 ++------
|
||||
3 files changed, 13 insertions(+), 6 deletions(-)
|
||||
create mode 100644 askname.c
|
||||
create mode 100644 askname.h
|
||||
|
||||
diff --git a/askname.c b/askname.c
|
||||
new file mode 100644
|
||||
index 0000000..60b9420
|
||||
--- /dev/null
|
||||
+++ b/askname.c
|
||||
@@ -0,0 +1,10 @@
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+void askname(char *first, char *last)
|
||||
+{
|
||||
+ printf("Enter your first name: ");
|
||||
+ fgets(first, 255, stdin);
|
||||
+ first[strlen(first)-1] = '\0'; /* remove the newline at the end */
|
||||
+ printf("Now enter your last name: ");
|
||||
+ gets(last); /* buffer overflow? what's that? */
|
||||
+}
|
||||
diff --git a/askname.h b/askname.h
|
||||
new file mode 100644
|
||||
index 0000000..99b23f5
|
||||
--- /dev/null
|
||||
+++ b/askname.h
|
||||
@@ -0,0 +1 @@
|
||||
+void askname(char *first, char *last);
|
||||
diff --git a/main.c b/main.c
|
||||
index e3a8745..291e6b3 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -1,13 +1,9 @@
|
||||
#include <stdio.h>
|
||||
-#include <string.h>
|
||||
+#include "askname.h"
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char first[255], last[255];
|
||||
- printf("Enter your first name: ");
|
||||
- fgets(first, 255, stdin);
|
||||
- first[strlen(first)-1] = '\0'; /* remove the newline at the end */
|
||||
- printf("Now enter your last name: ");
|
||||
- gets(last); /* buffer overflow? what's that? */
|
||||
+ askname(first, last);
|
||||
printf("Hello, %s %s!\n", first, last);
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.55.0
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
From 243a82fd97f0496cb75f61adec59ddc5a216c889 Mon Sep 17 00:00:00 2001
|
||||
From: DeOwl <daniil@shvetsov.business>
|
||||
Date: Wed, 9 Sep 2026 17:09:53 +0300
|
||||
Subject: [PATCH 3/3] Fork commit 1
|
||||
|
||||
---
|
||||
main.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/main.c b/main.c
|
||||
index 291e6b3..3a49c31 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -6,4 +6,5 @@ int main(int argc, char **argv)
|
||||
askname(first, last);
|
||||
printf("Hello, %s %s!\n", first, last);
|
||||
return 0;
|
||||
+ // Test Commit # 1
|
||||
}
|
||||
--
|
||||
2.55.0
|
||||
|
||||
@@ -7,7 +7,4 @@ void askname(char *first, char *last)
|
||||
first[strlen(first)-1] = '\0'; /* remove the newline at the end */
|
||||
printf("Now enter your last name: ");
|
||||
gets(last); /* buffer overflow? what's that? */
|
||||
|
||||
|
||||
// Stashed changes 2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user