Compare commits

...

10 Commits

Author SHA1 Message Date
kevinnls
efa8d3e945 rearrange 2022-01-25 11:23:14 +01:00
kevinnls
c105b6e91f add Makefile 2022-01-25 11:18:01 +01:00
kevinnls
a2ecc4c48e fix return value of test 2022-01-25 10:51:58 +01:00
kevinnls
00c95e1b53 rearrange 2022-01-25 10:42:20 +01:00
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
9 changed files with 93 additions and 12 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
build

38
Makefile Normal file
View 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}

View File

@@ -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

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;
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);
}
}

View File

@@ -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");
}

View File

View File

@@ -103,9 +103,11 @@ test(){
echo "=== start of test ==="
echo
"${oname}" "$@"
ret=$?
echo
echo
echo "=== end of test ==="
return ret
}
if check_compilers; then