Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | ||||
Erik Andersen | 9cf3bfa | 2000-04-13 18:49:43 +0000 | [diff] [blame] | 3 | * Mini dirname implementation for busybox |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 4 | * |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 6 | * |
"Robert P. J. Day" | 801ab14 | 2006-07-12 07:56:04 +0000 | [diff] [blame] | 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 8 | */ |
Eric Andersen | cbe31da | 2001-02-20 06:14:08 +0000 | [diff] [blame] | 9 | |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 10 | /* BB_AUDIT SUSv3 compliant */ |
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */ | ||||
Mark Whitley | 827e45c | 2001-03-09 23:59:51 +0000 | [diff] [blame] | 12 | |
Denis Vlasenko | b6adbf1 | 2007-05-26 19:00:18 +0000 | [diff] [blame] | 13 | #include "libbb.h" |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 14 | |
Denis Vlasenko | 99912ca | 2007-04-10 15:43:37 +0000 | [diff] [blame] | 15 | /* This is a NOFORK applet. Be very careful! */ |
16 | |||||
Denis Vlasenko | 9b49a5e | 2007-10-11 10:05:36 +0000 | [diff] [blame] | 17 | int dirname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
Rob Landley | dfba741 | 2006-03-06 20:47:33 +0000 | [diff] [blame] | 18 | int dirname_main(int argc, char **argv) |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 19 | { |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 20 | if (argc != 2) { |
21 | bb_show_usage(); | ||||
22 | } | ||||
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 23 | |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 24 | puts(dirname(argv[1])); |
Matt Kraai | ceeff73 | 2001-06-21 19:41:37 +0000 | [diff] [blame] | 25 | |
Denys Vlasenko | 8131eea | 2009-11-02 14:19:51 +0100 | [diff] [blame] | 26 | return fflush_all(); |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 27 | } |