commit 380a2627be447021153994109f580f84614af59a
parent 6c39ca53c836105518ffc5c7c953b9079bce5777
Author: Charlie Stanton <charlie@shtanton.xyz>
Date: Fri, 14 Oct 2022 19:08:44 +0100
Anonymise myself
Diffstat:
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/posts/all_the_protocols.gmi b/posts/all_the_protocols.gmi
@@ -8,4 +8,4 @@ I once set myself a goal of submitting code to something I actually use and gett
Hopefully this rant doesn't make me a hypocrite as someone who's never been to an IETF meeting, but I'll fix that soon enough, and I'd encourage you to do the same.
-Feel free to email charlie@shtanton.xyz with any thoughts. Writing super long and well researched posts is hard so I'm gonna try these short ones with the occasional longer one.
+Feel free to email shtanton@shtanton.xyz with any thoughts. Writing super long and well researched posts is hard so I'm gonna try these short ones with the occasional longer one.
diff --git a/posts/ex.gmi b/posts/ex.gmi
@@ -101,4 +101,4 @@ Most of them just because this whole idea is crazy outlandish. The one that coul
### Conclusion
-This is mostly just me playing with ideas. I don't know how this would actually look and feel in a real editor, but I plan on finding out. Maybe there'll be a another post one day with details of a working usable editor, based on ex that I'll have written. Maybe someone else will see these ideas and agree with one or two of them and build something new and impressive. Maybe all my ideas suck and I'm completely dillusional. Either way I'd appreciate you letting me know any thoughts this has provoked via my email, charlie@shtanton.xyz
+This is mostly just me playing with ideas. I don't know how this would actually look and feel in a real editor, but I plan on finding out. Maybe there'll be a another post one day with details of a working usable editor, based on ex that I'll have written. Maybe someone else will see these ideas and agree with one or two of them and build something new and impressive. Maybe all my ideas suck and I'm completely dillusional. Either way I'd appreciate you letting me know any thoughts this has provoked via my email, shtanton@shtanton.xyz
diff --git a/posts/gripes_with_pipes.gmi b/posts/gripes_with_pipes.gmi
@@ -2,7 +2,7 @@ A key feature of the POSIX shell is the pipe, allowing the output of one process
This post will involve a fair amount of POSIX shell scripting and C programming, but I've explained all of it as best I can so if you have at least a surface level understanding of these things then you should be fine.
-### Charlie's 4 gripes with pipes
+### shtanton's 4 gripes with pipes
* Pipes can only pass string data delimited by newlines
* Each process only has 1 input and 2 output streams (stdin, stdout and stderr)
* Pipes can't do cyclical data passing
@@ -12,18 +12,18 @@ This post will involve a fair amount of POSIX shell scripting and C programming,
Every stdio-based unix utility I've ever used both takes as input and gives as output a series of lines. I think this is because if nothing is being piped into or out of a process, then it uses the tty, which takes lines of input from the user and displays lines of output. In reality, since stdin and stdout are both byte streams, any data that can be represented as bytes (so any data at all) can be passed through a pipe. Note that 0 and 1 in the calls to read and write are file descriptors referring to stdin and stdout respectively. A file descriptor is just a number that refers to a file in POSIX.
-main.c: Define a person "charlie" and write the data to stdout (file descriptor 1)
+main.c: Define a person "john" and write the data to stdout (file descriptor 1)
```
#include <unistd.h>
#include <string.h>
#include "types.h"
int main() {
- struct Person charlie;
- strcpy(charlie.first_name, "Charlie");
- strcpy(charlie.last_name, "Stanton");
- charlie.age = 21;
- write(1, &charlie, sizeof(struct Person));
+ struct Person john;
+ strcpy(john.first_name, "John");
+ strcpy(john.last_name, "Smith");
+ john.age = 21;
+ write(1, &john, sizeof(struct Person));
return 0;
}
```
@@ -54,10 +54,10 @@ struct Person {
Then in my shell I can compile these and run:
```
$ ./main | ./receiver
-Charlie Stanton 21
+John Smith 21
```
-This is an example of a C struct containing 2 strings and a byte integer being passed between processes using a pipe, and there's no reason we couldn't go further. There are already utilities that communicate with JSON over stdio, but we could send video/audio streams, cap'n proto data or anything else we want. These probably exist so email me (charlie@shtanton.xyz) if you know of any :)
+This is an example of a C struct containing 2 strings and a byte integer being passed between processes using a pipe, and there's no reason we couldn't go further. There are already utilities that communicate with JSON over stdio, but we could send video/audio streams, cap'n proto data or anything else we want. These probably exist so email me (shtanton@shtanton.xyz) if you know of any :)
## Gripe 2: Each process can only have 1 input stream and 2 output streams
@@ -78,8 +78,8 @@ main.c: We have two people, their first names get written to stdout, while their
int main() {
struct Person people[2];
- strcpy(people[0].first_name, "Charlie");
- strcpy(people[0].last_name, "Stanton");
+ strcpy(people[0].first_name, "Joe");
+ strcpy(people[0].last_name, "Bloggs");
people[0].age = 21;
strcpy(people[1].first_name, "John");
@@ -99,20 +99,20 @@ int main() {
```
$ ./main > first_names 3> last_names
$ tee < first_names
-Charlie
+Joe
John
$ tee < last_names
-Stanton
+Bloggs
Smith
```
We can also use the extra file descriptors as inputs with 3< and the like. This lets us input/output to several files, and one of them we could pipe into a further command with the help of redirections (that 3>&1 monstrosity is a redirection, which I won't explain here):
```
$ ./main 3>&1 > first_names | sort
+Bloggs
Smith
-Stanton
$ tee < first_names
-Charlie
+Joe
John
```
but how can both outputs become inputs for other commands?
@@ -163,4 +163,4 @@ Byte streams aren't always the most natural or the fastest solution to a problem
Make fifos less verbose and I would consider the shell perfect for data passing!
-Feel free to email charlie@shtanton.xyz with any feedback or if you just want to start an email conversation with someone very opinionated about programming and operating systems.
+Feel free to email shtanton@shtanton.xyz with any feedback or if you just want to start an email conversation with someone very opinionated about programming and operating systems.