Compare commits

...

6 Commits

Author SHA1 Message Date
kevinnls
86e38b6479 pass argv back and forth to parse instead of making global 2022-01-16 22:29:43 +01:00
kevinnls
42a36a2a3e patch: \n at end of help prompt
prevents messing up shell prompt after execution
2021-08-17 09:46:20 +00:00
kevinnls
87ef6ff55c docs (README): move stuff around/troubleshooting section 2021-08-16 12:48:35 +00:00
kevinnls
de2260d5ba bump app deve state to hatchling 2021-08-16 12:39:53 +00:00
kevinnls
03863fd9a5 doc: fix and improve 2021-08-16 12:39:31 +00:00
kevinnls
3a55deb22b docs (README): add compilation and installation instructions 2021-08-16 11:49:27 +00:00
3 changed files with 52 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
# stdouterr # stdouterr
## combining stdout and stderr > combining stdout and stderr
### what is `stdouterr`? ### what is `stdouterr`?
@@ -14,7 +14,53 @@ have a readily available tool i can use 🤓✨
### how is `stdouerr`? ### how is `stdouerr`?
🥚 initialised 🐣 hatchling
### how to use?
not distributing compiled versions yet (it's not even released!)
so you can (_cough_ have to) compile it yourself
#### dependencies
- `stdio.h`
- `stdlib.h`
both of which you most likely got when installing your compiler
#### compilation
```shell
gcc -o stdouterr ./src/main.c
```
#### installation
##### only for current user
```shell
cp ./stdouterr ~/.local/bin/
# OR
cp ./stdouterr ~/bin
# OR to any other path in PATH
```
##### for all users on the system
```
# as root or using sudo
cp ./stdouterr /usr/local/bin
```
#### troubleshooting
<details>
<summary>
compilation failed because no such file `stdio.h` and/or `stdlib.h`
</summary>
##### Debian / Ubuntu / family
install the package named `libc6-dev`
##### RHEL / Fedora / CentOS family
install the package named `glibc-devel`
##### other
sorry no idea. Google will be your friend tho
</details>
### contributing ### contributing

View File

@@ -38,7 +38,7 @@ void print_usage(){
} }
int parse(const int index){ int parse(const int index, char **argv){
int _return_value = 1; int _return_value = 1;
char* param = argv[index]; char* param = argv[index];
@@ -100,17 +100,11 @@ int parse(const int index){
return _return_value; return _return_value;
} }
int main(const int argc, char **_argv){ int main(const int argc, char **argv){
//TODO: alt method to make _argv globally accessible
argv = malloc( sizeof *argv * argc);
for(int i=0; i<argc; i++){
argv[i] = _argv[i];
}
if(argc > 1){ if(argc > 1){
for(int counter = 1; counter < argc;){ for(int counter = 1; counter < argc;){
counter += parse(counter); counter += parse(counter, argv);
} }
} }

View File

@@ -19,5 +19,5 @@ void tmp_help(){
-t\n\ -t\n\
Don\'t print output\n\ Don\'t print output\n\
-r\n\ -r\n\
Don\'t print error"); Don\'t print error\n");
} }