From 0ea43cbc5bbb2bbefe48bd32bb40d1d825208c82 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Mon, 1 Nov 2021 12:02:03 -0400 Subject: Updated the README, Removed the License, Changed ints to Ulongs in coin --- .vscode/targets.log | 8 ++++---- LICENSE | 21 --------------------- README.md | 38 ++++++++++++++++++++++++++++++++++++++ README.txt | 14 -------------- src/cmd/coin/coin.c | 24 +++++++++++++++++------- 5 files changed, 59 insertions(+), 46 deletions(-) delete mode 100644 LICENSE create mode 100644 README.md delete mode 100644 README.txt diff --git a/.vscode/targets.log b/.vscode/targets.log index 0d9e783..4086f67 100644 --- a/.vscode/targets.log +++ b/.vscode/targets.log @@ -7,7 +7,7 @@ make all -f "/Users/jmm/Documents/git/ProjectMustang/makefile" --print-data-base # This program built for i386-apple-darwin11.3.0 -# Make data base, printed on Mon Nov 1 10:33:21 2021 +# Make data base, printed on Mon Nov 1 11:39:40 2021 # Variables @@ -42,7 +42,7 @@ INFOPATH = /opt/homebrew/share/info: # environment PLAN9 = /opt/plan9port # environment -VSCODE_IPC_HOOK_EXTHOST = /var/folders/qq/frtrjqf10vlcgdw8_fwlhm_c0000gn/T/vscode-ipc-6442ebc7-8e85-4d28-b0e2-f9a0fc3ed687.sock +VSCODE_IPC_HOOK_EXTHOST = /var/folders/qq/frtrjqf10vlcgdw8_fwlhm_c0000gn/T/vscode-ipc-0d1cd7ca-fb65-4182-a0f6-057ab4f3f736.sock # environment VSCODE_CWD = / # environment @@ -176,7 +176,7 @@ SUBDIRS := src # environment LANG = C # environment -VSCODE_PID = 28450 +VSCODE_PID = 30994 # variable set hash-table stats: # Load=83/1024=8%, Rehash=0, Collisions=3/113=3% @@ -270,6 +270,6 @@ install: # strcache size: total = 4096 / max = 4096 / min = 4096 / avg = 4096 # strcache free: total = 4047 / max = 4047 / min = 4047 / avg = 4047 -# Finished Make data base on Mon Nov 1 10:33:21 2021 +# Finished Make data base on Mon Nov 1 11:39:40 2021 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 22c5563..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 Jacob McDonnell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..654c8f6 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# Project Mustang + +*** + +## Overview: + +A UNIX-like operating system with the graphical environment of a 90s operating system, written in C for the Raspberry PI 4. + +## Planned Features: + +- Full desktop environment similar to windows 9x + +- Programmer based environment with tools to make programming, and gui programming, easier; like NeXTSTEP + +- UNIX-like userland tools + +- Networking + +- Support for multiple programming languages like C, C++, GOLANG, and mabye Java + +## Current Goals: +- Write userland programs + +## Building + +To build the project run: + +``` +make +``` + +To Install the userland programs run: + +``` +sudo make install +``` + +This will install the userland programs to `/opt/ProjectMustang/`. \ No newline at end of file diff --git a/README.txt b/README.txt deleted file mode 100644 index f242343..0000000 --- a/README.txt +++ /dev/null @@ -1,14 +0,0 @@ -Project Mustang -=============== - -Overview: A UNIX-like operating system with the graphical environment of a 90s operating system, written in C for the Raspberry PI 4. - -Features: - - Full desktop environment similar to windows 9x - - Programmer based environment with tools to make programming, and gui programming, easier; like NeXTSTEP - - UNIX-like userland tools - - Networking - - Support for multiple programming languages like C, C++, GOLANG, and mabye Java - -Goals: - - Write userland programs \ No newline at end of file diff --git a/src/cmd/coin/coin.c b/src/cmd/coin/coin.c index 5c58b3c..c18d66c 100644 --- a/src/cmd/coin/coin.c +++ b/src/cmd/coin/coin.c @@ -2,25 +2,34 @@ #include #include #include +#include -int coinFlip (int times); +unsigned long coinFlip (unsigned long times); int main (int argc, char *argv[]) { - int nflag = 0, i, times = 1, tails, heads; + int nflag = 0, i, mflag = 0; + unsigned long times = 1, tails, heads; argc--; for (i = 1; i <= argc; i++) { if (strcmp(argv[i], "-n") == 0) nflag++; - else if (nflag == 1) + else if (strcmp(argv[i], "-m") == 0) { + mflag++; + break; + } else if (nflag == 1) times = atoi(argv[i]); if (times == 0) { printf("Non Integer Value Inputted\n"); return -1; } } + + if (mflag == 1) + times = ULONG_MAX; + if (times == 1) printf("%s\n", coinFlip(times) ? "Heads" : "Tails"); else { @@ -28,17 +37,18 @@ main (int argc, char *argv[]) heads = times - tails; float ph = (float)heads/times, pt = (float)tails/times; - printf("Heads: %d\nTails: %d\nProb Heads: %f\nProb Tails: %f\n", heads, tails, ph, pt); + printf("Heads: %lu\nTails: %ld\nProb Heads: %f\nProb Tails: %f\n", heads, tails, ph, pt); } return 0; } /* coinFlip: Flips a coin n numbers of times and returns the number of tails */ -int -coinFlip (int times) +unsigned long +coinFlip (unsigned long times) { - int tails, i, c; + unsigned long tails, i; + int c; time_t t; srand((unsigned) time(&t)); -- cgit v1.2.3