mirror of
https://github.com/kevinnlsamuel/stdouterr.git
synced 2025-12-06 09:55:58 +05:30
Compare commits
6 Commits
gnu-auto
...
86e38b6479
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86e38b6479
|
||
|
|
42a36a2a3e
|
||
|
|
87ef6ff55c
|
||
|
|
de2260d5ba
|
||
|
|
03863fd9a5
|
||
|
|
3a55deb22b
|
50
README.md
50
README.md
@@ -1,6 +1,6 @@
|
||||
# stdouterr
|
||||
|
||||
## combining stdout and stderr
|
||||
> combining stdout and stderr
|
||||
|
||||
### what is `stdouterr`?
|
||||
|
||||
@@ -14,7 +14,53 @@ have a readily available tool i can use 🤓✨
|
||||
|
||||
### 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
|
||||
|
||||
12
src/main.c
12
src/main.c
@@ -38,7 +38,7 @@ void print_usage(){
|
||||
}
|
||||
|
||||
|
||||
int parse(const int index){
|
||||
int parse(const int index, char **argv){
|
||||
|
||||
int _return_value = 1;
|
||||
char* param = argv[index];
|
||||
@@ -100,17 +100,11 @@ int parse(const int index){
|
||||
return _return_value;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
int main(const int argc, char **argv){
|
||||
|
||||
if(argc > 1){
|
||||
for(int counter = 1; counter < argc;){
|
||||
counter += parse(counter);
|
||||
counter += parse(counter, argv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,5 +19,5 @@ void tmp_help(){
|
||||
-t\n\
|
||||
Don\'t print output\n\
|
||||
-r\n\
|
||||
Don\'t print error");
|
||||
Don\'t print error\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user