File tree Expand file tree Collapse file tree 17 files changed +224
-1
lines changed Expand file tree Collapse file tree 17 files changed +224
-1
lines changed Original file line number Diff line number Diff line change
1
+ * text =auto
Original file line number Diff line number Diff line change
1
+ ![ progress-banner] ( https://codecrafters.io/landing/images/default_progress_banners/shell.png )
2
+
3
+ This is a starting point for C solutions to the
4
+ [ "Build Your Own Shell" Challenge] ( https://app.codecrafters.io/courses/shell/overview ) .
5
+
6
+ _ Add a description of your course here_
7
+
8
+ ** Note** : If you're viewing this repo on GitHub, head over to
9
+ [ codecrafters.io] ( https://codecrafters.io ) to try the challenge.
10
+
11
+ # Passing the first stage
12
+
13
+ The entry point for your ` shell ` implementation is in ` app/main.c ` . Study and
14
+ uncomment the relevant code, and push your changes to pass the first stage:
15
+
16
+ ``` sh
17
+ git add .
18
+ git commit -m " pass 1st stage" # any msg
19
+ git push origin master
20
+ ```
21
+
22
+ Time to move on to the next stage!
23
+
24
+ # Stage 2 & beyond
25
+
26
+ Note: This section is for stages 2 and beyond.
27
+
28
+ 1 . Ensure you have ` c (9.2) ` installed locally
29
+ 1 . Run ` ./your_shell.sh ` to run your program, which is implemented in
30
+ ` app/main.c ` .
31
+ 1 . Commit your changes and run ` git push origin master ` to submit your solution
32
+ to CodeCrafters. Test output will be streamed to your terminal.
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+
3
+ int main () {
4
+ // You can use print statements as follows for debugging, they'll be visible
5
+ // when running tests
6
+ printf ("Logs from your program will appear here!\n" );
7
+
8
+ // Uncomment this block to pass the first stage
9
+ // printf("$ ");
10
+ // fflush(stdout);
11
+
12
+ // Wait for user input
13
+ char input [100 ];
14
+ fgets (input , 100 , stdin );
15
+ return 0 ;
16
+ }
Original file line number Diff line number Diff line change
1
+ # Set this to true if you want debug logs.
2
+ #
3
+ # These can be VERY verbose, so we suggest turning them off
4
+ # unless you really need them.
5
+ debug : false
6
+
7
+ # Use this to change the C version used to run your code
8
+ # on Codecrafters.
9
+ #
10
+ # Available versions: c-9.2
11
+ language_pack : c-9.2
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # DON'T EDIT THIS!
4
+ #
5
+ # CodeCrafters uses this file to test your code. Don't make any changes here!
6
+ #
7
+ # DON'T EDIT THIS!
8
+ set -e
9
+ tmpFile=$( mktemp)
10
+ gcc app/* .c -o $tmpFile
11
+ exec $tmpFile " $@ "
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ languages:
19
19
- slug : " go"
20
20
- slug : " python"
21
21
- slug : " rust"
22
+ - slug : " c"
22
23
23
24
marketing :
24
25
difficulty : medium
Original file line number Diff line number Diff line change
1
+ * text =auto
Original file line number Diff line number Diff line change
1
+ ![ progress-banner] ( https://codecrafters.io/landing/images/default_progress_banners/shell.png )
2
+
3
+ This is a starting point for C solutions to the
4
+ [ "Build Your Own Shell" Challenge] ( https://app.codecrafters.io/courses/shell/overview ) .
5
+
6
+ _ Add a description of your course here_
7
+
8
+ ** Note** : If you're viewing this repo on GitHub, head over to
9
+ [ codecrafters.io] ( https://codecrafters.io ) to try the challenge.
10
+
11
+ # Passing the first stage
12
+
13
+ The entry point for your ` shell ` implementation is in ` app/main.c ` . Study and
14
+ uncomment the relevant code, and push your changes to pass the first stage:
15
+
16
+ ``` sh
17
+ git add .
18
+ git commit -m " pass 1st stage" # any msg
19
+ git push origin master
20
+ ```
21
+
22
+ Time to move on to the next stage!
23
+
24
+ # Stage 2 & beyond
25
+
26
+ Note: This section is for stages 2 and beyond.
27
+
28
+ 1 . Ensure you have ` c (9.2) ` installed locally
29
+ 1 . Run ` ./your_shell.sh ` to run your program, which is implemented in
30
+ ` app/main.c ` .
31
+ 1 . Commit your changes and run ` git push origin master ` to submit your solution
32
+ to CodeCrafters. Test output will be streamed to your terminal.
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+
3
+ int main () {
4
+ printf ("Logs from your program will appear here!\n" );
5
+
6
+ printf ("$ " );
7
+ fflush (stdout );
8
+
9
+ // Wait for user input
10
+ char input [100 ];
11
+ fgets (input , 100 , stdin );
12
+ return 0 ;
13
+ }
Original file line number Diff line number Diff line change
1
+ # Set this to true if you want debug logs.
2
+ #
3
+ # These can be VERY verbose, so we suggest turning them off
4
+ # unless you really need them.
5
+ debug : false
6
+
7
+ # Use this to change the C version used to run your code
8
+ # on Codecrafters.
9
+ #
10
+ # Available versions: c-9.2
11
+ language_pack : c-9.2
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # DON'T EDIT THIS!
4
+ #
5
+ # CodeCrafters uses this file to test your code. Don't make any changes here!
6
+ #
7
+ # DON'T EDIT THIS!
8
+ set -e
9
+ tmpFile=$( mktemp)
10
+ gcc app/* .c -o $tmpFile
11
+ exec $tmpFile " $@ "
Original file line number Diff line number Diff line change
1
+ @@ -1,16 +1,13 @@
2
+ #include <stdio.h>
3
+
4
+ int main() {
5
+ - // You can use print statements as follows for debugging, they'll be visible
6
+ - // when running tests
7
+ printf("Logs from your program will appear here!\n");
8
+
9
+ - // Uncomment this block to pass the first stage
10
+ - // printf("$ ");
11
+ - // fflush(stdout);
12
+ + printf("$ ");
13
+ + fflush(stdout);
14
+
15
+ // Wait for user input
16
+ char input[100];
17
+ fgets(input, 100, stdin);
18
+ return 0;
19
+ }
Original file line number Diff line number Diff line change
1
+ The entry point for your Shell implementation is in ` app/main.c ` .
2
+
3
+ Study and uncomment the relevant code:
4
+
5
+ ``` c
6
+ // Uncomment this block to pass the first stage
7
+ printf ("$ ");
8
+ fflush(stdout);
9
+ ```
10
+
11
+ Push your changes to pass the first stage:
12
+
13
+ ```
14
+ git add .
15
+ git commit -m "pass 1st stage" # any msg
16
+ git push origin master
17
+ ```
Original file line number Diff line number Diff line change 61
61
template_attributes :
62
62
required_executable : " go (1.19)"
63
63
user_editable_file : " cmd/myshell/main.go"
64
+
65
+ - language : c
66
+ file_mappings :
67
+ - source : starter_templates/README.md
68
+ target : README.md
69
+ - source : starter_templates/codecrafters.yml
70
+ target : codecrafters.yml
71
+ - source : starter_templates/c/your_shell.sh
72
+ target : your_shell.sh
73
+ - source : starter_templates/c/app/main.c
74
+ target : app/main.c
75
+ - source : starter_templates/.gitattributes
76
+ target : .gitattributes
77
+ template_attributes :
78
+ required_executable : " c (9.2)"
79
+ user_editable_file : " app/main.c"
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+
3
+ int main () {
4
+ // You can use print statements as follows for debugging, they'll be visible
5
+ // when running tests
6
+ printf ("Logs from your program will appear here!\n" );
7
+
8
+ // Uncomment this block to pass the first stage
9
+ // printf("$ ");
10
+ // fflush(stdout);
11
+
12
+ // Wait for user input
13
+ char input [100 ];
14
+ fgets (input , 100 , stdin );
15
+ return 0 ;
16
+ }
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # DON'T EDIT THIS!
4
+ #
5
+ # CodeCrafters uses this file to test your code. Don't make any changes here!
6
+ #
7
+ # DON'T EDIT THIS!
8
+ set -e
9
+ tmpFile=$( mktemp)
10
+ gcc app/* .c -o $tmpFile
11
+ exec $tmpFile " $@ "
Original file line number Diff line number Diff line change @@ -18,4 +18,8 @@ language_pack: go-1.22
18
18
{{# language_is_rust }}
19
19
# Available versions: rust-1.77
20
20
language_pack : rust-1.77
21
- {{/ language_is_rust }}
21
+ {{/ language_is_rust }}
22
+ {{# language_is_c }}
23
+ # Available versions: c-9.2
24
+ language_pack : c-9.2
25
+ {{/ language_is_c }}
You can’t perform that action at this time.
0 commit comments