]> Trent Huber's Code - thus.git/commitdiff
Updated README.md
authorTrent Huber <trentmhuber@gmail.com>
Mon, 23 Jun 2025 14:15:12 +0000 (10:15 -0400)
committerTrent Huber <trentmhuber@gmail.com>
Mon, 23 Jun 2025 14:15:12 +0000 (10:15 -0400)
.gitignore
README.md
bin/.gitignore [new file with mode: 0644]
src/.gitignore [new file with mode: 0644]
src/job.c
src/job.h
src/term.c

index 3ac8fc1ada1fa0588407a11c139ff85ec8fc363c..378eac25d311703f3f2cd456d8036da525cd0366 100644 (file)
@@ -1,3 +1 @@
-*.o
-ash
 build
index f0fae1a8ec7b97faa7d167814976f08c0c23b77b..c36531cd2dd14c04634c5ddd838f47aacedc23c9 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,42 @@
 # Ash
 
+While Unix shells are a solved problem in computer science, recent iterations have admittedly been more and more complicated by feature sets that attempt to cater to all users. Ash seeks to be a completely stripped down, simplified approach to shells, only including the essential parts, i.e., just the things *I personally use*. In fact, the main goals for this project in order or priority have been:
+
+1. To learn more about the interaction between shells, terminals, and the operating system.
+2. To create a utility I would personally want to use.
+3. To create a utility other people would want to use.
+
+## Feature Set
+
+- Foreground and background process groups (`fg`, `bg`, `&`)
+- Unix pipes
+- Conditional execution (`&&`, `||`)
+- Shell history (cached in `~/.ashhistory`)
+
+### Future features
+
+- File redirection
+- Environment variables
+- Scripting
+- File globbing
+
+## Building
+
+Similar to my other projects, ash uses [cbs](https://github.com/trenthuber/cbs) as its build system, included as a git submodule, so make sure to clone recursively.
+
+```console
+$ git clone --recursive https://github.com/trenthuber/ash
+$ cd ash
+$ cc -o build build.c
+$ ./build
+$ ./bin/ash
+```
+
+Note, you only need to run the `cc` command the first time you build the project, as the `./build` executable will recompile itself everytime it is run.
+
 ## Resources
 
+These websites have been invaluable in the making of ash.
+
 - [TTY Demystified](http://www.linusakesson.net/programming/tty/)
 - [Process Groups and Terminal Signaling](https://cs162.org/static/readings/ic221_s16_lec17.html)
diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644 (file)
index 0000000..229a8d2
--- /dev/null
@@ -0,0 +1 @@
+ash
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644 (file)
index 0000000..5761abc
--- /dev/null
@@ -0,0 +1 @@
+*.o
index 4125d2d3f1d83fcb590736b4a70e4d4d4caf6838..a5f366e6f3535bee2497ad88dfe5fd9266f7a846 100644 (file)
--- a/src/job.c
+++ b/src/job.c
 static struct job jobarray[MAXJOBS + 1];
 struct stack INITSTACK(jobs, jobarray, 0);
 
-void sigkill(pid_t jobid) {
-   if (killpg(jobid, SIGKILL) == -1)
-       warn("Unable to kill process group %d; manual termination may be required",
-            jobid);
-}
-
 void *findjob(pid_t jobid) {
    if (jobs.b == jobs.t) return NULL;
    for (jobs.c = jobs.b; CURRENT->id != jobid; INC(jobs, c))
index 4034cfc2321c43accb35a4cc17881653488df47d..73b2ed107eb7e6193dbb42d6f862f84cb75c55d2 100644 (file)
--- a/src/job.h
+++ b/src/job.h
@@ -12,7 +12,6 @@ struct job {
 #define CURRENT ((struct job *)jobs.c)
 extern struct stack jobs;
 
-void sigkill(pid_t jobid);
 void *findjob(pid_t jobid);
 void *deletejob(void);
 void waitbg(int sig);
index 52ec18436bc89da22368ec2cd2bddcfe1c4e87dd..c703d344c5d877b37b3996e67757e70c98740412 100644 (file)
@@ -57,6 +57,12 @@ quit:
    exit(EXIT_FAILURE);
 }
 
+static void sigkill(pid_t jobid) {
+   if (killpg(jobid, SIGKILL) == -1)
+       warn("Unable to kill process group %d; manual termination may be required",
+            jobid);
+}
+
 int setfg(struct job job) {
    if (tcsetattr(STDIN_FILENO, TCSANOW, &job.config) == -1)
        warn("Unable to set termios structure");