Skip to content

Commit 67aee12

Browse files
committed
Fix merge conflict
2 parents 0fe14dd + 9a77e45 commit 67aee12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+565
-1
lines changed

compiled_starters/c/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

compiled_starters/c/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
In this challenge, you'll build your own POSIX compliant shell that's capable of
7+
interpreting shell commands, running external programs and builtin commands like
8+
cd, pwd, echo and more. Along the way, you'll learn about shell command parsing,
9+
REPLs, builtin commands, and more.
10+
11+
**Note**: If you're viewing this repo on GitHub, head over to
12+
[codecrafters.io](https://codecrafters.io) to try the challenge.
13+
14+
# Passing the first stage
15+
16+
The entry point for your `shell` implementation is in `app/main.c`. Study and
17+
uncomment the relevant code, and push your changes to pass the first stage:
18+
19+
```sh
20+
git add .
21+
git commit -m "pass 1st stage" # any msg
22+
git push origin master
23+
```
24+
25+
Time to move on to the next stage!
26+
27+
# Stage 2 & beyond
28+
29+
Note: This section is for stages 2 and beyond.
30+
31+
1. Ensure you have `c (9.2)` installed locally
32+
1. Run `./your_shell.sh` to run your program, which is implemented in
33+
`app/main.c`.
34+
1. Commit your changes and run `git push origin master` to submit your solution
35+
to CodeCrafters. Test output will be streamed to your terminal.

compiled_starters/c/app/main.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
// You can use print statements as follows for debugging, they'll be visible when running tests
5+
printf("Logs from your program will appear here!\n");
6+
7+
// Uncomment this block to pass the first stage
8+
// printf("$ ");
9+
// fflush(stdout);
10+
11+
// Wait for user input
12+
char input[100];
13+
fgets(input, 100, stdin);
14+
return 0;
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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

compiled_starters/c/your_shell.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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 "$@"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
![progress-banner](https://codecrafters.io/landing/images/default_progress_banners/shell.png)
2+
3+
This is a starting point for JavaScript solutions to the
4+
["Build Your Own Shell" Challenge](https://app.codecrafters.io/courses/shell/overview).
5+
6+
In this challenge, you'll build your own POSIX compliant shell that's capable of
7+
interpreting shell commands, running external programs and builtin commands like
8+
cd, pwd, echo and more. Along the way, you'll learn about shell command parsing,
9+
REPLs, builtin commands, and more.
10+
11+
**Note**: If you're viewing this repo on GitHub, head over to
12+
[codecrafters.io](https://codecrafters.io) to try the challenge.
13+
14+
# Passing the first stage
15+
16+
The entry point for your `shell` implementation is in `app/main.js`. Study and
17+
uncomment the relevant code, and push your changes to pass the first stage:
18+
19+
```sh
20+
git add .
21+
git commit -m "pass 1st stage" # any msg
22+
git push origin master
23+
```
24+
25+
Time to move on to the next stage!
26+
27+
# Stage 2 & beyond
28+
29+
Note: This section is for stages 2 and beyond.
30+
31+
1. Ensure you have `node (21)` installed locally
32+
1. Run `./your_shell.sh` to run your program, which is implemented in
33+
`app/main.js`.
34+
1. Commit your changes and run `git push origin master` to submit your solution
35+
to CodeCrafters. Test output will be streamed to your terminal.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Uncomment this block to pass the first stage
2+
// const readline = require("readline");
3+
4+
// You can use print statements as follows for debugging, they'll be visible when running tests.
5+
console.log("Logs from your program will appear here!");
6+
7+
// Uncomment this block to pass the first stage
8+
// const rl = readline.createInterface({
9+
// input: process.stdin,
10+
// output: process.stdout,
11+
// });
12+
//
13+
// rl.question("$ ", (answer) => {
14+
// rl.close();
15+
// });
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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 JavaScript version used to run your code
8+
# on Codecrafters.
9+
#
10+
# Available versions: nodejs-21
11+
language_pack: nodejs-21

0 commit comments

Comments
 (0)