1
0

tentative implementation of liminality

This commit is contained in:
dtb 2023-06-27 08:58:25 -04:00
parent 787437106d
commit 4e14224a95
4 changed files with 47 additions and 0 deletions

2
liminality/Makefile Normal file
View File

@ -0,0 +1,2 @@
liminality: libinality.h liminality.c
$(CC) -g -o liminality liminality.c

6
liminality/libinality.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef _LIMINALITY_H
# define _LIMINALITY_H
static char *Liminality_prefix = "FROM ";
static char *Liminality_infix = "\nBODY ";
static char *Liminality_suffix = "\n";
#endif /* ifndef _LIMINALITY_H */

7
liminality/liminal Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
test -z "$2" || test -n "$3" \
&& printf "Usage: %s [server] [port]\n" "$0" >&2 \
&& exit 64 # sysexits(3) EX_USAGE
liminality | nc "$1" "$2"

32
liminality/liminality.c Normal file
View File

@ -0,0 +1,32 @@
#include <stdio.h>
#include <stdlib.h>
#include "libinality.h"
char *signoff = "";
char *user = "user";
int main(int argc, char *argv[]){
int c;
char exiting;
char *s;
if((s = getenv("USER")) != NULL)
user = s;
do{
fputs(Liminality_prefix, stdout);
fputs(user, stdout);
fputs(Liminality_infix, stdout);
while((c = getc(stdin)) != '\n')
if(c != EOF)
putc(c, stdout);
else{
exiting = 1;
fputs(signoff, stdout);
break;
}
fputs(Liminality_suffix, stdout);
}while(!exiting);
return 0;
}