diff options
author | Peter <petershh@disroot.org> | 2022-08-14 11:34:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-14 11:34:20 +0300 |
commit | b28f361ae79ab484bc7017e66f545b84949b91ae (patch) | |
tree | 5ceb5632ca73daecb987a5d159bb7f72411ee448 | |
parent | 5afaf8e6eef12f8b7109d4c12324ef9b505c2c4d (diff) | |
download | shh-portable-utils-b28f361ae79ab484bc7017e66f545b84949b91ae.tar.xz |
Add logname
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | package/deps.mak | 5 | ||||
-rw-r--r-- | package/modes | 1 | ||||
-rw-r--r-- | package/targets.mak | 1 | ||||
-rw-r--r-- | src/shh-portable-utils/deps-exe/logname | 1 | ||||
-rw-r--r-- | src/shh-portable-utils/logname.c | 18 |
6 files changed, 26 insertions, 1 deletions
@@ -15,6 +15,7 @@ src/include/shh-portable-utils/config.h /false /link /ln +/logname /mkdir /mkfifo /nice diff --git a/package/deps.mak b/package/deps.mak index 073500a..042d609 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -14,7 +14,8 @@ src/shh-portable-utils/dirname.o src/shh-portable-utils/dirname.lo: src/shh-port src/shh-portable-utils/false.o src/shh-portable-utils/false.lo: src/shh-portable-utils/false.c src/shh-portable-utils/link.o src/shh-portable-utils/link.lo: src/shh-portable-utils/link.c src/shh-portable-utils/ln.o src/shh-portable-utils/ln.lo: src/shh-portable-utils/ln.c -src/shh-portable-utils/mkdir.o src/shh-portable-utils/mkdir.lo: src/shh-portable-utils/mkdir.c +src/shh-portable-utils/logname.o src/shh-portable-utils/logname.lo: src/shh-portable-utils/logname.c +src/shh-portable-utils/mkdir.o src/shh-portable-utils/mkdir.lo: src/shh-portable-utils/mkdir.c src/shh-portable-utils/shhfuncs.h src/shh-portable-utils/mkfifo.o src/shh-portable-utils/mkfifo.lo: src/shh-portable-utils/mkfifo.c src/shh-portable-utils/shhfuncs.h src/shh-portable-utils/nice.o src/shh-portable-utils/nice.lo: src/shh-portable-utils/nice.c src/shh-portable-utils/nohup.o src/shh-portable-utils/nohup.lo: src/shh-portable-utils/nohup.c @@ -51,6 +52,8 @@ link: EXTRA_LIBS := -lskarnet link: src/shh-portable-utils/link.o ln: EXTRA_LIBS := -lskarnet ln: src/shh-portable-utils/ln.o +logname: EXTRA_LIBS := -lskarnet +logname: src/shh-portable-utils/logname.o mkdir: EXTRA_LIBS := -lskarnet mkdir: src/shh-portable-utils/mkdir.o src/shh-portable-utils/parse_mode_octal.o src/shh-portable-utils/parse_mode_symbolic.o src/shh-portable-utils/change_mode.o mkfifo: EXTRA_LIBS := -lskarnet diff --git a/package/modes b/package/modes index 12d0659..ca09ea6 100644 --- a/package/modes +++ b/package/modes @@ -8,6 +8,7 @@ dirname 0755 false 0755 link 0755 ln 0755 +logname 0755 mkdir 0755 mkfifo 0755 nice 0755 diff --git a/package/targets.mak b/package/targets.mak index ff2bd8f..7b3dca2 100644 --- a/package/targets.mak +++ b/package/targets.mak @@ -9,6 +9,7 @@ dirname \ false \ link \ ln \ +logname \ mkdir \ mkfifo \ nice \ diff --git a/src/shh-portable-utils/deps-exe/logname b/src/shh-portable-utils/deps-exe/logname new file mode 100644 index 0000000..e7187fe --- /dev/null +++ b/src/shh-portable-utils/deps-exe/logname @@ -0,0 +1 @@ +-lskarnet diff --git a/src/shh-portable-utils/logname.c b/src/shh-portable-utils/logname.c new file mode 100644 index 0000000..ec21e33 --- /dev/null +++ b/src/shh-portable-utils/logname.c @@ -0,0 +1,18 @@ +#include <string.h> + +#include <unistd.h> + +#include <skalibs/strerr2.h> +#include <skalibs/allreadwrite.h> + +int main(void) +{ + char *logname; + PROG = "logname"; + logname = getlogin(); + if (!logname) + strerr_diefu1sys(111, "get login name"); + allwrite(1, logname, strlen(logname)); + fd_write(1, "\n", 1); + return 0; +} |