diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/.DS_Store | bin | 0 -> 6148 bytes | |||
| -rw-r--r-- | src/cmd/.DS_Store | bin | 0 -> 6148 bytes | |||
| -rw-r--r-- | src/cmd/coin/coin.c | 15 | ||||
| -rw-r--r-- | src/cmd/coin/makefile | 10 | ||||
| -rw-r--r-- | src/cmd/dice/dice.c | 15 | ||||
| -rw-r--r-- | src/cmd/dice/makefile | 10 | ||||
| -rw-r--r-- | src/cmd/echo/echo.c | 17 | ||||
| -rw-r--r-- | src/cmd/echo/makefile | 10 | ||||
| -rw-r--r-- | src/cmd/makefile | 9 | ||||
| -rw-r--r-- | src/makefile | 9 |
10 files changed, 95 insertions, 0 deletions
diff --git a/src/.DS_Store b/src/.DS_Store Binary files differnew file mode 100644 index 0000000..29f25d4 --- /dev/null +++ b/src/.DS_Store diff --git a/src/cmd/.DS_Store b/src/cmd/.DS_Store Binary files differnew file mode 100644 index 0000000..ddbc73c --- /dev/null +++ b/src/cmd/.DS_Store diff --git a/src/cmd/coin/coin.c b/src/cmd/coin/coin.c new file mode 100644 index 0000000..09ca479 --- /dev/null +++ b/src/cmd/coin/coin.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + +int +main (void) +{ + int c; + time_t t; + srand((unsigned) time(&t)); + + printf("%s\n", (rand() % 2) ? "Heads" : "Tails"); + + return 0; +} diff --git a/src/cmd/coin/makefile b/src/cmd/coin/makefile new file mode 100644 index 0000000..cf8289d --- /dev/null +++ b/src/cmd/coin/makefile @@ -0,0 +1,10 @@ +all: coin + @cp coin $(PROROOT)/build/bin/coin + +coin: coin.c + $(CC) -o coin coin.c + +clean: + @rm -r coin + +.PHONY: all clean
\ No newline at end of file diff --git a/src/cmd/dice/dice.c b/src/cmd/dice/dice.c new file mode 100644 index 0000000..b31670f --- /dev/null +++ b/src/cmd/dice/dice.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + +int +main (void) +{ + int sides = 6; + time_t t; + srand((unsigned) time(&t)); + + printf("%d\n", (rand() % sides) + 1); + + return 0; +} diff --git a/src/cmd/dice/makefile b/src/cmd/dice/makefile new file mode 100644 index 0000000..5c0e384 --- /dev/null +++ b/src/cmd/dice/makefile @@ -0,0 +1,10 @@ +all: dice + @cp dice $(PROROOT)/build/bin/dice + +dice: dice.c + $(CC) -o dice dice.c + +clean: + @rm -r dice + +.PHONY: all clean
\ No newline at end of file diff --git a/src/cmd/echo/echo.c b/src/cmd/echo/echo.c new file mode 100644 index 0000000..4733830 --- /dev/null +++ b/src/cmd/echo/echo.c @@ -0,0 +1,17 @@ +#include <stdio.h> +#include <string.h> + +int +main (int argc, char *argv[]) +{ + int i, nflag = 0; + argc--; + + for (i = 1; i <= argc; i++) { + if (strcmp(argv[i], "-n") == 0) + nflag++; + else + printf("%s%c", argv[i], (i == argc) ? ((nflag == 1) ? '\0' : '\n') : ' '); + } + return 0; +} diff --git a/src/cmd/echo/makefile b/src/cmd/echo/makefile new file mode 100644 index 0000000..0301f23 --- /dev/null +++ b/src/cmd/echo/makefile @@ -0,0 +1,10 @@ +all: echo + @cp echo $(PROROOT)/build/bin/echo + +echo: echo.c + $(CC) -o echo echo.c + +clean: + @rm -r echo + +.PHONY: all clean
\ No newline at end of file diff --git a/src/cmd/makefile b/src/cmd/makefile new file mode 100644 index 0000000..52ddd59 --- /dev/null +++ b/src/cmd/makefile @@ -0,0 +1,9 @@ +TOPTARGETS := all clean install + +SUBDIRS := $(wildcard */.) + +$(TOPTARGETS): $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ $(MAKECMDGOALS) + +.PHONY: $(TOPTARGETS) $(SUBDIRS)
\ No newline at end of file diff --git a/src/makefile b/src/makefile new file mode 100644 index 0000000..52ddd59 --- /dev/null +++ b/src/makefile @@ -0,0 +1,9 @@ +TOPTARGETS := all clean install + +SUBDIRS := $(wildcard */.) + +$(TOPTARGETS): $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ $(MAKECMDGOALS) + +.PHONY: $(TOPTARGETS) $(SUBDIRS)
\ No newline at end of file |
