Skip to content

Commit

Permalink
Added expr, ssh-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Holzschuch committed Mar 22, 2024
1 parent 74b0152 commit fdfaa5d
Show file tree
Hide file tree
Showing 37 changed files with 17,397 additions and 0 deletions.
Binary file added shell_cmds/basename/basename
Binary file not shown.
Binary file added shell_cmds/dirname/dirname
Binary file not shown.
67 changes: 67 additions & 0 deletions shell_cmds/expr/err.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include <err.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>

extern char *__progname;

void vwarn(const char *fmt, va_list ap)
{
fprintf (stderr, "%s: ", __progname);
if (fmt) {
vfprintf(stderr, fmt, ap);
fputs (": ", stderr);
}
perror(0);
}

void vwarnx(const char *fmt, va_list ap)
{
fprintf (stderr, "%s: ", __progname);
if (fmt) vfprintf(stderr, fmt, ap);
putc('\n', stderr);
}

_Noreturn void verr(int status, const char *fmt, va_list ap)
{
vwarn(fmt, ap);
exit(status);
}

_Noreturn void verrx(int status, const char *fmt, va_list ap)
{
vwarnx(fmt, ap);
exit(status);
}

void warn(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vwarn(fmt, ap);
va_end(ap);
}

void warnx(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vwarnx(fmt, ap);
va_end(ap);
}

_Noreturn void err(int status, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
verr(status, fmt, ap);
va_end(ap);
}

_Noreturn void errx(int status, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
verrx(status, fmt, ap);
va_end(ap);
}
Binary file added shell_cmds/expr/expr
Binary file not shown.
Binary file added shell_cmds/false/false
Binary file not shown.
Binary file added shell_cmds/getopt/getopt
Binary file not shown.
Binary file added shell_cmds/hexdump/hexdump
Binary file not shown.
Binary file added shell_cmds/jot/jot
Binary file not shown.
Binary file added shell_cmds/mktemp/mktemp
Binary file not shown.
Binary file added shell_cmds/printf/printf
Binary file not shown.
Binary file added shell_cmds/seq/seq
Binary file not shown.
Binary file added shell_cmds/tmp_commands/basename
Binary file not shown.
Binary file added shell_cmds/tmp_commands/dirname
Binary file not shown.
Binary file added shell_cmds/tmp_commands/false
Binary file not shown.
Binary file added shell_cmds/tmp_commands/getopt
Binary file not shown.
Binary file added shell_cmds/tmp_commands/hexdump
Binary file not shown.
Binary file added shell_cmds/tmp_commands/jot
Binary file not shown.
13 changes: 13 additions & 0 deletions shell_cmds/tmp_commands/list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# TODO: create pkg + uninstall files for all these, commit, push.

basename
dirname
false
getopt
hexdump od hd (single package)
jot
mktemp
printf
seq
which

Binary file added shell_cmds/tmp_commands/mktemp
Binary file not shown.
Binary file added shell_cmds/tmp_commands/printf
Binary file not shown.
Binary file added shell_cmds/tmp_commands/seq
Binary file not shown.
Binary file added shell_cmds/tmp_commands/which
Binary file not shown.
Binary file added shell_cmds/which/which
Binary file not shown.
Loading

0 comments on commit fdfaa5d

Please sign in to comment.