diff options
| author | Paul Buetow <paul@buetow.org> | 2010-11-21 16:02:41 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2010-11-21 16:02:41 +0000 |
| commit | c155ee9e0f133aafff70984f5b09c45efc62ca5a (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /0.8/scripts | |
| parent | 19f9940dc968afae01b54377ee23ec59069c9646 (diff) | |
moving stuff to branches
Diffstat (limited to '0.8/scripts')
| -rw-r--r-- | 0.8/scripts/README | 17 | ||||
| -rwxr-xr-x | 0.8/scripts/astyle.sh | 14 | ||||
| -rwxr-xr-x | 0.8/scripts/buildnr.pl | 26 | ||||
| -rwxr-xr-x | 0.8/scripts/checkperl.sh | 13 | ||||
| -rwxr-xr-x | 0.8/scripts/config.pl | 133 | ||||
| -rwxr-xr-x | 0.8/scripts/makedist.sh | 27 | ||||
| -rwxr-xr-x | 0.8/scripts/makeyhttpd.pl | 198 | ||||
| -rw-r--r-- | 0.8/scripts/modules/file.pm | 28 | ||||
| -rwxr-xr-x | 0.8/scripts/screen.sh | 3 | ||||
| -rwxr-xr-x | 0.8/scripts/setglobvals.pl | 32 | ||||
| -rwxr-xr-x | 0.8/scripts/stats.pl | 95 | ||||
| -rwxr-xr-x | 0.8/scripts/version.sh | 11 |
12 files changed, 0 insertions, 597 deletions
diff --git a/0.8/scripts/README b/0.8/scripts/README deleted file mode 100644 index f2040ae..0000000 --- a/0.8/scripts/README +++ /dev/null @@ -1,17 +0,0 @@ -All scripts should be run from the yChat main directory, example: - -./scripts/makeyhttpd.pl - -A ./makeyhttpd.pl WILL NOT work :) - -astyle.sh - Uses the astyle tool for source code formatting -buildnr.pl - Increments the yChat build number by one -checkperl.sh - Checks which perl to use [obsolete] -config.pl - yChat configurator [obsolete] -makedist.sh - Creates a yChat destribution package [broken] -makeyhttpd.pl - Generates yhttpd sourcecode [broken] -modules/ - Contains perl subroutines -screen.sh - Starts yChat inside of a screen session -setglobvals.pl - Sets some variables inside of the ./src/glob.h file -stats.pl - Generates and prints out some source code statistics -version.sh - Prints out the current yChat version diff --git a/0.8/scripts/astyle.sh b/0.8/scripts/astyle.sh deleted file mode 100755 index b9dbc45..0000000 --- a/0.8/scripts/astyle.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# The yChat 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/0.8/scripts/buildnr.pl b/0.8/scripts/buildnr.pl deleted file mode 100755 index ee3d3e2..0000000 --- a/0.8/scripts/buildnr.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl - -# The yChat Project (2003) -# -# This script increases the BUILNR of msgs,h each time the yChat -# 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/0.8/scripts/checkperl.sh b/0.8/scripts/checkperl.sh deleted file mode 100755 index fa5e98f..0000000 --- a/0.8/scripts/checkperl.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# The yChat 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/0.8/scripts/config.pl b/0.8/scripts/config.pl deleted file mode 100755 index 73b3ae5..0000000 --- a/0.8/scripts/config.pl +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/perl - -# The yChat Project (2004, 2005) -# -# This script modifues the src/glob.h file. - -use strict; -use scripts::modules::file; - -print <<END; -Welcome to the yChat 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 yChat 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/0.8/scripts/makedist.sh b/0.8/scripts/makedist.sh deleted file mode 100755 index 4f1c6e9..0000000 --- a/0.8/scripts/makedist.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -x -# The yChat 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/0.8/scripts/makeyhttpd.pl b/0.8/scripts/makeyhttpd.pl deleted file mode 100755 index 5a44462..0000000 --- a/0.8/scripts/makeyhttpd.pl +++ /dev/null @@ -1,198 +0,0 @@ -#!/usr/bin/perl - -# The yChat & yhttpd Project (2004, 2005) -# -# This scripts modifies the yChat sources to yhttpd sources. - -use strict; -use scripts::modules::file; - -my @delete = ( - 'CHANGES', - 'g++.version', - 'TODO', - 'NEWS', - 'docs', - 'src/chat', - 'src/memb', - 'src/data', - 'src/irc', - 'src/contrib/crypt', - 'src/modl.h', - 'src/modl.cpp', - 'src/mods', - 'obj', - 'mods', - 'html', - 'log/rooms', - 'scripts/makeyhttpd.pl', - 'scripts/mergeconf.pl', - 'bin/ychat', - 'bin/ychat.old', -); - -my @createdir = ( - 'html' -); - -my %substituate = ( - 'ychat' => 'yhttpd', - 'yChat' => 'yhttpd', - 'YCHAT' => 'YHTTPD', - 'CHAT' => 'HTTPD', - 'yhttpd.org' => 'yChat.org', - '//>>' => '' -); - -if ( -d "../yhttpd" ) { - print "Removing ../yhttpd\n"; - system("rm -Rf ../yhttpd"); -} - -print "Creating new ../yhttpd\n"; -system("cp -Rp ../ychat ../yhttpd"); - -chdir("../yhttpd"); -system("gmake clean"); - -my @deletelines; -foreach (@delete) { - next unless -d $_; - foreach (dopen($_)) { - next unless /\.h$/; - push @deletelines, $_; - } -} - -print "Moving html templates\n"; -system("mv html/test.cgi ."); -system("mv html/demo.html ."); -system("mv html/style.css ."); -system("mv html/notfound.html ."); - -print "Removing dirs and files\n->"; -foreach (@delete) { - next unless -f $_ || -d $_; - print " $_"; - system("rm -Rf $_"); -} - -print "\nDeleting CVS directories\n"; -system("find . -name CVS | xargs rm -Rf"); - -print "Creating new dirs\n->"; -foreach (@createdir) { - print " $_"; - system("mkdir $_"); -} - -print "\nRenaming config file\n"; -system("mv etc/ychat.conf etc/yhttpd.conf"); - -print "Moving html templates\n"; -system("mv demo.html html/index.html"); -system("mv test.cgi notfound.html style.css html"); - -print "Editing etc/yhttpd.conf\n"; -&edit_yhttpd_conf(); -print "Removing marked lines of code\n->"; -&remove_marked_lines('.'); -print "\nEdit version numbers\n->"; -&edit_version_numbers('yhttpd/src/msgs.h','yhttpd/README'); - -sub remove_marked_lines { - my $dir = shift; - chdir($dir); - - for (&dopen(".")) - { - next if /^\.+$/; - print " $_"; - - if ( -f $_ ) - { - my @newfile; - my $flag = 0; - - for my $line (fopen($_)) - { - $flag = 1 if $line =~ /\/\/<<\*/; - if ($flag == 0 && $line !~ /\/\/<</) { - for ( @deletelines ) - { - if ($line =~ /$_/) - { - $flag = 3; - last; - } - } - - if ($flag != 3 ) - { - map { $line =~ s/$_/$substituate{$_}/eg } keys %substituate; - push @newfile, $line; - } - - else - { - $flag = 0; - } - } - $flag = 0 if $line =~ /\/\/\*>>/; - } - - &fwrite($_, @newfile); - } - - elsif ( -d $_ ) - { - # Recursive - &remove_marked_lines($_); - } - } - - chdir('..'); -} - -sub edit_yhttpd_conf -{ - my @old = fopen("etc/yhttpd.conf"); - my @new = @old[0..1]; - - my $flag = 0; - for (@old) - { - if ($flag == 0) - { - if (/<category name="httpd">/) - { - $flag = 1; - push @new, $_; - } - } - - else - { - push @new, $_; - } - } - - fwrite("etc/yhttpd.conf", @new); -} - -sub edit_version_numbers -{ - for (@_) - { - print " $_"; - my @file = fopen $_; - for (@file) - { - s/([0-9]+\.[0-9]+)\.[0-9]+(-*)/$1$2/g for @file; - s/[PRE]{0,3}RELEASE/DEVEL/g; - } - fwrite($_,@file); - } -} - -print "\n"; diff --git a/0.8/scripts/modules/file.pm b/0.8/scripts/modules/file.pm deleted file mode 100644 index b11e2b3..0000000 --- a/0.8/scripts/modules/file.pm +++ /dev/null @@ -1,28 +0,0 @@ -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/0.8/scripts/screen.sh b/0.8/scripts/screen.sh deleted file mode 100755 index 6d5b7aa..0000000 --- a/0.8/scripts/screen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -screen -S ychat ./bin/ychat diff --git a/0.8/scripts/setglobvals.pl b/0.8/scripts/setglobvals.pl deleted file mode 100755 index 13288a5..0000000 --- a/0.8/scripts/setglobvals.pl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/perl - -# The yChat 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/0.8/scripts/stats.pl b/0.8/scripts/stats.pl deleted file mode 100755 index 0eea04d..0000000 --- a/0.8/scripts/stats.pl +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/perl - -# The yChat Project (2003 - 2005) -# -# 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|\.pm|\.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/0.8/scripts/version.sh b/0.8/scripts/version.sh deleted file mode 100755 index 2f919ba..0000000 --- a/0.8/scripts/version.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# The yChat Project (2005) -# -# This script shows yChat VERSION-BRANCH Build BUILDNUMBER - -version=`grep VERSION src/build.h | head -n 1 | cut -d'"' -f2` -branch=`grep BRANCH src/build.h | head -n 1 | cut -d'"' -f2` -build=`grep BUILD src/build.h | tail -n 1 | cut -d' ' -f3` -echo "yChat $version-$branch Build $build" - - |
