From 9cd3ccffd5372dfde3af478e3f832f18db4be3f1 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:41 +0200 Subject: tagging tags --- yhttpd-0.7.0/scripts/README | 6 ++ yhttpd-0.7.0/scripts/buildnr.pl | 26 ++++++ yhttpd-0.7.0/scripts/config.sh | 152 +++++++++++++++++++++++++++++++++++ yhttpd-0.7.0/scripts/modules/file.pm | 28 +++++++ yhttpd-0.7.0/scripts/screen.sh | 3 + yhttpd-0.7.0/scripts/setglobvals.pl | 32 ++++++++ yhttpd-0.7.0/scripts/stats.pl | 97 ++++++++++++++++++++++ 7 files changed, 344 insertions(+) create mode 100644 yhttpd-0.7.0/scripts/README create mode 100755 yhttpd-0.7.0/scripts/buildnr.pl create mode 100755 yhttpd-0.7.0/scripts/config.sh create mode 100755 yhttpd-0.7.0/scripts/modules/file.pm create mode 100755 yhttpd-0.7.0/scripts/screen.sh create mode 100755 yhttpd-0.7.0/scripts/setglobvals.pl create mode 100755 yhttpd-0.7.0/scripts/stats.pl (limited to 'yhttpd-0.7.0/scripts') diff --git a/yhttpd-0.7.0/scripts/README b/yhttpd-0.7.0/scripts/README new file mode 100644 index 0000000..4a94391 --- /dev/null +++ b/yhttpd-0.7.0/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-0.7.0/scripts/buildnr.pl b/yhttpd-0.7.0/scripts/buildnr.pl new file mode 100755 index 0000000..4698f8d --- /dev/null +++ b/yhttpd-0.7.0/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 = ; +close MSGS; + +foreach (@msgs) +{ + if ( /BUILDNR/ ) + { + s/(BUILDNR )(.+)$/$1.($2+1)/e; + print; + next; + } +} + +open MSGS, ">src/msgs.h"; +print MSGS @msgs; +close MSGS; diff --git a/yhttpd-0.7.0/scripts/config.sh b/yhttpd-0.7.0/scripts/config.sh new file mode 100755 index 0000000..f301246 --- /dev/null +++ b/yhttpd-0.7.0/scripts/config.sh @@ -0,0 +1,152 @@ +#!/bin/sh +# The yhttpd Project (2004) +# +# This script modifues the src/glob.h file. + +if ! which perl >/dev/null +then + echo You need to have Perl in your PATH + exit 1 +fi + +perl -e ' + use strict; + + use scripts::modules::file; + +print <; + chomp $stdin; + prove_if_default(\$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; + + foreach( @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] "; + $stdin = ; + chomp $stdin; + + unless ( prove_if_default(\$stdin) ) + { + $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] "; + $stdin = ; + chomp $stdin; + + 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 prove_if_default(\$stdin); + } + + else + { + s/^\/\/// + unless prove_if_default(\$stdin); + } + + print "\n"; + $flag = 0; + next; + } + } + } // foreach + + fwrite("src/glob.h", @glob); + + sub prove_if_default + { + my $val = shift; + if ( $$val eq "" ) + { + print " -> Using default option!\n"; + return 1; + } + print " -> Using new option $$val!\n"; + return 0; + } +' diff --git a/yhttpd-0.7.0/scripts/modules/file.pm b/yhttpd-0.7.0/scripts/modules/file.pm new file mode 100755 index 0000000..b11e2b3 --- /dev/null +++ b/yhttpd-0.7.0/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 = ; + 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-0.7.0/scripts/screen.sh b/yhttpd-0.7.0/scripts/screen.sh new file mode 100755 index 0000000..5c227fc --- /dev/null +++ b/yhttpd-0.7.0/scripts/screen.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +screen -S yhttpd ./bin/yhttpd diff --git a/yhttpd-0.7.0/scripts/setglobvals.pl b/yhttpd-0.7.0/scripts/setglobvals.pl new file mode 100755 index 0000000..1ee1de4 --- /dev/null +++ b/yhttpd-0.7.0/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-0.7.0/scripts/stats.pl b/yhttpd-0.7.0/scripts/stats.pl new file mode 100755 index 0000000..fcbcd33 --- /dev/null +++ b/yhttpd-0.7.0/scripts/stats.pl @@ -0,0 +1,97 @@ +#!/usr/bin/perl + +# The yhttpd Project (2003 - 2004) +# +# This script generates source code and project statistics + +use strict; + +use scripts::modules::file; + +my %stats; + +&recursive("."); + +$stats{"Lines total"} = $stats{"Lines of source"} + + $stats{"Lines of scripts"} + + $stats{"Lines of text"} + + $stats{"Lines of HTML"}; + +my $bool = 0; +foreach ( sort keys %stats ) +{ + if ($bool == 0) + { + print "$_ = " . $stats{$_} . "\n"; + $bool = 1; + } + else + { + print "$_ = " . $stats{$_} . "\n"; + $bool = 0; + } +} + +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|README|INSTALL|COPYING|NEWS|SNAPSHOT|ChangeLog)$/ ) + { + $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; +} -- cgit v1.2.3