X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fchroot-rm.c;h=76cfc65efde559d8981b97940d79f54891e7c1c5;hb=a917f24ef7b003dcef54a3db2644cf9cb4bc2db2;hp=a4e594b77d398d79f50a549339d5162e81866d4d;hpb=87d2322d5b9bf5247d89940acb23b4e2df3a615f;p=util-vserver.git diff --git a/util-vserver/src/chroot-rm.c b/util-vserver/src/chroot-rm.c index a4e594b..76cfc65 100644 --- a/util-vserver/src/chroot-rm.c +++ b/util-vserver/src/chroot-rm.c @@ -1,6 +1,6 @@ -// $Id$ --*- c++ -*-- +// $Id$ --*- c -*-- -// Copyright (C) 2003 Enrico Scholz <> +// Copyright (C) 2003,2004 Enrico Scholz // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -21,25 +21,29 @@ #endif #include "util.h" -#include "wrappers.h" #include #include #include +#include + +#define ENSC_WRAPPERS_PREFIX "chroot-rm: " +#define ENSC_WRAPPERS_UNISTD 1 +#include int wrapper_exit_code = 1; static void -showHelp(int fd, char const *cmd, int res) +showHelp(char const *cmd) { - WRITE_MSG(fd, "Usage: "); - WRITE_STR(fd, cmd); - WRITE_MSG(fd, - " +\n\n" + WRITE_MSG(1, "Usage: "); + WRITE_STR(1, cmd); + WRITE_MSG(1, + " [--] +\n\n" "This program removes by assuming the current directory\n" "as a chroot directory.\n\n" "Please report bugs to " PACKAGE_BUGREPORT "\n"); - exit(res); + exit(0); } static void @@ -48,33 +52,32 @@ showVersion() WRITE_MSG(1, "chroot-rm " VERSION " -- removes files under current directory\n" "This program is part of " PACKAGE_STRING "\n\n" - "Copyright (C) 2003 Enrico Scholz\n" + "Copyright (C) 2003,2004 Enrico Scholz\n" VERSION_COPYRIGHT_DISCLAIMER); exit(0); } int main(int argc, char *argv[]) { - int i; - int res; + int res = EXIT_SUCCESS; int idx = 1; - Echroot("."); - Echdir("/"); + if (argc>1) { + if (strcmp(argv[1], "--help") ==0) showHelp(argv[0]); + if (strcmp(argv[1], "--version")==0) showVersion(); + if (strcmp(argv[1], "--")==0) ++idx; + } - if (argc==1) { + if (idx==argc) { WRITE_MSG(2, "No files given; use '--help' for more information\n"); return EXIT_FAILURE; } - if (strcmp(argv[1], "--help") ==0) showHelp(1, argv[0], 0); - if (strcmp(argv[1], "--version")==0) showVersion(); - if (strcmp(argv[1], "--")==0) ++idx; - res = EXIT_SUCCESS; - for (i=idx; i