File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / curl / tests / libtest / test610.pl
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 3 10:01:16 2020 UTC (5 years ago) by misho
Branches: curl, MAIN
CVS tags: v7_70_0p4, HEAD
curl

    1: #!/usr/bin/env perl
    2: #***************************************************************************
    3: #                                  _   _ ____  _
    4: #  Project                     ___| | | |  _ \| |
    5: #                             / __| | | | |_) | |
    6: #                            | (__| |_| |  _ <| |___
    7: #                             \___|\___/|_| \_\_____|
    8: #
    9: # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
   10: #
   11: # This software is licensed as described in the file COPYING, which
   12: # you should have received as part of this distribution. The terms
   13: # are also available at https://curl.haxx.se/docs/copyright.html.
   14: #
   15: # You may opt to use, copy, modify, merge, publish, distribute and/or sell
   16: # copies of the Software, and permit persons to whom the Software is
   17: # furnished to do so, under the terms of the COPYING file.
   18: #
   19: # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
   20: # KIND, either express or implied.
   21: #
   22: ###########################################################################
   23: # Perform simple file and directory manipulation in a portable way
   24: if ( $#ARGV <= 0 )
   25: {
   26:     print "Usage: $0 mkdir|rmdir|rm|move|gone path1 [path2] [more commands...]\n";
   27:     exit 1;
   28: }
   29: 
   30: use File::Copy;
   31: while(@ARGV) {
   32:     my $cmd = shift @ARGV;
   33:     my $arg = shift @ARGV;
   34:     if ($cmd eq "mkdir") {
   35:         mkdir $arg || die "$!";
   36:     }
   37:     elsif ($cmd eq "rmdir") {
   38:         rmdir $arg || die "$!";
   39:     }
   40:     elsif ($cmd eq "rm") {
   41:         unlink $arg || die "$!";
   42:     }
   43:     elsif ($cmd eq "move") {
   44:         my $arg2 = shift @ARGV;
   45:         move($arg,$arg2) || die "$!";
   46:     }
   47:     elsif ($cmd eq "gone") {
   48:         ! -e $arg || die "Path $arg exists";
   49:     } else {
   50:         print "Unsupported command $cmd\n";
   51:         exit 1;
   52:     }
   53: }
   54: exit 0;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>