diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:41 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:41 +0200 |
| commit | ae4e87df37ed8904de92c7cf2f3a11128cda2a21 (patch) | |
| tree | 5333f2930165cc6e4083ce15154799626ddb3d03 /scripts | |
| parent | 9cd3ccffd5372dfde3af478e3f832f18db4be3f1 (diff) | |
tagging ychat-0.7.4.1ychat-0.7.4.1
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/astyle.sh | 2 | ||||
| -rwxr-xr-x | scripts/config.sh | 152 | ||||
| -rw-r--r--[-rwxr-xr-x] | scripts/makeyhttpd.pl | 87 | ||||
| -rwxr-xr-x[-rw-r--r--] | scripts/modules/file.pm | 0 | ||||
| -rwxr-xr-x | scripts/stats.pl | 6 | ||||
| -rwxr-xr-x | scripts/version.sh | 6 |
6 files changed, 171 insertions, 82 deletions
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 <<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; + 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 = <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 = <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 index 5a44462..101343a 100755..100644 --- 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 !~ /\/\/<</) { - for ( @deletelines ) - { - if ($line =~ /$_/) - { + foreach ( @deletelines ) { + if ($line =~ /$_/) { $flag = 3; last; } } - - if ($flag != 3 ) - { + if ($flag != 3 ) { map { $line =~ s/$_/$substituate{$_}/eg } keys %substituate; push @newfile, $line; - } - - else - { + } else { $flag = 0; } } $flag = 0 if $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 (/<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/scripts/modules/file.pm b/scripts/modules/file.pm index b11e2b3..b11e2b3 100644..100755 --- a/scripts/modules/file.pm +++ b/scripts/modules/file.pm 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" |
