summaryrefslogtreecommitdiff
path: root/ycurses/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'ycurses/scripts')
-rw-r--r--ycurses/scripts/README6
-rwxr-xr-xycurses/scripts/astyle.sh14
-rwxr-xr-xycurses/scripts/buildnr.pl26
-rwxr-xr-xycurses/scripts/checkperl.sh13
-rwxr-xr-xycurses/scripts/config.pl144
-rw-r--r--ycurses/scripts/modules/file.pm28
-rwxr-xr-xycurses/scripts/screen.sh3
-rwxr-xr-xycurses/scripts/setglobvals.pl32
-rwxr-xr-xycurses/scripts/stats.pl95
-rwxr-xr-xycurses/scripts/version.sh11
10 files changed, 372 insertions, 0 deletions
diff --git a/ycurses/scripts/README b/ycurses/scripts/README
new file mode 100644
index 0000000..e44cc2d
--- /dev/null
+++ b/ycurses/scripts/README
@@ -0,0 +1,6 @@
+All scripts should be run from the ycurses main directory, example:
+
+./scripts/makeycurses.pl
+
+
+A ./makeycurses.pl WILL NOT work :)
diff --git a/ycurses/scripts/astyle.sh b/ycurses/scripts/astyle.sh
new file mode 100755
index 0000000..f986cde
--- /dev/null
+++ b/ycurses/scripts/astyle.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+# The ycurses 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/ycurses/scripts/buildnr.pl b/ycurses/scripts/buildnr.pl
new file mode 100755
index 0000000..7867787
--- /dev/null
+++ b/ycurses/scripts/buildnr.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+# The ycurses Project (2003)
+#
+# This script increases the BUILNR of src/msgs.h each time the ycurses
+# 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/ycurses/scripts/checkperl.sh b/ycurses/scripts/checkperl.sh
new file mode 100755
index 0000000..418087f
--- /dev/null
+++ b/ycurses/scripts/checkperl.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# The ycurses 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/ycurses/scripts/config.pl b/ycurses/scripts/config.pl
new file mode 100755
index 0000000..afb4d76
--- /dev/null
+++ b/ycurses/scripts/config.pl
@@ -0,0 +1,144 @@
+#!/usr/bin/perl
+
+# The ycurses Project (2004, 2005)
+#
+# This script modifues the src/glob.h file.
+
+use strict;
+use scripts::modules::file;
+
+print <<END;
+Welcome to the ycurses 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 ycurses 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;
+
+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] ";
+ $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;
+ }
+ }
+} // for
+
+ 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/ycurses/scripts/modules/file.pm b/ycurses/scripts/modules/file.pm
new file mode 100644
index 0000000..b11e2b3
--- /dev/null
+++ b/ycurses/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 = <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/ycurses/scripts/screen.sh b/ycurses/scripts/screen.sh
new file mode 100755
index 0000000..23d4e66
--- /dev/null
+++ b/ycurses/scripts/screen.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+screen -S ycurses ./bin/ycurses
diff --git a/ycurses/scripts/setglobvals.pl b/ycurses/scripts/setglobvals.pl
new file mode 100755
index 0000000..f0763ac
--- /dev/null
+++ b/ycurses/scripts/setglobvals.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+# The ycurses 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/ycurses/scripts/stats.pl b/ycurses/scripts/stats.pl
new file mode 100755
index 0000000..222c16e
--- /dev/null
+++ b/ycurses/scripts/stats.pl
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+
+# The ycurses Project (2003 - 2004)
+#
+# 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|\.sh|configure.*|Makefile.*)$/ )
+ {
+ $stats{"Number of script files"}++;
+ $stats{"Lines of scripts"} += countlines($shift);
+ }
+ elsif ( $shift =~ /(\.txt|README|INSTALL|COPYING|NEWS|SNAPSHOT|CHANGES|RELEASES)$/ )
+ {
+ $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/ycurses/scripts/version.sh b/ycurses/scripts/version.sh
new file mode 100755
index 0000000..8bb9bdd
--- /dev/null
+++ b/ycurses/scripts/version.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# The ycurses Project (2005)
+#
+# This script shows ycurses VERSION-BRANCH Build BUILDNUMBER
+
+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 "ycurses $version-$branch Build $build"
+
+