aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shh-portable-utils/basename.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/shh-portable-utils/basename.c b/src/shh-portable-utils/basename.c
index 8275717..0071f0b 100644
--- a/src/shh-portable-utils/basename.c
+++ b/src/shh-portable-utils/basename.c
@@ -1,15 +1,18 @@
#include <string.h>
+#include <skalibs/strerr2.h>
#include <skalibs/allreadwrite.h>
+#define USAGE "basename string [suffix]"
+
int main(int argc, char **argv)
{
size_t sufflen, len;
char *basename_start;
- if (argc < 2) {
- allwrite(1, ".\n", 2);
- return 0;
- }
+ PROG = "basename";
+ if (argc < 2)
+ strerr_dieusage(100, USAGE);
+
len = strlen(argv[1]);
if (!len) {
allwrite(1, ".\n", 2);