Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shar: dependency error #300

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions bin/shar
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,29 @@ License: public domain
# public domain code by salzr@certo.com
# (formerly rsalz@osf.org, rsalz@bbn.com, mirror!rs)

require 'getopts.pl';
use strict;

sub
Usage
{
print STDERR "@_.\nUsage: $av0 files...\n";
exit(1);
use File::Basename qw(basename);
use Getopt::Std qw(getopts);

use constant EX_SUCCESS => 0;
use constant EX_FAILURE => 1;

my $Program = basename($0);

sub usage {
warn "usage: $Program file...\n";
exit EX_FAILURE;
}

getopts('') or usage();
binmode STDOUT;

# Parse JCL.
$av0 = $0;
$av0 =~ s@.*/@@;
&Getopts("") || &Usage("Usage error");

# Do work.
$dirty = 0;
my $dirty = 0;
ARGUMENT: for my $f ( @ARGV ) {
if ( ! open(FH, '<', $f) ) {
warn "$av0: can't open $f, $!\n";
warn "$Program: can't open '$f': $!\n";
next ARGUMENT;
}
binmode FH;
Expand All @@ -48,10 +50,11 @@ ARGUMENT: for my $f ( @ARGV ) {
'
}
if (-B $f) {
$mode = (stat $f)[2];
my $mode = (stat $f)[2];
$mode = (join '', 0, ($mode&0700)>>6, ($mode&0070)>>3, ($mode&0007));
print "sed -e 's/^X//' | uudecode <<'FUNKY_STUFF'\n";
print "begin $mode $f\n";
my $block;
print pack 'u', $block while read FH, $block, 45;
print "end\n";
print "FUNKY_STUFF\n";
Expand All @@ -63,8 +66,11 @@ ARGUMENT: for my $f ( @ARGV ) {
close(FH);
}

&Usage("No input files") unless $dirty;
exit(0);
unless ($dirty) {
warn "$Program: no input files were processed\n";
exit EX_FAILURE;
}
exit EX_SUCCESS;

__END__

Expand All @@ -74,7 +80,7 @@ shar - create a shell archive of files

=head1 SYNOPSIS

B<shar> file [files...]
B<shar> file...

=head1 DESCRIPTION

Expand Down