diff options
author | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-09-15 02:46:47 -0500 |
---|---|---|
committer | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-09-15 02:48:47 -0500 |
commit | 7f82cd9b726f69f01c243833058e438c4e22b84f (patch) | |
tree | d486bd12def255048b27fa1d357036059451ee52 /tailf.c | |
parent | 9b8d802ca89027de46ee45fbc9adf978a16e7927 (diff) | |
download | segfault-7f82cd9b726f69f01c243833058e438c4e22b84f.tar.gz segfault-7f82cd9b726f69f01c243833058e438c4e22b84f.zip |
did the TODO of making builtins use a hashtable.
added two commands for dealing with them.
if you want you can override builtins for security reasons? :)
added a small program for doing tail -f for systems that may not have tail -f
Diffstat (limited to 'tailf.c')
-rw-r--r-- | tailf.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -0,0 +1,27 @@ +#include <stdio.h> + +int main(int argc,char *argv[]) { + short in; + FILE *fp; + if(argc>1) { + if(!(fp=fopen(argv[1],"r"))) { + printf("file not found.\n"); + return 1; + } + while(1) { + if((in=fgetc(fp)) == -1) { + if(feof(fp)) { + clearerr(fp); + } else { + printf("unknown error from fgetc()"); + return 2; + } + } else { + printf("%c",in); + fflush(stdout); + } + } + } else { + printf("usage: tailf filename\n"); + } +} |