From 9512041501ad75d8aca9304c6dcb6d2f84b0ad39 Mon Sep 17 00:00:00 2001
From: dirk <dirk@server.tobit.co.uk>
Date: Thu, 14 Jun 2007 23:33:41 +0200
Subject: [PATCH] sort a load of gitignores on a real server

---
 .gitignore         |  16 ++++
 connect/.gitignore |   3 +
 data/.gitignore    |  13 ++++
 filter/.gitignore  |   2 +
 html/.gitignore    |   2 +
 html/home.html     |   3 +-
 html/newprot.html  |   3 +-
 mrtg/.gitignore    |   2 +
 msg/.gitignore     |   3 +
 perl/EphMsg.pm     | 186 +++++++++++++++++++++++++++++++++++++++++++++
 scripts/.gitignore |   3 +
 src/.gitignore     |   2 +
 techdoc/.gitignore |   4 +
 13 files changed, 238 insertions(+), 4 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 connect/.gitignore
 create mode 100644 data/.gitignore
 create mode 100644 filter/.gitignore
 create mode 100644 html/.gitignore
 create mode 100644 mrtg/.gitignore
 create mode 100644 msg/.gitignore
 create mode 100644 perl/EphMsg.pm
 create mode 100644 scripts/.gitignore
 create mode 100644 src/.gitignore
 create mode 100644 techdoc/.gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..1ca43b05
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,16 @@
+local*
+*~
+*.[oa]
+*.tmp
+CVS
+tmp
+*.bak
+.#*
+*#
+*gz
+*zip
+.*
+!.gitignore
+packclus
+tutor*
+db
diff --git a/connect/.gitignore b/connect/.gitignore
new file mode 100644
index 00000000..16112e11
--- /dev/null
+++ b/connect/.gitignore
@@ -0,0 +1,3 @@
+*
+!.gitignore
+!*.issue
diff --git a/data/.gitignore b/data/.gitignore
new file mode 100644
index 00000000..6027afdc
--- /dev/null
+++ b/data/.gitignore
@@ -0,0 +1,13 @@
+bad*
+debug
+*.db
+*.v?
+spots
+user*
+dupefile
+log
+wwv
+wcy
+motd*
+issue
+logout
diff --git a/filter/.gitignore b/filter/.gitignore
new file mode 100644
index 00000000..bbfa3dce
--- /dev/null
+++ b/filter/.gitignore
@@ -0,0 +1,2 @@
+*.pl
+*.pl.o
diff --git a/html/.gitignore b/html/.gitignore
new file mode 100644
index 00000000..4cb187e5
--- /dev/null
+++ b/html/.gitignore
@@ -0,0 +1,2 @@
+mrtg
+client
diff --git a/html/home.html b/html/home.html
index e77c09cd..dd6fcc1f 100644
--- a/html/home.html
+++ b/html/home.html
@@ -25,7 +25,6 @@ Here are various jumping off points:-
 <!-- Standard Footer!! -->                                                              <p>&nbsp;</p>
         <p>                                                                               <FONT COLOR="#606060"><hr></font>
         <font color="#FF0000" size=-2>                                                    Copyright &copy; 1998 by Dirk Koopman G1TLH. All Rights Reserved<br>
-        </font>                                                                         <font color="#000000" size=-2>$Id: index.html,v 1.19 2001/04/17 20:44:11
- g0vgs Exp $
+        </font>                                                                         <font color="#000000" size=-2>$Id$
 </body>
 </html>
diff --git a/html/newprot.html b/html/newprot.html
index 1bb84fe2..a0e40c86 100644
--- a/html/newprot.html
+++ b/html/newprot.html
@@ -208,6 +208,5 @@ sufficient!</p>
 <span class="copy">Copyright © 2001 by Dirk Koopman G1TLH. All Rights
 Reserved</span>
  <br>
-<span class="id">$Id: index.html,v 1.19 2001/04/17 20:44:11 g0vgs Exp
-$</span></body>
+<span class="id">$Id$</span></body>
 </html>
