morpheus-base

morpheus base system
git clone git://git.2f30.org/morpheus-base.git
Log | Files | Refs

dirname.c (373B)


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