-XLIB= -L/usr/local/X11R5/lib -lX11
+INSTALLDIR= $(HOME)/bin
+INSTALLED= $(INSTALLDIR)/autotitle
+X11= /usr/X11R6
-installed= $(HOME)/bin/$(ARCH)/autotitle
+CPPFLAGS= $(OPTIONS) -I$(X11)/include
+CFLAGS= $(OPTIMISE)
+OPTIMISE= -O2
+OPTIONS= -DNOXTERM
+XLIB= -L$(X11)/lib -lX11
-default: autotitle$(ARCH)
+default: autotitle
-install: $(installed)
+install: $(INSTALLED)
-$(installed): autotitle$(ARCH)
- strip autotitle$(ARCH)
- rm -f $(HOME)/bin/$(ARCH)/autotitle
- ln `pwd`/autotitle$(ARCH) $(HOME)/bin/$(ARCH)/autotitle
+$(INSTALLED): autotitle
+ rm -f $@
+ ln autotitle $@
-autotitlesun4: autotitle.c Makefile
- gcc -traditional -O -o autotitlesun4 autotitle.c $(XLIB) -DNOXTERM
-
-autotitlesun3: autotitle.c Makefile
- gcc -traditional -O -o autotitlesun3 autotitle.c $(XLIB) -DNOXTERM
-
-autotitlemips: autotitle.c Makefile
- cc -O -o autotitlemips autotitle.c $(XLIB) -DNOXTERM
+autotitle: autotitle.c Makefile
+ $(CC) $(CFLAGS) $(CPPFLAGS) autotitle.c -o $@ $(XLIB)
+ strip autotitle
+++ /dev/null
-gcc -traditional -O -o autotitlesun4 autotitle.c -I/applic/X11R5/include -L/applic/X11R5/lib -lX11 -DNOXTERM
+++ /dev/null
-make autotitle 'LDFLAGS=-L/usr/X11R6/lib -s' LDLIBS=-lX11 CFLAGS=-DNO
-XTERM
-make autotitle 'LDFLAGS=-L/usr/X11R6/lib -s' LDLIBS=-lX11 CFLAGS=-DNO
-XTERM
-make autotitle 'LDFLAGS=-L/usr/X11R6/lib -s' LDLIBS=-lX11 CFLAGS=-DNO
-XTERM
-make autotitle 'LDFLAGS=-L/usr/X11R6/lib -s' LDLIBS=-lX11 CFLAGS=-DNO
-XTERM
+++ /dev/null
-cc -o autotitle autotitle.c -I/opt/X11R5/include -L/opt/X11R5/lib -R/opt/X11R5/lib -lX11 -lsocket -lnsl -DNOXTERM
@@-
-chomp($hostname= `uname -n`); $? and die;
+chomp($hostname= `uname -n`); $? and die 'uname $?';
+($hostname)=(gethostbyname $hostname) or die "hostname $hostname ?";
+
+chomp($s= `uname`); $? and die 'platform $?';
+if ($s =~ m/^Linux$/) {
+ chomp($_= `uname -m`); $? and die 'platform $?';
+ if (m/^i\d86/) {
+ $platform= 'linux-i386';
+ } else {
+ die '$_ ?';
+ }
+}
+
+$ncipher= $hostname =~ m/\.ncipher\.com$/
+ || $hostname =~ m/\.ncipherusa\.com$/;
--- /dev/null
+#!/bin/sh
+set -x
+make -C autotitle
+make -C autotitle install INSTALLDIR=$HOME/personal/@@$platform@@/bin
#!/bin/sh
# Set up the environment:
-PATH=$HOME/personal/linux-i386/bin:$HOME/public/linux-i386/bin
+PATH=$HOME/personal/@@$platform@@/bin
+@@?$ncipher?@@@@#
PATH=$PATH:$HOME/personal/linux-i386/crypto/scripts
+@@;@@#
PATH=$PATH:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin
PATH=$PATH:/opt/bin:/usr/bin/X11
open DEBUG, ">/dev/null" or die "gpt: /dev/null: $!\n";
-while (@main::ARGV =~ m/^-/) {
+while ($main::ARGV[0] =~ m/^-/) {
$_= shift @main::ARGV;
next if m/^--$/;
while (m/^-./) {
} else {
for ($i=0; $i<@main::ARGV; $i++) {
$lno= '<arg#'.($i+1).'>';
- $value= $main::ARGV[$i];
- $fh= new IO::File $value,'r' or err("cannot open file \`$value': $!");
- process_fh($fh,$value);
- $fh->close or err("gpt: cannot close file \`$value': $!");
+ process_file($main::ARGV[$i]);
}
}
close STDOUT or die "gpt: close stdout: $!\n";
exit 0;
+sub process_file ($) {
+ my ($value) = @_;
+ $fh= new IO::File $value,'r' or err("cannot open file \`$value': $!");
+ process_fh($fh,$value);
+ $fh->close or err("gpt: cannot close file \`$value': $!");
+}
+
sub err ($) { die "gpt: $fn:$lno: $_[0]\n"; }
sub add_perl ($) {
if ($op =~ m/[-< \$?]/) {
$substr.= $esc if @oplist;
push @oplist, $op;
+ add_perl($op) if $op =~ m/[\$]/;
} elsif ($op =~ m/[\)\}\;\:]/) {
err("unmatched closing \@\@$op") unless @oplist;
$want= pop @oplist;
} else {
$substr.= $esc;
}
+ } elsif ($op eq '#') {
+ $l =~ s/^[^\n]*//; $l =~ s/^\n//;
} else {
err("bad escape sequence \@\@$op in text part");
}
}
}
+sub close_nesteds () {
+ my ($op);
+ while (@oplist) {
+ $op= $oplist[$#oplist];
+ if (@oplist & 1) {
+ err("unterminated \@\@?") if $op eq '?';
+ $l=' @@';
+ } else {
+ if ($op =~ y/({/)}/) {
+ $l= '@@'.$op;
+ } elsif ($op =~ m/^[;:]+/) {
+ $l= '@@;';
+ } else {
+ die "intern /@oplist/";
+ }
+ }
+ process_input();
+ }
+}
+
sub process_fh ($$) {
local ($fh,$fn) = @_;
local ($l,$lno, @oplist,$substr,$expr,$to,$op);
$lno= $.;
process_input();
}
+
die "gpt: $fn: read error: $!" if $fh->error;
+ close_nesteds();
}
sub output ($) {
local ($outbuf, @oplist,$substr,$expr,$to,$op);
$outbuf='';
process_input();
+ close_nesteds();
return $outbuf;
}
-.bash_history 0400
-.configs/cache/ 2770
-private/ 2770
+.bash_history 0400
+
+.configs/xprofile 0775
+
+personal/@@$platform@@/bin/ 2775
+
+.configs/cache/ 2770
+private/ 2770
.
defined($umask=umask) or die $!;
$home= $ENV{'HOME'}.'/';
-while (@ARGV =~ m/^-/) {
+while ($ARGV[0] =~ m/^-/) {
$_= shift(@ARGV);
last if m/^--$/;
while (m/^-./) {
}
}
}
+die if @ARGV;
stat $home or die $!;
-d _ or die;
sub maybe_chmod ($$$) {
my ($nowperms,$perms,$obj) = @_;
return if $nowperms==$perms;
- if ($doing) {
+ if ($action) {
chmod $perms, $home.$obj or die $!;
} else {
would($obj, sprintf 'chmod %04o -> %04o', $nowperms, $perms);
maybe_chmod($nowperms,$perms,$dir);
} else {
die $! unless $!==&ENOENT;
- if ($doing) {
+ if ($action) {
mkdir $home.$dir, $perms or die $!;
} else {
would($dir, sprintf 'mkdir %04o', $perms);
-d 'new' or mkdir 'new', 02700 or die $!;
+sub prep_proc ($$) {
+ my ($if,$newf) = @_;
+ my ($c);
+ defined($c= fork) or die $!;
+ if (!$c) {
+ unlink $newf;
+ open STDOUT, "> $newf" or die "$newf $!";
+ exec './gpt','config',$if; die $!;
+ }
+ $!=0; waitpid($c,0)==$c or die $!;
+ $? and die $?;
+}
+
opendir D, "files" or die $!;
while ($if=readdir D) {
next unless $if =~ m/^[_a-z0-9\\]/;
length $1 eq 1 ? $1 : sprintf '%c', hex $1
/ge;
- $newf= 'new/'.$if;
mkparents($of);
- defined($c= fork) or die $!;
- if (!$c) {
- unlink $newf;
- open STDOUT, "> $newf" or die "$of $newf $!";
- exec './gpt','config','files/'.$if; die $!;
- }
- $!=0; waitpid($c,0)==$c or die $!;
- $? and die $?;
+ $newf= 'new/'.$if;
+ prep_proc('files/'.$if,$newf);
$perms= exists $fileperms{$of} ? $fileperms{$of} : 00666&~$umask;
chmod $perms, $newf or die $!;
if (stat $home.$of) {
-f _ or die "$of is not a file!";
$nowperms= (stat _)[2] & 07777;
+ if ($nowperms != $perms) {
+ would($of, sprintf 'chmod %04o -> %04o', $nowperms, $perms);
+ }
if (!$action) {
- if ($nowperms != $perms) {
- would($of, sprintf 'chmod %04o -> %04o', $nowperms, $perms);
- }
system 'diff','-u',$home.$of,$newf;
$?==0 or $?==256 or die $?;
+ $changes++ if $?;
}
} else {
would($of, sprintf 'create %04o', $perms);
my ($obj,$what) = @_;
return if $would_done{$obj}++;
print STDOUT "*** $what $obj\n" or die $!;
+ $changes++;
+}
+
+if ($changes) {
+ print STDOUT "=== $changes changes\n" or die $!;
+} else {
+ print STDOUT "=== no changes\n" or die $!;
+}
+
+prep_proc('execute','new/,execute');
+if ($action) {
+ chmod 0700,'new/,execute' or die $!;
+ system 'new/,execute'; $? and die $?;
}
close STDOUT or die $!;
--- /dev/null
+platform @@$platform@@
+hostname @@$hostname@@
+ncipher @@$ncipher@@