1
0

touch up C

This commit is contained in:
dtb 2023-12-03 18:07:40 -07:00
parent 7c95bfcc82
commit 0ddfc90487
3 changed files with 13 additions and 17 deletions

View File

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

View File

@ -1,5 +1,5 @@
#include <stdio.h> #include <stdio.h> /* fprintf(3), fputs(3), getc(3), stdin, stdout */
#include <stdlib.h> #include <stdlib.h> /* getenv(3) */
#include "libinality.h" #include "libinality.h"
char *signoff = ""; char *signoff = "";
@ -7,26 +7,25 @@ char *user = "user";
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
int c; int c;
char exiting;
char *s; char *s;
if((s = getenv("USER")) != NULL) if((s = getenv("USER")) != NULL)
user = s; user = s;
do{ exiting = 0;
fputs(Liminality_prefix, stdout); #define ever (;;)
fputs(user, stdout); for ever{
fputs(Liminality_infix, stdout); fprintf(stdout, "%s%s%s",
Liminality_prefix, user, Liminality_infix);
while((c = getc(stdin)) != '\n') while((c = getc(stdin)) != '\n')
if(c != EOF) if(c != EOF)
putc(c, stdout); putc(c, stdout);
else{ else{
exiting = 1;
fputs(signoff, stdout); fputs(signoff, stdout);
break; goto fin;
} }
fputs(Liminality_suffix, stdout); fputs(Liminality_suffix, stdout);
}while(!exiting); }
return 0; fin: return 0;
} }