diff options
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/speed.c | 21 | ||||
-rw-r--r-- | src/bin/strstr.c | 7 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/bin/speed.c b/src/bin/speed.c new file mode 100644 index 0000000..3b8cc72 --- /dev/null +++ b/src/bin/speed.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <signal.h> + +int count; + +void printandreset(int sig) { + alarm(1); + printf("persecond: %d\n",count); + count=0; +} + +int main(int argc,char *argv[]) { + char in[256]; + count=0; + signal(SIGALRM,printandreset); + alarm(1); + while(fgets(in,256,stdin)) { + count++; + } + return 0; +} diff --git a/src/bin/strstr.c b/src/bin/strstr.c new file mode 100644 index 0000000..9b244ec --- /dev/null +++ b/src/bin/strstr.c @@ -0,0 +1,7 @@ +#include <stdio.h> +#include <string.h> + +int main(int argc,char *argv[]) { + if(argc < 3) return printf("usage: strstr big little\n"),2; + else return !strstr(argv[1],argv[2]); +} |