summaryrefslogtreecommitdiff
path: root/yhttpd/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'yhttpd/scripts')
-rw-r--r--yhttpd/scripts/README6
-rwxr-xr-xyhttpd/scripts/astyle.sh14
-rwxr-xr-xyhttpd/scripts/buildnr.pl26
-rwxr-xr-xyhttpd/scripts/checkperl.sh13
-rwxr-xr-xyhttpd/scripts/config.pl133
-rwxr-xr-xyhttpd/scripts/makedist.sh27
-rw-r--r--yhttpd/scripts/modules/file.pm28
-rwxr-xr-xyhttpd/scripts/screen.sh3
-rwxr-xr-xyhttpd/scripts/setglobvals.pl32
-rwxr-xr-xyhttpd/scripts/stats.pl95
-rwxr-xr-xyhttpd/scripts/version.sh11
11 files changed, 388 insertions, 0 deletions
diff --git a/yhttpd/scripts/README b/yhttpd/scripts/README
new file mode 100644
index 0000000..4a94391
--- /dev/null
+++ b/yhttpd/scripts/README
@@ -0,0 +1,6 @@
+All scripts should be run from the yhttpd main directory, example:
+
+./scripts/makeyhttpd.pl
+
+
+A ./makeyhttpd.pl WILL NOT work :)
diff --git a/yhttpd/scripts/astyle.sh b/yhttpd/scripts/astyle.sh
new file mode 100755
index 0000000..8f67195
--- /dev/null
+++ b/yhttpd/scripts/astyle.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+# The yhttpd Project (2004)
+#
+# This uses "astyle" to format C++ code into a specific code style!
+
+for f in h cpp tmpl
+do
+ for i in `find . -name "*.$f"`
+ do
+ echo $i
+ astyle --style=ansi -s2 $i
+ rm -f $i.orig
+ done
+done
diff --git a/yhttpd/scripts/buildnr.pl b/yhttpd/scripts/buildnr.pl
new file mode 100755
index 0000000..edfffd6
--- /dev/null
+++ b/yhttpd/scripts/buildnr.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+# The yhttpd Project (2003)
+#
+# This script increases the BUILNR of msgs,h each time the yhttpd
+# gets recompiled!
+
+use strict;
+
+open MSGS, "src/msgs.h";
+my @msgs = <MSGS>;
+close MSGS;
+
+foreach (@msgs)
+{
+ if ( /define BUILDNR/ )
+ {
+ s/(BUILDNR )(.+)$/$1.($2+1)/e;
+ print;
+ next;
+ }
+}
+
+open MSGS, ">src/msgs.h";
+print MSGS @msgs;
+close MSGS;
diff --git a/yhttpd/scripts/checkperl.sh b/yhttpd/scripts/checkperl.sh
new file mode 100755
index 0000000..642938b
--- /dev/null
+++ b/yhttpd/scripts/checkperl.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# The yhttpd Project (2005)
+#
+# This scripts checks for a perl installation
+
+if ! which perl >/dev/null
+then
+ echo You need to have Perl in your PATH!
+ exit 1
+fi
+
+echo Using `which perl`
+exit 0
diff --git a/yhttpd/scripts/config.pl b/yhttpd/scripts/config.pl
new file mode 100755
index 0000000..f82d5ba
--- /dev/null
+++ b/yhttpd/scripts/config.pl
@@ -0,0 +1,133 @@
+#!/usr/bin/perl
+
+# The yhttpd Project (2004, 2005)
+#
+# This script modifues the src/glob.h file.
+
+use strict;
+use scripts::modules::file;
+
+print <<END;
+Welcome to the yhttpd configurator!
+You may also edit the src/glob.h file manually instead of using
+this configurator option. Please also notice that this are only
+before-compile options. All setups which can be made after com-
+iling are placed in the yhttpd configuration file.
+END
+
+my $sep = "================================================================\n";
+my $stdin;
+
+for (;;) {
+ print "$sep Do you want to use the default before-compile options?\n";
+ print " (yes/no) [default is NO] ";
+ $stdin = <STDIN>;
+ chomp $stdin;
+ print "\n";
+
+ if ( $stdin eq "yes") {
+ print " You chose to use all the default before-compile options. Exiti-\n";
+ print " ng the configurator now!\n";
+ print $sep;
+ exit(0);
+ }
+
+ last if $stdin eq "no" or $stdin eq "";
+ print " Wrong input: You need to specify yes or no!\n";
+} # for
+
+`cp src/glob.h src/glob.h.org` unless -f "src/glob.h.org";
+
+my @glob = fopen("src/glob.h.org");
+my $flag = 0;
+
+for (@glob) {
+ if ( $flag == 0 && /- CONFIG -/ ) {
+ print $sep;
+ $flag = 1;
+ next;
+
+ } elsif ( $flag == 1 ) {
+ if ( /\*\// ) {
+ $flag = 2;
+
+ } else {
+ print;
+ }
+
+ next;
+
+ } elsif ( $flag == 2 ) {
+ if ( /#define (.+) (.+)/ ) {
+ my $def = $1;
+ my $val = $2;
+ my $flg = 0;
+
+ $flg = 1 if $val =~ s/"//g;
+
+ print " [Press enter to use default value: $val or q to quit] ";
+ $stdin = <STDIN>;
+ chomp $stdin;
+
+ finish() if $stdin eq "q" or $stdin eq "quit";
+
+ unless ( parse_input_value(\$stdin,\$val) ) {
+ $stdin = "\"$stdin\"" if $flg == 1;
+ $_ = "#define $def $stdin\n";
+ }
+
+ print "\n";
+ $flag = 0;
+ next;
+ }
+
+ elsif ( /#define .+/ ) {
+ my $default = "true";
+ my $stdin;
+
+ for (;;) {
+ $default = "false" if /\/\/#define/;
+
+ print " [Press enter to use default value: $default or q to quit] ";
+ $stdin = <STDIN>;
+ chomp $stdin;
+
+ finish() if $stdin eq "q" or $stdin eq "quit";
+ last if $stdin eq "" || $stdin eq "true" || $stdin eq "false";
+ print " Wrong input: You need to specify true or false!\n";
+ }
+
+ if ( $default eq "true" ) {
+ $_ = "//$_" unless parse_input_value(\$stdin,\$default);
+ }
+
+ else {
+ s/^\/\/// unless parse_input_value(\$stdin,\$default);
+ }
+
+ print "\n";
+ $flag = 0;
+ next;
+ }
+ }
+} // for
+
+finish();
+
+sub finish() {
+ fwrite("src/glob.h", @glob);
+ exit 0;
+}
+
+sub parse_input_value {
+ my $val = shift;
+ my $def = shift;
+
+ if ( $$val eq "" || $$val eq $$def) {
+ print " -> Using default option!\n";
+ return 1;
+ }
+
+ print " -> Using new option $$val!\n";
+ return 0;
+}
diff --git a/yhttpd/scripts/makedist.sh b/yhttpd/scripts/makedist.sh
new file mode 100755
index 0000000..0814611
--- /dev/null
+++ b/yhttpd/scripts/makedist.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# The yhttpd Project (2005)
+#
+# This script creates a .tar.bz2 ball.
+
+pwd=`pwd` && base=`basename $pwd` && cd .. &&
+version=`grep VERSION $base/src/msgs.h | head -n 1 | cut -d'"' -f2` &&
+prefix="$base-$version"
+package="$prefix.tar.bz2"
+
+echo Copying files... &&
+rm -Rf $prefix 2>/dev/null >/dev/null
+cp -Rp $base $prefix && cd $prefix &&
+
+echo Cleaning... &&
+gmake mrproper 2>/dev/null >/dev/null
+find . -name CVS | xargs rm -Rf
+cd .. &&
+
+echo Compressing... &&
+if test -f $package; then rm -f $package; fi &&
+tar cjf $package $prefix &&
+
+echo Finishing... &&
+rm -Rf $prefix 2>/dev/null >/dev/null
+cd $base &&
+du -h ../$package
diff --git a/yhttpd/scripts/modules/file.pm b/yhttpd/scripts/modules/file.pm
new file mode 100644
index 0000000..b11e2b3
--- /dev/null
+++ b/yhttpd/scripts/modules/file.pm
@@ -0,0 +1,28 @@
+sub dopen
+{
+ my $shift = shift;
+ opendir DIR, $shift or die "$shift: $!\n";
+ my @dir = readdir(DIR);
+ closedir DIR;
+ return @dir;
+}
+
+sub fopen
+{
+ my $shift = shift;
+ open FILE, $shift or die "$shift: $!\n";
+ my @file = <FILE>;
+ close FILE;
+ return @file;
+}
+
+sub fwrite
+{
+ my $shift = shift;
+ my @file = @_;
+ open FILE, ">$shift" or die "$shift: $!\n";
+ print FILE @file;
+ close FILE;
+}
+
+1;
diff --git a/yhttpd/scripts/screen.sh b/yhttpd/scripts/screen.sh
new file mode 100755
index 0000000..5c227fc
--- /dev/null
+++ b/yhttpd/scripts/screen.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+screen -S yhttpd ./bin/yhttpd
diff --git a/yhttpd/scripts/setglobvals.pl b/yhttpd/scripts/setglobvals.pl
new file mode 100755
index 0000000..1ee1de4
--- /dev/null
+++ b/yhttpd/scripts/setglobvals.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+# The yhttpd Project (2003)
+#
+# This script sets up some variables in src/glob.h
+
+use strict;
+
+use scripts::modules::file;
+
+my $file = 'src/glob.h';
+my $gmake = `which gmake`;
+my @glob = fopen($file);
+chomp($gmake);
+
+print "-> Setting values in $file\n";
+
+my $modified = 0;
+foreach (@glob)
+{
+ if (/^(#define GMAKE) "(.*)"/)
+ {
+ if ($2 ne "$gmake \\0")
+ {
+ s/^$1 "$2"/#define GMAKE "$gmake \\0"/;
+ print " -> Set $gmake\n";
+ fwrite($file,@glob);
+ last;
+ }
+ }
+}
+
diff --git a/yhttpd/scripts/stats.pl b/yhttpd/scripts/stats.pl
new file mode 100755
index 0000000..96fbdf1
--- /dev/null
+++ b/yhttpd/scripts/stats.pl
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+
+# The yhttpd Project (2003 - 2004)
+#
+# This script generates source code and project statistics
+
+use strict;
+
+use scripts::modules::file;
+
+my %stats;
+my $param = shift;
+
+&recursive(".");
+
+$stats{"Lines total"} = $stats{"Lines of source"}
+ + $stats{"Lines of scripts"}
+ + $stats{"Lines of text"}
+ + $stats{"Lines of HTML"};
+
+unless (defined $param) {
+
+ print "$_ = " . $stats{$_} . "\n"
+ for ( sort keys %stats );
+
+} else {
+
+ print $stats{$_} . " "
+ for sort keys %stats;
+
+}
+
+print "\n";
+
+sub recursive
+{
+ my $shift = shift;
+ my @dir = &dopen($shift);
+
+ foreach (@dir)
+ {
+ next if /^\.$/ or /^\.{2}$/;
+
+ if ( -f "$shift/$_" )
+ {
+ $stats{"Number of files total"}++;
+ &filestats("$shift/$_");
+ }
+ elsif ( -d "$shift/$_" )
+ {
+ $stats{"Number of dirs total"}++;
+ &recursive("$shift/$_");
+ }
+ }
+}
+
+sub filestats
+{
+ my $shift = shift;
+ if ( $shift =~ /\.(cpp|h|tmpl)$/ )
+ {
+ $stats{"Number of source files"}++;
+ $stats{"Lines of source"} += countlines($shift);
+ }
+ elsif ( $shift =~ /\.(html|css)$/ )
+ {
+ $stats{"Number of HTML files"}++;
+ $stats{"Lines of HTML"} += countlines($shift);
+ }
+ elsif ( $shift =~ /\.(gif|png|jpg)$/ )
+ {
+ $stats{"Number of gfx files"}++;
+ }
+ elsif ( $shift =~ /(\.pl|\.sh|configure.*|Makefile.*)$/ )
+ {
+ $stats{"Number of script files"}++;
+ $stats{"Lines of scripts"} += countlines($shift);
+ }
+ elsif ( $shift =~ /(\.txt|[A-Z]+)$/ )
+ {
+ $stats{"Number of text files"}++;
+ $stats{"Lines of text"} += countlines($shift);
+ }
+ elsif ( $shift =~ /\.so$/ )
+ {
+ $stats{"Number of compiled module files"}++;
+ }
+}
+
+sub countlines
+{
+ my $shift = shift;
+ my @file = fopen($shift);
+ return $#file;
+}
diff --git a/yhttpd/scripts/version.sh b/yhttpd/scripts/version.sh
new file mode 100755
index 0000000..50c189c
--- /dev/null
+++ b/yhttpd/scripts/version.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# The yhttpd Project (2005)
+#
+# This script shows yhttpd VERSION-BRANCH Build BUILDNUMBER
+
+version=`grep VERSION src/msgs.h | head -n 1 | cut -d'"' -f2`
+branch=`grep BRANCH src/msgs.h | head -n 1 | cut -d'"' -f2`
+build=`grep BUILD src/msgs.h | tail -n 1 | cut -d' ' -f3`
+echo "yhttpd $version-$branch Build $build"
+
+