Rename setexec to chexec.
authorMatt McCutchen <matt@mattmccutchen.net>
Wed, 16 Sep 2020 20:28:01 +0000 (16:28 -0400)
committerMatt McCutchen <matt@mattmccutchen.net>
Wed, 16 Sep 2020 20:28:01 +0000 (16:28 -0400)
chexec [moved from setexec with 55% similarity]
cleanexec

diff --git a/setexec b/chexec
similarity index 55%
rename from setexec
rename to chexec
index 6f071eb..67ed861 100755 (executable)
--- a/setexec
+++ b/chexec
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 #!/usr/bin/perl
-# setexec: turns a file's executability on or off, same semantics as rsync's --executability
-# usage: setexec { + | - | --reference=<file> } <file> [...]
+# chexec: turns a file's executability on or off, same semantics as rsync's --executability
+# usage: chexec { + | - | --reference=<file> } <file> [...]
+# Rename from setexec for consistency with chmod, etc. and cadaver's chexec - Matt 2009-07-02
 
 $cmd = $ARGV[0];
 shift @ARGV;
 
 $cmd = $ARGV[0];
 shift @ARGV;
@@ -9,7 +10,7 @@ if ($cmd =~ /^--reference=(.*)$/) {
        $ref_file = $1;
        @stbuf = stat($ref_file);
        if (@stbuf == 0) {
        $ref_file = $1;
        @stbuf = stat($ref_file);
        if (@stbuf == 0) {
-               die "setexec: stat($ref_file): $!\n";
+               die "chexec: stat($ref_file): $!\n";
        }
        $ref_perms = $stbuf[2] & 07777;
        if (($ref_perms & 0111) == 0) {
        }
        $ref_perms = $stbuf[2] & 07777;
        if (($ref_perms & 0111) == 0) {
@@ -18,7 +19,7 @@ if ($cmd =~ /^--reference=(.*)$/) {
                $cmd = '+';
        }
 } elsif ($cmd ne '+' && $cmd ne '-') {
                $cmd = '+';
        }
 } elsif ($cmd ne '+' && $cmd ne '-') {
-       die "usage: setexec { + | - | --reference=<file> } <file> [...]\n";
+       die "usage: chexec { + | - | --reference=<file> } <file> [...]\n";
 }
 
 sub docmd($$) {
 }
 
 sub docmd($$) {
@@ -33,10 +34,10 @@ sub docmd($$) {
 file: foreach $file (@ARGV) {
        @stbuf = stat($file);
        if (@stbuf == 0) {
 file: foreach $file (@ARGV) {
        @stbuf = stat($file);
        if (@stbuf == 0) {
-               warn "setexec: stat($file): $!, skipping file\n";
+               warn "chexec: stat($file): $!, skipping file\n";
                next file;
        }
        $perms = $stbuf[2] & 07777;
        $perms = docmd($cmd, $perms);
                next file;
        }
        $perms = $stbuf[2] & 07777;
        $perms = docmd($cmd, $perms);
-       chmod($perms, $file) or warn "setexec: chmod($perms, $file): $!, skipping file\n";
+       chmod($perms, $file) or warn "chexec: chmod($perms, $file): $!, skipping file\n";
 }
 }
index 637de47..c39e465 100755 (executable)
--- a/cleanexec
+++ b/cleanexec
@@ -1,6 +1,6 @@
 #!/bin/bash
 if file "$1" | grep -q executable; then
 #!/bin/bash
 if file "$1" | grep -q executable; then
-       setexec + "$1"
+       chexec + "$1"
 else
 else
-       setexec - "$1"
+       chexec - "$1"
 fi
 fi