sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

dirname.c (353B)


      1 /* See LICENSE file for copyright and license details. */
      2 #include <libgen.h>
      3 #include <stdio.h>
      4 
      5 #include "util.h"
      6 
      7 static void
      8 usage(void)
      9 {
     10 	eprintf("usage: %s path\n", argv0);
     11 }
     12 
     13 int
     14 main(int argc, char *argv[])
     15 {
     16 	ARGBEGIN {
     17 	default:
     18 		usage();
     19 	} ARGEND
     20 
     21 	if (argc != 1)
     22 		usage();
     23 
     24 	puts(dirname(argv[0]));
     25 
     26 	return fshut(stdout, "<stdout>");
     27 }