summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:42 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:42 +0200
commit42b79aa5c591dde88e78922a519802f948d9ea60 (patch)
tree92cd4e576656837bb99214d8c09c3fec3201474f /scripts
parent520f54d6219b7c625b4e07463ac393e6982ddab6 (diff)
tagging ychat-0.7.9.4ychat-0.7.9.4
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/astyle.sh2
-rwxr-xr-xscripts/buildnr.pl2
-rwxr-xr-xscripts/config.pl75
-rw-r--r--scripts/makeyhttpd.pl97
-rwxr-xr-xscripts/stats.pl28
5 files changed, 139 insertions, 65 deletions
diff --git a/scripts/astyle.sh b/scripts/astyle.sh
index 4376887..b9dbc45 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=gnu $i
+ astyle --style=ansi -s2 $i
rm -f $i.orig
done
done
diff --git a/scripts/buildnr.pl b/scripts/buildnr.pl
index e691a11..ee3d3e2 100755
--- a/scripts/buildnr.pl
+++ b/scripts/buildnr.pl
@@ -13,7 +13,7 @@ close MSGS;
foreach (@msgs)
{
- if ( /BUILDNR/ )
+ if ( /define BUILDNR/ )
{
s/(BUILDNR )(.+)$/$1.($2+1)/e;
print;
diff --git a/scripts/config.pl b/scripts/config.pl
index 73b3ae5..79b1c49 100755
--- a/scripts/config.pl
+++ b/scripts/config.pl
@@ -18,14 +18,17 @@ END
my $sep = "================================================================\n";
my $stdin;
-for (;;) {
+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") {
+ 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;
@@ -41,37 +44,46 @@ for (;;) {
my @glob = fopen("src/glob.h.org");
my $flag = 0;
-for (@glob) {
- if ( $flag == 0 && /- CONFIG -/ ) {
+for (@glob)
+{
+ if ( $flag == 0 && /- CONFIG -/ )
+ {
print $sep;
$flag = 1;
next;
+ }
- } elsif ( $flag == 1 ) {
- if ( /\*\// ) {
+ elsif ( $flag == 1 )
+ {
+ if ( /\*\// )
+ {
$flag = 2;
+ }
- } else {
+ else
+ {
print;
}
next;
+ }
- } elsif ( $flag == 2 ) {
- if ( /#define (.+) (.+)/ ) {
+ 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] ";
+ print " [Press enter to use default value: $val] ";
$stdin = <STDIN>;
chomp $stdin;
- finish() if $stdin eq "q" or $stdin eq "quit";
-
- unless ( parse_input_value(\$stdin,\$val) ) {
+ unless ( prove_if_default(\$stdin) )
+ {
$stdin = "\"$stdin\"" if $flg == 1;
$_ = "#define $def $stdin\n";
}
@@ -81,28 +93,33 @@ for (@glob) {
next;
}
- elsif ( /#define .+/ ) {
+ elsif ( /#define .+/ )
+ {
my $default = "true";
my $stdin;
- for (;;) {
+ for (;;)
+ {
$default = "false" if /\/\/#define/;
- print " [Press enter to use default value: $default or q to quit] ";
+ print " [Press enter to use default value: $default] ";
$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);
+ if ( $default eq "true" )
+ {
+ $_ = "//$_"
+ unless prove_if_default(\$stdin);
}
- else {
- s/^\/\/// unless parse_input_value(\$stdin,\$default);
+ else
+ {
+ s/^\/\///
+ unless prove_if_default(\$stdin);
}
print "\n";
@@ -112,22 +129,16 @@ for (@glob) {
}
} // for
-finish();
-
-sub finish() {
- fwrite("src/glob.h", @glob);
- exit 0;
-}
+ fwrite("src/glob.h", @glob);
-sub parse_input_value {
+sub prove_if_default
+{
my $val = shift;
- my $def = shift;
-
- if ( $$val eq "" || $$val eq $$def) {
+ 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 2805360..7dd0345 100644
--- a/scripts/makeyhttpd.pl
+++ b/scripts/makeyhttpd.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# The yChat & yhttpd Project (2004)
+# The yChat & yhttpd Project (2004, 2005)
#
# This scripts modifies the yChat sources to yhttpd sources.
@@ -8,18 +8,19 @@ use strict;
use scripts::modules::file;
my @delete = (
- 'ChangeLog',
+ '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',
- 'src/mods/commands',
- 'src/mods/irc',
'obj',
'mods',
'html',
@@ -39,6 +40,7 @@ my %substituate = (
'yChat' => 'yhttpd',
'YCHAT' => 'YHTTPD',
'CHAT' => 'HTTPD',
+ 'yhttpd.org' => 'yChat.org',
'//>>' => ''
);
@@ -75,7 +77,7 @@ foreach (@delete) {
system("rm -Rf $_");
}
-print "Deleting CVS directories\n";
+print "\nDeleting CVS directories\n";
system("find . -name CVS | xargs rm -Rf");
print "Creating new dirs\n->";
@@ -84,50 +86,113 @@ foreach (@createdir) {
system("mkdir $_");
}
-print "Renaming config file\n";
+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 "Removing marked lines of code\n ->";
+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);
- foreach (&dopen(".")) {
+
+ for (&dopen("."))
+ {
next if /^\.+$/;
print " $_";
- if ( -f $_ ) {
+
+ if ( -f $_ )
+ {
my @newfile;
my $flag = 0;
- foreach my $line (fopen($_)) {
+
+ for my $line (fopen($_))
+ {
$flag = 1 if $line =~ /\/\/<<\*/;
if ($flag == 0 && $line !~ /\/\/<</) {
- foreach ( @deletelines ) {
- if ($line =~ /$_/) {
+ for ( @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 $_ ) {
+ }
+
+ elsif ( -d $_ )
+ {
+ # Recursive
&remove_marked_lines($_);
}
}
+
chdir('..');
}
-print "\n";
+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/RELEASE/DEVEL/g;
+ }
+ fwrite($_,@file);
+ }
+}
+
+print "\n";
diff --git a/scripts/stats.pl b/scripts/stats.pl
index 38cc67c..96fbdf1 100755
--- a/scripts/stats.pl
+++ b/scripts/stats.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# The yChat Project (2003 - 2004)
+# The yhttpd Project (2003 - 2004)
#
# This script generates source code and project statistics
@@ -9,6 +9,7 @@ use strict;
use scripts::modules::file;
my %stats;
+my $param = shift;
&recursive(".");
@@ -17,19 +18,16 @@ $stats{"Lines total"} = $stats{"Lines of source"}
+ $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;
- }
+unless (defined $param) {
+
+ print "$_ = " . $stats{$_} . "\n"
+ for ( sort keys %stats );
+
+} else {
+
+ print $stats{$_} . " "
+ for sort keys %stats;
+
}
print "\n";
@@ -78,7 +76,7 @@ sub filestats
$stats{"Number of script files"}++;
$stats{"Lines of scripts"} += countlines($shift);
}
- elsif ( $shift =~ /(\.txt|README|INSTALL|COPYING|NEWS|SNAPSHOT|ChangeLog)$/ )
+ elsif ( $shift =~ /(\.txt|[A-Z]+)$/ )
{
$stats{"Number of text files"}++;
$stats{"Lines of text"} += countlines($shift);