mirror of
https://github.com/kevinnlsamuel/stdouterr.git
synced 2025-12-06 09:55:58 +05:30
Compare commits
10 Commits
gnu-auto
...
efa8d3e945
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efa8d3e945
|
||
|
|
c105b6e91f
|
||
|
|
a2ecc4c48e
|
||
|
|
00c95e1b53
|
||
|
|
86e38b6479
|
||
|
|
42a36a2a3e
|
||
|
|
87ef6ff55c
|
||
|
|
de2260d5ba
|
||
|
|
03863fd9a5
|
||
|
|
3a55deb22b
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
build
|
||||||
38
Makefile
Normal file
38
Makefile
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
.PHONY: all builddir configure compile clean
|
||||||
|
build: prebuild configure compile
|
||||||
|
|
||||||
|
INSTALL = install
|
||||||
|
BUILD_DIR ?= build/
|
||||||
|
PREFIX ?= /usr/local/
|
||||||
|
DESTDIR ?= ${PREFIX}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SRC_DIR = src/
|
||||||
|
DOCS_DIR = docs/
|
||||||
|
|
||||||
|
BIN = stdouterr
|
||||||
|
MAN = ${BIN}.${man_category}
|
||||||
|
man_category = 1
|
||||||
|
CC_ARGS = "-I${SRC_DIR}lib"
|
||||||
|
bindir = ${DESTDIR}bin/
|
||||||
|
mandir = ${DESTDIR}share/man/${man_lang?:man_lang/}man${man_category}/
|
||||||
|
|
||||||
|
configure:
|
||||||
|
@echo nothing to configure
|
||||||
|
prebuild: clean
|
||||||
|
@mkdir ${BUILD_DIR}
|
||||||
|
clean:
|
||||||
|
@rm -rf ${BUILD_DIR}
|
||||||
|
compile:
|
||||||
|
$(CC) -o${BUILD_DIR}${BIN} ${SRC_DIR}main.c
|
||||||
|
|
||||||
|
preinstall:
|
||||||
|
mkdir -p ${bindir}
|
||||||
|
mkdir -p ${mandir}
|
||||||
|
install: preinstall
|
||||||
|
$(INSTALL) ${BUILD_DIR}${BIN} ${bindir}${BIN}
|
||||||
|
$(INSTALL) -m644 ${DOCS_DIR}${MAN} ${mandir}${MAN}
|
||||||
|
uninstall:
|
||||||
|
rm ${bindir}${BIN}
|
||||||
|
rm ${mandir}${MAN}
|
||||||
50
README.md
50
README.md
@@ -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
|
||||||
|
|||||||
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;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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");
|
||||||
}
|
}
|
||||||
|
|||||||
0
dev/.gitignore → test/.gitignore
vendored
0
dev/.gitignore → test/.gitignore
vendored
@@ -103,9 +103,11 @@ test(){
|
|||||||
echo "=== start of test ==="
|
echo "=== start of test ==="
|
||||||
echo
|
echo
|
||||||
"${oname}" "$@"
|
"${oname}" "$@"
|
||||||
|
ret=$?
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
echo "=== end of test ==="
|
echo "=== end of test ==="
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
if check_compilers; then
|
if check_compilers; then
|
||||||
Reference in New Issue
Block a user