diff --git a/mrtg/.gitignore b/mrtg/.gitignore
new file mode 100644
index 00000000..d6b7ef32
--- /dev/null
+++ b/mrtg/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/msg/.gitignore b/msg/.gitignore
new file mode 100644
index 00000000..16112e11
--- /dev/null
+++ b/msg/.gitignore
@@ -0,0 +1,3 @@
+*
+!.gitignore
+!*.issue
diff --git a/perl/EphMsg.pm b/perl/EphMsg.pm
new file mode 100644
index 00000000..eabba932
--- /dev/null
+++ b/perl/EphMsg.pm
@@ -0,0 +1,186 @@
+#
+# This class is the internal subclass that deals with 'Ephmeral'
+# communications like: querying http servers and other network
+# connected data services and using Msg.pm
+#
+# An instance of this is setup by a command together with a load
+# of callbacks and then runs with a state machine until completion
+#
+# $Id$
+#
+# Copyright (c) 2001 - Dirk Koopman G1TLH
+#
+
+package EphMsg;
+
+use strict;
+use Msg;
+use DXVars;
+use DXUtil;
+use DXDebug;
+use IO::File;
+use IO::Socket;
+use IPC::Open3;
+
+use vars qw(@ISA $deftimeout);
+
+@ISA = qw(Msg);
+$deftimeout = 60;
+
+
+sub new
+{
+
+}
+
+# we probably won't use the normal format
+sub enqueue
+{
+	my ($conn, $msg) = @_;
+	push (@{$conn->{outqueue}}, $msg . $conn->{lineend});
+}
+
+sub dequeue
+{
+	my $conn = shift;
+	my $msg;
+
+	if ($conn->{csort} eq 'ax25' && exists $conn->{msg}) {
+		$conn->{msg} =~ s/\cM/\cJ/g;
+	}
+
+	if ($conn->{state} eq 'WC') {
+		$conn->to_connected($conn->{call}, 'O', $conn->{csort});
+	}
+
+	if ($conn->{msg} =~ /\cJ/) {
+		my @lines =  $conn->{msg} =~ /([^\cM\cJ]*)\cM?\cJ/g;
+		if ($conn->{msg} =~ /\cJ$/) {
+			delete $conn->{msg};
+		} else {
+			$conn->{msg} =~ s/([^\cM\cJ]*)\cM?\cJ//g;
+		}
+
+		while (defined ($msg = shift @lines)) {
+			dbg("connect $conn->{cnum}: $msg") if $conn->{state} ne 'C' && isdbg('connect');
+
+			$msg =~ s/\xff\xfa.*\xff\xf0|\xff[\xf0-\xfe].//g; # remove telnet options
+
+			&{$conn->{rproc}}($conn, $msg);
+		}
+	}
+}
+
+sub to_connected
+{
+	my ($conn, $call, $dir, $sort) = @_;
+	$conn->{state} = 'C';
+	$conn->conns($call);
+	delete $conn->{cmd};
+	$conn->{timeout}->del if $conn->{timeout};
+	delete $conn->{timeout};
+	$conn->nolinger;
+	&{$conn->{rproc}}($conn, "$dir$call|$sort");
+}
+
+
+sub start_connect
+{
+	my $call = shift;
+	my $fn = shift;
+	my $conn = ExtMsg->new(\&main::new_channel);
+	$conn->{outgoing} = 1;
+	$conn->conns($call);
+
+	my $f = new IO::File $fn;
+	push @{$conn->{cmd}}, <$f>;
+	$f->close;
+	$conn->{state} = 'WC';
+	$conn->_dotimeout($deftimeout);
+}
+
+sub _doconnect
+{
+	my ($conn, $sort, $line) = @_;
+	my $r;
+
+	$sort = lc $sort;			# in this case telnet, ax25 or prog
+	dbg("CONNECT $conn->{cnum} sort: $sort command: $line") if isdbg('connect');
+	if ($sort eq 'telnet') {
+		# this is a straight network connect
+		my ($host, $port) = split /\s+/, $line;
+		$port = 23 if !$port;
+		$r = $conn->connect($host, $port);
+		if ($r) {
+			dbg("Connected $conn->{cnum} to $host $port") if isdbg('connect');
+		} else {
+			dbg("***Connect $conn->{cnum} Failed to $host $port $!") if isdbg('connect');
+		}
+	} elsif ($sort eq 'prog') {
+		$r = $conn->start_program($line, $sort);
+	} else {
+		dbg("invalid type of connection ($sort)");
+	}
+	$conn->disconnect unless $r;
+	return $r;
+}
+
+sub _doabort
+{
+	my $conn = shift;
+	my $string = shift;
+	dbg("connect $conn->{cnum}: abort $string") if isdbg('connect');
+	$conn->{abort} = $string;
+}
+
+sub _dotimeout
+{
+	my $conn = shift;
+	my $val = shift;
+	dbg("connect $conn->{cnum}: timeout set to $val") if isdbg('connect');
+	$conn->{timeout}->del if $conn->{timeout};
+	$conn->{timeval} = $val;
+	$conn->{timeout} = Timer->new($val, sub{ &_timedout($conn) });
+}
+
+
+sub _timedout
+{
+	my $conn = shift;
+	dbg("connect $conn->{cnum}: timed out after $conn->{timeval} seconds") if isdbg('connect');
+	$conn->disconnect;
+}
+
+# handle callsign and connection type firtling
+sub _doclient
+{
+	my $conn = shift;
+	my $line = shift;
+	my @f = split /\s+/, $line;
+	my $call = uc $f[0] if $f[0];
+	$conn->conns($call);
+	$conn->{csort} = $f[1] if $f[1];
+	$conn->{state} = 'C';
+	&{$conn->{rproc}}($conn, "O$call|$conn->{csort}");
+	delete $conn->{cmd};
+	$conn->{timeout}->del if $conn->{timeout};
+}
+
+sub _send_file
+{
+	my $conn = shift;
+	my $fn = shift;
+
+	if (-e $fn) {
+		my $f = new IO::File $fn;
+		if ($f) {
+			while (<$f>) {
+				chomp;
+				my $l = $_;
+				dbg("connect $conn->{cnum}: $l") if isdbg('connll');
+				$conn->send_raw($l . $conn->{lineend});
+			}
+			$f->close;
+		}
+	}
+}
diff --git a/scripts/.gitignore b/scripts/.gitignore
new file mode 100644
index 00000000..4b9ad3b3
--- /dev/null
+++ b/scripts/.gitignore
@@ -0,0 +1,3 @@
+*
+!.gitignore
+*.issue
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644
index 00000000..c5926d96
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1,2 @@
+client
+dbg
diff --git a/techdoc/.gitignore b/techdoc/.gitignore
new file mode 100644
index 00000000..1abc35ad
--- /dev/null
+++ b/techdoc/.gitignore
@@ -0,0 +1,4 @@
+*
+!Makefile
+!*.pod
+!.gitignore
-- 
2.43.0