From ae4e87df37ed8904de92c7cf2f3a11128cda2a21 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:41 +0200 Subject: tagging ychat-0.7.4.1 --- scripts/astyle.sh | 2 +- scripts/config.sh | 152 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/makeyhttpd.pl | 87 ++++----------------------- scripts/modules/file.pm | 0 scripts/stats.pl | 6 +- scripts/version.sh | 6 +- 6 files changed, 171 insertions(+), 82 deletions(-) create mode 100755 scripts/config.sh mode change 100755 => 100644 scripts/makeyhttpd.pl mode change 100644 => 100755 scripts/modules/file.pm (limited to 'scripts') diff --git a/scripts/astyle.sh b/scripts/astyle.sh index b9dbc45..4376887 100755 --- a/scripts/astyle.sh +++ b/scripts/astyle.sh @@ -8,7 +8,7 @@ do for i in `find . -name "*.$f"` do echo $i - astyle --style=ansi -s2 $i + astyle --style=gnu $i rm -f $i.orig done done diff --git a/scripts/config.sh b/scripts/config.sh new file mode 100755 index 0000000..373fad4 --- /dev/null +++ b/scripts/config.sh @@ -0,0 +1,152 @@ +#!/bin/sh +# The yChat 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/scripts/makeyhttpd.pl b/scripts/makeyhttpd.pl old mode 100755 new mode 100644 index 5a44462..101343a --- a/scripts/makeyhttpd.pl +++ b/scripts/makeyhttpd.pl @@ -8,19 +8,20 @@ use strict; use scripts::modules::file; my @delete = ( - 'CHANGES', + 'ChangeLog', 'g++.version', 'TODO', 'NEWS', 'docs', 'src/chat', - 'src/memb', 'src/data', 'src/irc', 'src/contrib/crypt', 'src/modl.h', 'src/modl.cpp', 'src/mods', + 'src/mods/commands', + 'src/mods/irc', 'obj', 'mods', 'html', @@ -40,7 +41,6 @@ my %substituate = ( 'yChat' => 'yhttpd', 'YCHAT' => 'YHTTPD', 'CHAT' => 'HTTPD', - 'yhttpd.org' => 'yChat.org', '//>>' => '' ); @@ -93,106 +93,43 @@ 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(".")) - { + foreach (&dopen(".")) { next if /^\.+$/; print " $_"; - - if ( -f $_ ) - { + if ( -f $_ ) { my @newfile; my $flag = 0; - - for my $line (fopen($_)) - { + foreach my $line (fopen($_)) { $flag = 1 if $line =~ /\/\/<<\*/; if ($flag == 0 && $line !~ /\/\/<>/; } - &fwrite($_, @newfile); - } - - elsif ( -d $_ ) - { - # Recursive + } elsif ( -d $_ ) { &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 (//) - { - $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/scripts/modules/file.pm b/scripts/modules/file.pm old mode 100644 new mode 100755 diff --git a/scripts/stats.pl b/scripts/stats.pl index 0eea04d..e5cc2b3 100755 --- a/scripts/stats.pl +++ b/scripts/stats.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# The yChat Project (2003 - 2005) +# The yChat Project (2003 - 2004) # # This script generates source code and project statistics @@ -71,12 +71,12 @@ sub filestats { $stats{"Number of gfx files"}++; } - elsif ( $shift =~ /(\.pl|\.pm|\.sh|configure.*|Makefile.*)$/ ) + elsif ( $shift =~ /(\.pl|\.sh|configure.*|Makefile.*)$/ ) { $stats{"Number of script files"}++; $stats{"Lines of scripts"} += countlines($shift); } - elsif ( $shift =~ /(\.txt|[A-Z]+)$/ ) + elsif ( $shift =~ /(\.txt|README|INSTALL|COPYING|NEWS|SNAPSHOT|ChangeLog)$/ ) { $stats{"Number of text files"}++; $stats{"Lines of text"} += countlines($shift); diff --git a/scripts/version.sh b/scripts/version.sh index 2f919ba..46b9fc5 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -3,9 +3,9 @@ # # 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` +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 "yChat $version-$branch Build $build" -- cgit v1.2.3