aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Delmar Davis <don@suspectdevices.com>2013-05-27 13:04:17 -0700
committerDonald Delmar Davis <don@suspectdevices.com>2013-05-27 13:04:17 -0700
commit9745948e82415be8840294df7b6f913271c24e02 (patch)
treeab04dd1f8a533bff7a5999346548c51122c5d777
parentdc504335161da18e06b6baf43ca086de88b44b06 (diff)
Add serproxy source, bin directory and consolidate bikewedge into a single script.
-rw-r--r--RetoolingForOpenSprints/NewClock/NewClock.ino56
-rwxr-xr-x[-rw-r--r--]RetoolingForOpenSprints/bin/bikewedge.py (renamed from RetoolingForOpenSprints/raceinabox/bikewedge.py)68
-rwxr-xr-xRetoolingForOpenSprints/bin/serproxybin0 -> 32432 bytes
-rw-r--r--RetoolingForOpenSprints/bin/serproxy.cfg38
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/.cvsignore5
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/AUTHORS7
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/COPYING340
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/ChangeLog18
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-macosx.txt9
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-unix20
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-win32.txt17
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/Makefile59
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/README163
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/TODO5
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/VERSION1
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/cfglib.c126
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/cfglib.h34
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/config.c106
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/config.h33
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/error.c68
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/error.h26
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/README-wiring.txt55
-rwxr-xr-xRetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.command4
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.xcode/project.pbxproj472
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.xcode/project.xcworkspace/contents.xcworkspacedata4
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/main.c538
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/pipe.c43
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/pipe.h30
-rwxr-xr-xRetoolingForOpenSprints/serproxy-0.1.3.src/serproxybin0 -> 32432 bytes
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/serproxy.cfg38
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/sio.c383
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/sio.h61
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/sock.c206
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/sock.h38
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/string.c70
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/string.h9
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/thread.c149
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h44
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/vlist.c250
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/vlist.h55
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/win32/.cvsignore5
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/win32/serproxy.dsp162
-rw-r--r--RetoolingForOpenSprints/serproxy-0.1.3.src/win32/serproxy.dsw29
43 files changed, 3827 insertions, 17 deletions
diff --git a/RetoolingForOpenSprints/NewClock/NewClock.ino b/RetoolingForOpenSprints/NewClock/NewClock.ino
index 22194c3..4a3a856 100644
--- a/RetoolingForOpenSprints/NewClock/NewClock.ino
+++ b/RetoolingForOpenSprints/NewClock/NewClock.ino
@@ -2,17 +2,46 @@
* rough in of new clock.
* bikewedge proxy provides the number of steps wanted from goldsprints data.
* this should do some pid ling around so that it will be less jerkey.
- * requires the modified stepper motors to do half stepping.
*
- * (c) 2013 Donald Delmar Davis, Suspect Devices
- *
+ * Copyright 2013 (c) Donald Delmar Davis, Suspect Devices,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the <organization> nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <Stepper.h>
-#define MIN_MILLIS_PER_STEP 8
+#define MIN_MILLIS_PER_STEP 20
#define STEPPER_STEPS 200
-#define STEPS_PER_REVOLUTION 2132
+//#define STEPS_PER_REVOLUTION 2132
+#define STEPS_PER_REVOLUTION 1066
#define INBUFFERLENGTH 100
+
+#define BLUE_BCK_BUTTON 17
+#define BLUE_FWD_BUTTON 15
+#define YELLOW_BCK_BUTTON 16
+#define YELLOW_FWD_BUTTON 14
+
+
char inbuffer[INBUFFERLENGTH];
int bufferIndex;
int yellowGoal=0;
@@ -20,14 +49,18 @@ int blueGoal=0;
int yellowPosition=0;
int bluePosition=0;
int stepCount = 0;
-long int lastStepMillis;
+unsigned long int lastStepMillis;
-Stepper blue(STEPPER_STEPS, 8,9,10,11,1);
-Stepper yellow(STEPPER_STEPS, 2,3,4,5,1);
+Stepper blue(STEPPER_STEPS, 8,9,10,11);
+Stepper yellow(STEPPER_STEPS, 2,3,4,5);
void setup() {
// initialize the serial port:
Serial.begin(115200);
+ pinMode(BLUE_BCK_BUTTON,INPUT_PULLUP);
+ pinMode(BLUE_FWD_BUTTON,INPUT_PULLUP);
+ pinMode(YELLOW_BCK_BUTTON,INPUT_PULLUP);
+ pinMode(YELLOW_FWD_BUTTON,INPUT_PULLUP);
}
void loop() {
@@ -62,7 +95,14 @@ void loop() {
}
}
+
if ((millis()-lastStepMillis)>MIN_MILLIS_PER_STEP){
+
+ if (!digitalRead(BLUE_BCK_BUTTON)) bluePosition++;
+ if (!digitalRead(BLUE_FWD_BUTTON)) bluePosition--;
+ if (!digitalRead(YELLOW_BCK_BUTTON)) yellowPosition++;
+ if (!digitalRead(YELLOW_FWD_BUTTON)) yellowPosition--;
+
if ((blueGoal==STEPS_PER_REVOLUTION)&&((bluePosition==0)||(blueGoal==bluePosition))){
blueGoal=bluePosition=0;
}
diff --git a/RetoolingForOpenSprints/raceinabox/bikewedge.py b/RetoolingForOpenSprints/bin/bikewedge.py
index 074f438..5c4ef03 100644..100755
--- a/RetoolingForOpenSprints/raceinabox/bikewedge.py
+++ b/RetoolingForOpenSprints/bin/bikewedge.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
"""------------------------------------------------------------------------bikewedge.py
DESCRIPTION: This code intercepts both sides of opensprints/goldsprintsfx
@@ -6,9 +8,6 @@
This makes it possible to not have a projector that costs more than your rollers.
It also makes it possible to do outdoor or mobile events.
- COPYRIGHT: (c) 2013 Donald Delmar Davis, Suspect Devices, All Rights Reserved.
- This is free software released under modified BSD (details included in source).
-
TECHNICAL: This is a basic combination of the client and server software from the
python in a nutshell book. It makes a lot of assumtions and should do a better
job of recovering when the pile of flash or the serial proxy crashes (which
@@ -20,14 +19,50 @@
It has a lot of number foo (hard coding) in it that should be cleaned up
+ Copyright 2013 (c) Donald Delmar Davis, Suspect Devices,
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the <organization> nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
"""
import socket
import re
+import time
+from subprocess import Popen
+
+#TODO: get rid of the foo
+# * (constants for bike ticks / clock ticks)
+# * hardcoded paths
+
+
+#start up serproxy.
+#TODO: ERROR HANDLING in here.
+p=Popen('./serproxy')
+time.sleep(.5)
isocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
osocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
csocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
isocket.connect(('localhost',5330))
-#isocket.setblocking(0)
isocket.settimeout(0.2)
print "Connected to serproxy"
csocket.connect(('localhost',5332))
@@ -35,6 +70,8 @@ csocket.settimeout(0.2)
print "Connected to clock"
osocket.bind(('',5331))
osocket.listen(1)
+#open goldsprints
+p=Popen('/Applications/GoldsprintsFX_b2.2.app/Contents/MacOS/GoldsprintsFX_b2.2')
try:
while True:
@@ -59,7 +96,8 @@ try:
print "GO!!!!!!!!!!"
csocket.sendall("g\n");
if len(receivedData)==0:
- print "ISSUE WITH CLIENT"
+ print "ISSUE WITH GOLDSPRINTSFX"
+ #TODO kill/restart goldsprintsfx
try:
sentData = isocket.recv(8192)
@@ -76,25 +114,37 @@ try:
if done1>100.00 :
done1=100.00
print "Bike # 1 is ", str(int(done1)), "percent done"
- csocket.sendall("d1:"+str(int(21.32*(done1)))+"\n")
+ csocket.sendall("d1:"+str((int(10.66*(done1)))+0.9)+"\n")
if len(chunk) > 4 and chunk[0]=='1' :
done2=(float(chunk[3:])/1566.0) * 100.00
if done2>100.00 :
done2=100.00
print "Bike # 2 is ", str(int(done2)), "percent done"
- csocket.sendall("d2:"+str(int(21.32*(done2)))+"\n")
+ csocket.sendall("d2:"+str(int((10.66*(done2)))+0.9)+"\n")
if len(sentData)==0:
print "ISSUE WITH SERPROXY"
try:
isocket.sendall("\rv\r\x00")
except socket.error:
+ #TODO kill/restart serproxy
isocket.close()
isocket.connect(('localhost',5330))
break
+
+except KeyboardInterrupt:
+ print "Killed by user.\n...killing any straglers...\n"
+
+except Exception as e:
+ print str(e)
+
finally:
- #need to see if connections is defined....
- connection.close()
+ # serproxy leaves connected children so kill them.
+ p=Popen(['killall', 'serproxy'])
+
+ if connection is not None:
+ connection.close()
+
csocket.close()
osocket.close()
isocket.close()
diff --git a/RetoolingForOpenSprints/bin/serproxy b/RetoolingForOpenSprints/bin/serproxy
new file mode 100755
index 0000000..235d1ba
--- /dev/null
+++ b/RetoolingForOpenSprints/bin/serproxy
Binary files differ
diff --git a/RetoolingForOpenSprints/bin/serproxy.cfg b/RetoolingForOpenSprints/bin/serproxy.cfg
new file mode 100644
index 0000000..0827f7a
--- /dev/null
+++ b/RetoolingForOpenSprints/bin/serproxy.cfg
@@ -0,0 +1,38 @@
+# Config file for serproxy
+# See serproxy's README file for documentation
+
+# Transform newlines coming from the serial port into nils
+# true (e.g. if using Flash) or false
+newlines_to_nils=true
+#newlines_to_nils=false
+
+# Comm ports used
+comm_ports=1,2,3
+serial_device1=/dev/cu.usbserial-A700ew2y
+serial_device2=/dev/cu.usbserial-A601EYSU
+serial_device3=/dev/cu.usbserial-A601EYTR
+#serial_device1=/dev/cu.usbserial-A601EYTR
+#comm_baud=9600
+# Default settings
+comm_baud=115200
+#comm_baud2=9600
+#comm_baud3=9600
+comm_databits=8
+comm_stopbits=1
+comm_parity=none
+
+# Idle time out in seconds
+timeout=30000
+
+# Port 1 settings (sensors)
+net_port1=5330
+
+# Port 2 settings (clock)
+net_port2=5332
+
+# Port 3 settings (race)
+net_port3=5333
+
+# Port 4 settings (ttyS3)
+net_port4=5334
+
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/.cvsignore b/RetoolingForOpenSprints/serproxy-0.1.3.src/.cvsignore
new file mode 100644
index 0000000..4eb10fa
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/.cvsignore
@@ -0,0 +1,5 @@
+*.ncb *.opt *.aps *.plg *.zip *.001 *.gz
+serproxy
+Debug
+Release
+Output
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/AUTHORS b/RetoolingForOpenSprints/serproxy-0.1.3.src/AUTHORS
new file mode 100644
index 0000000..b5b7d9e
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/AUTHORS
@@ -0,0 +1,7 @@
+Developers
+----------
+Stefano Busti <sbusti@nildram.co.uk>
+
+Contributors
+------------
+David A. Mellis <dam@mellis.org>
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/COPYING b/RetoolingForOpenSprints/serproxy-0.1.3.src/COPYING
new file mode 100644
index 0000000..a3f6b12
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/ChangeLog b/RetoolingForOpenSprints/serproxy-0.1.3.src/ChangeLog
new file mode 100644
index 0000000..8452526
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/ChangeLog
@@ -0,0 +1,18 @@
+v0.1.3 - 17/05/2005 - DAM
+
+- Can now specify config file location on command line.
+- Added config file parameter for converting incoming
+ newlines to nils (e.g. for Flash)
+- Can specify the serial device to use for each comm port.
+- Search path for configuration file defaults to the executable directory.
+
+v0.1.2 - 22/12/1999
+
+- Fixed a string allocation bug in the config file parser.
+- Serproxy now displays which ports sockets are bound to
+ when it's compiled with debugging enabled.
+
+V0.1.1 - 14/12/1999
+
+- Cleaned up source code a little.
+
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-macosx.txt b/RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-macosx.txt
new file mode 100644
index 0000000..42f3d54
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-macosx.txt
@@ -0,0 +1,9 @@
+Mac OS X serproxy installation instructions
+-------------------------------------------
+
+1. Follow the UNIX installation instructions in INSTALL-unix
+2. Determine the serial device used by your adapter.
+ Connect your device, then, from the Terminal, type: ls /dev/tty.*
+ and look for something besides /dev/tty.modem
+3. Assign this device to one of the serial_device's in serproxy.cfg
+4. Connect to the net_port associated with the serial_device
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-unix b/RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-unix
new file mode 100644
index 0000000..0c9bcb8
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-unix
@@ -0,0 +1,20 @@
+UNIX serproxy installation instructions
+---------------------------------------
+
+Source distribution
+-------------------
+1. Unpack the sources.
+2. 'cd' into the source directory
+3. Type 'make' to compile
+4. If all goes well, Edit serproxy.cfg to configure the proxy
+5. Run from the source directory: ./serproxy
+
+Binary distribution
+-------------------
+1. Edit serproxy.cfg to configure the proxy
+2. Run from distribution: ./serproxy
+
+
+To use an alternate configuration file, specify it on the command line, e.g.:
+ ./serproxy /etc/serproxy.cfg
+For details on the configuration file format, see the README.
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-win32.txt b/RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-win32.txt
new file mode 100644
index 0000000..baa4878
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/INSTALL-win32.txt
@@ -0,0 +1,17 @@
+WIN32 serproxy installation instructions
+----------------------------------------
+
+From sources:
+
+1. Unpack the sources.
+2. Compile the 'win32/serproxy.dsw' workspace with VC6.
+3. Edit serproxy.cfg to configure the proxy.
+4. Make sure serproxy.cfg is in the same folder as serproxy.exe
+ before running.
+
+
+From pre-compiled binaries:
+
+1. Unzip files to a folder.
+2. Edit serproxy.cfg to configure the proxy.
+
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/Makefile b/RetoolingForOpenSprints/serproxy-0.1.3.src/Makefile
new file mode 100644
index 0000000..2b65b6e
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/Makefile
@@ -0,0 +1,59 @@
+#
+# File: Linux serproxy makefile
+#
+# (C)1999 Stefano Busti
+#
+
+VERSION = `cat VERSION`
+
+SRCS = \
+ main.c sio.c sock.c thread.c vlist.c cfglib.c config.c string.c \
+ pipe.c error.c
+
+OBJS = \
+ main.o sio.o sock.o thread.o vlist.o cfglib.o config.o string.o \
+ pipe.c error.c
+
+CC = gcc
+
+ifdef DEBUG
+CFLAGS = -Wall -g -D__UNIX__ -DDEBUG
+else
+CFLAGS = -Wall -O2 -fomit-frame-pointer -D__UNIX__
+endif
+
+ifdef USE_EF
+LIBS= -lpthread -lefence
+else
+LIBS= -lpthread
+endif
+
+# Build the program
+
+serproxy: $(SRCS) $(OBJS)
+ $(CC) $(CFLAGS) -o serproxy $(OBJS) $(LDFLAGS) $(LIBS)
+
+install: serproxy
+ cp -f serproxy /usr/local/bin
+
+clean:
+ rm -f *.o *~
+
+realclean:
+ rm -f *.o *~ serproxy *.gz *.zip
+
+dep:
+ makedepend -Y -- $(CFLAGS) -- $(SRCS) 2&>/dev/null
+
+# DO NOT DELETE
+
+main.o: sio.h sock.h pipe.h thread.h vlist.h cfglib.h config.h error.h
+sio.o: sio.h
+sock.o: sock.h
+thread.o: thread.h
+vlist.o: vlist.h
+cfglib.o: cfglib.h
+config.o: config.h cfglib.h string.h
+string.o: string.h
+pipe.o: pipe.h sio.h sock.h thread.h
+error.o: error.h
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/README b/RetoolingForOpenSprints/serproxy-0.1.3.src/README
new file mode 100644
index 0000000..b90e546
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/README
@@ -0,0 +1,163 @@
+
+Serproxy
+--------
+
+Author: Stefano Busti (sbusti@nildram.co.uk)
+Modified By: David A. Mellis (dam@mellis.org)
+
+Serproxy is a GPL multi-threaded proxy program for redirecting
+network socket connections to/from serial links, in cases where
+the remote end of the serial link doesn't have a TCP/IP
+stack (eg an embedded or microcontroller system).
+The proxy allows other hosts on the network to communicate
+with the system on the remote end of the serial link.
+When run, it listens for incoming connections on a number of tcp
+ports. Whenever a connection is made data is proxied to and from
+that connection to a serial port.
+
+
+Installation
+------------
+
+See the files INSTALL-unix, INSTALL-macosx.txt, and INSTALL-win32.txt for
+windows/mac/unix installation instructions.
+
+I have only tested the unix version under RedHat Linux 6.0,
+compiling under other unices will probably involve delving into
+the Makefile/source code. Also, the pthread library is needed
+to compile/run.
+
+
+Configuration directives
+------------------------
+
+Serproxy can be configured via the configuration file "serproxy.cfg".
+Comments are allowed by starting a line with the '#' character.
+The configuration file supports the following directives:
+
+---------------------------------------------------------------------
+comm_ports=<list>
+
+Used to configure which comm ports serproxy will use.
+<list> is a comma-separated list of port numbers, where 1 corresponds
+to ttyS0/COM1, 2 corresponds to ttyS1/COM2, etc. (though the serial
+device can be overridden; see serial_device below for details)
+
+Example:
+
+# Use ttyS0 and ttyS2
+comm_ports=1,3
+
+---------------------------------------------------------------------
+comm_baud=<n>
+
+Sets the default baud rate for serial connections.
+
+Example:
+
+# Use 38400 baud
+comm_baud=38400
+
+---------------------------------------------------------------------
+comm_databits=<n>
+
+Sets the default number of data bits.
+
+Example:
+
+# Use 8 data bits
+comm_databits=8
+
+---------------------------------------------------------------------
+comm_stopbits=<n>
+
+Sets the default number of stop bits. Possible values are 1 or 2.
+
+Example:
+
+# Use 1 stop bit
+comm_stopbits=1
+
+---------------------------------------------------------------------
+comm_parity=<p>
+
+Sets the default parity. Possible values are "none", "even" and "odd"
+
+Example:
+
+# No parity
+comm_parity=none
+
+---------------------------------------------------------------------
+timeout=<n>
+
+If a client is idle for more than <n> seconds, he will be
+disconnected.
+
+Example:
+
+# Time out after 300 seconds
+timeout=300
+
+---------------------------------------------------------------------
+newlines_to_nils=<b>
+
+Convert newlines (ASCII character 10, '\n') coming from the serial
+port to nils (ASCII character 0, '\0') before sending over the
+network. Set to "true" to enable, "false" (the default) to disable.
+Useful for reading serial data with Flash, which will not parse data
+on an XmlSocket until receiving a nil.
+
+Example:
+
+# Convert newlines to nils.
+newlines_to_nils=true
+
+---------------------------------------------------------------------
+net_port<x>=<n>
+
+Used to map tcp port numbers to serial port numbers. These define
+which serial ports serproxy tries to open when it detects a tcp
+network connection on a socket for proxying. <x> is the serial
+port number, <n> is the tcp port number.
+
+Example:
+
+# Proxy ttyS0/COM1 to/from tcp port 5331
+net_port1=5331
+
+# Proxy ttyS2/COM3 to/from tcp port 5333
+net_port3=5333
+
+---------------------------------------------------------------------
+serial_device<x>=<f>
+
+Used to map serial port device files to serial port numbers. <x> is
+the serial port number, <f> is serial port device file. Defaults to
+/dev/ttyS<x-1> on Unix, com<x> on Windows.
+
+Example:
+
+# Use /dev/tty.usbserial-1B1 instead of ttyS0/COM1
+serial_device1=/dev/tty.usbserial-1B1
+
+---------------------------------------------------------------------
+Port-specific settings
+
+The baud rate, data bits, stop bits and timeout values can also be
+configured individually for each serial port. This is achieved
+by appending a port number to the end of a particular directive.
+
+Example:
+
+# Override the global settings for ttyS0
+comm_baud1=14400
+comm_parity1=off
+
+# Override the global settings for ttyS2/COM3
+comm_baud3=9600
+comm_databits3=7
+comm_stopbits3=2
+comm_parity3=odd
+timeout3=100
+
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/TODO b/RetoolingForOpenSprints/serproxy-0.1.3.src/TODO
new file mode 100644
index 0000000..c879085
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/TODO
@@ -0,0 +1,5 @@
+- Remote control of DTR/CTS/etc lines.
+- Syslog debugging output under Linux.
+- Win32 version may work better with a WaitForMultipleObjects call rather
+ than the current polling of the serial port (Linux version uses select()).
+- Option to only allow access from specific hosts.
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/VERSION b/RetoolingForOpenSprints/serproxy-0.1.3.src/VERSION
new file mode 100644
index 0000000..b1e80bb
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/VERSION
@@ -0,0 +1 @@
+0.1.3
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/cfglib.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/cfglib.c
new file mode 100644
index 0000000..7321bbc
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/cfglib.c
@@ -0,0 +1,126 @@
+/*
+ * cfglib.c
+ *
+ * Config file parsing routines
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "cfglib.h"
+
+char *cfg_getvalue(const char *key, const char *src);
+
+
+int cfg_readstr(const char *filename,
+ cfg_item_s *item,
+ const char *deflt)
+{
+ char buf[BUFSIZ];
+
+ if (cfg_readbuf(filename, item->key, buf, sizeof(buf)) == NULL) {
+ item->val = strealloc(item->val, deflt);
+ return -1;
+ }
+
+ item->val = strealloc(item->val, buf);
+ return 0;
+}
+
+
+int cfg_readint(const char *filename,
+ cfg_item_i *item,
+ int deflt)
+{
+ char buf[BUFSIZ], *perr;
+
+ if (cfg_readbuf(filename, item->key, buf, sizeof(buf)) == NULL) {
+ item->val = deflt;
+ return -1;
+ }
+
+ item->val = strtol(buf, &perr, 0);
+
+ if ((*perr != '\0') || (*buf == '\0')) {
+ item->val = deflt;
+ return -1;
+ }
+
+ return 0;
+}
+
+char *cfg_readbuf(const char *filename,
+ const char *key,
+ char *value,
+ size_t valuesiz)
+{
+ char *ptr;
+ int len;
+
+ FILE *f = fopen(filename, "rt");
+
+ if (!f)
+ return NULL;
+
+ while (fgets(value, valuesiz, f))
+ {
+ len = strlen(value);
+
+ /* strip crs */
+ if ((len > 0) && (value[len - 1] == '\n')) {
+ value[len - 1] = '\0';
+ len--;
+ }
+
+ /* ignore blank lines and comments */
+ if ((len > 0) && (value[0] != '#')) {
+ if ((ptr = cfg_getvalue(key, value)) != NULL) {
+ memmove(value, ptr, strlen(ptr) + 1);
+ fclose(f);
+ return value;
+ }
+ }
+ }
+ fclose(f);
+ return NULL;
+}
+
+char *cfg_getvalue(const char *key, const char *src)
+{
+ char *peql;
+
+ if ((peql = strchr(src, '=')) != NULL) {
+ int keylen = strlen(key);
+
+ if ((keylen == peql - src) && (strncmp(key, src, keylen) == 0))
+ return peql + 1;
+ }
+
+ return NULL;
+}
+
+char *strealloc(char *dest, const char *s)
+{
+ /*
+ * Don't reallocate if source and destination
+ * point to the same string, otherwise s becomes invalid.
+ */
+ if (dest == s)
+ return dest;
+
+ dest = realloc(dest, strlen(s) + 1);
+ if (dest == NULL)
+ return NULL;
+
+ strcpy(dest, s);
+ return dest;
+}
+
+void strdispose(char *dest)
+{
+ free(dest);
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/cfglib.h b/RetoolingForOpenSprints/serproxy-0.1.3.src/cfglib.h
new file mode 100644
index 0000000..6bb383b
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/cfglib.h
@@ -0,0 +1,34 @@
+#ifndef CFGLIB_H
+#define CFGLIB_H
+
+#include <stdlib.h>
+
+typedef struct
+{
+ char *key;
+ char *val;
+} cfg_item_s;
+
+typedef struct
+{
+ char *key;
+ int val;
+} cfg_item_i;
+
+int cfg_readstr(const char *filename,
+ cfg_item_s *item,
+ const char *deflt);
+
+int cfg_readint(const char *filename,
+ cfg_item_i *item,
+ int deflt);
+
+char *cfg_readbuf(const char *filename,
+ const char *key,
+ char *value,
+ size_t valuesiz);
+
+char *strealloc(char *dest, const char *s);
+void strdispose(char *dest);
+
+#endif /* CFGLIB_H */
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/config.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/config.c
new file mode 100644
index 0000000..4b92b5c
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/config.c
@@ -0,0 +1,106 @@
+/*
+ * config.c
+ *
+ * Configuration module
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "config.h"
+#include "string.h"
+
+cfg_item_i cfg_int_defs[CFG_IEND] = {
+ {"comm_baud", 9600},
+ {"comm_databits", 8},
+ {"comm_stopbits", 1},
+ {"comm_port", 0},
+ {"net_port", 3331},
+ {"timeout", 300}
+};
+
+cfg_item_s cfg_str_defs[CFG_SEND] = {
+ {"comm_parity", "none"},
+ {"net_allow", "all"},
+ {"net_deny", "none"},
+ {"newlines_to_nils", "false"},
+ {"serial_device", ""}
+};
+
+int cfg_init(cfg_s *cfg, int comm_port)
+{
+ int i;
+ char buf[BUFSIZ];
+
+ sprintf(buf, "%d", comm_port);
+
+ for (i = 0; i < CFG_IEND; i++)
+ {
+ cfg->ints[i].key = NULL;
+ str_assign(&cfg->ints[i].key, cfg_int_defs[i].key);
+
+ if (comm_port > 0)
+ str_cat(&cfg->ints[i].key, buf);
+
+ cfg->ints[i].val = cfg_int_defs[i].val;
+ }
+
+ for (i = 0; i < CFG_SEND; i++)
+ {
+ cfg->strs[i].key = NULL;
+ str_assign(&cfg->strs[i].key, cfg_str_defs[i].key);
+
+ if (comm_port > 0)
+ str_cat(&cfg->strs[i].key, buf);
+
+ cfg->strs[i].val = NULL;;
+ str_assign(&cfg->strs[i].val, cfg_str_defs[i].val);
+ }
+
+ return 0;
+}
+
+void cfg_cleanup(cfg_s *cfg)
+{
+ int i;
+
+ for (i = 0; i < CFG_IEND; i++)
+ {
+ str_cleanup(&cfg->ints[i].key);
+ }
+
+ for (i = 0; i < CFG_SEND; i++)
+ {
+ str_cleanup(&cfg->strs[i].key);
+ str_cleanup(&cfg->strs[i].val);
+ }
+}
+
+int cfg_fromfile(cfg_s *cfg, char *filename)
+{
+ int i;
+
+ /* Read integers */
+ for (i = 0; i < CFG_IEND; i++)
+ cfg_readint(filename, &cfg->ints[i], cfg->ints[i].val);
+
+ /* Read strings */
+ for (i = 0; i < CFG_SEND; i++)
+ cfg_readstr(filename, &cfg->strs[i], cfg->strs[i].val);
+
+ return 0;
+}
+
+void cfg_assign(cfg_s *dst, cfg_s *src)
+{
+ int i;
+
+ for (i = 0; i < CFG_IEND; i++)
+ dst->ints[i].val = src->ints[i].val;
+
+ for (i = 0; i < CFG_SEND; i++)
+ str_assign(&dst->strs[i].val, src->strs[i].val);
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/config.h b/RetoolingForOpenSprints/serproxy-0.1.3.src/config.h
new file mode 100644
index 0000000..d4a74c5
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/config.h
@@ -0,0 +1,33 @@
+#include "cfglib.h"
+
+typedef enum
+{
+ CFG_IBAUD,
+ CFG_IDATA,
+ CFG_ISTOP,
+ CFG_IPORT,
+ CFG_INETPORT,
+ CFG_ITIMEOUT,
+ CFG_IEND
+} cfg_int_t;
+
+typedef enum
+{
+ CFG_SPARITY,
+ CFG_SALLOW,
+ CFG_SDENY,
+ CFG_SNEWLINES,
+ CFG_SDEVICE,
+ CFG_SEND
+} cfg_str_t;
+
+typedef struct
+{
+ cfg_item_i ints[CFG_IEND];
+ cfg_item_s strs[CFG_SEND];
+} cfg_s;
+
+int cfg_init(cfg_s *cfg, int comm_port);
+void cfg_cleanup(cfg_s *cfg);
+int cfg_fromfile(cfg_s *cfg, char *filename);
+void cfg_assign(cfg_s *dst, cfg_s *src);
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/error.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/error.c
new file mode 100644
index 0000000..8850a31
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/error.c
@@ -0,0 +1,68 @@
+/*
+ * error.c
+ *
+ * error message routines
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+#include "error.h"
+
+void error(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+}
+
+void errend(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+
+ exit(-1);
+}
+
+void perror2(const char *fmt, ...)
+{
+ char buf[BUFSIZ];
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsprintf(buf, fmt, ap);
+ va_end(ap);
+
+ perror(buf);
+}
+
+void perrend(const char *fmt, ...)
+{
+ char buf[BUFSIZ];
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsprintf(buf, fmt, ap);
+ va_end(ap);
+
+ perror(buf);
+
+ exit(-1);
+}
+
+void dbg_msg(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/error.h b/RetoolingForOpenSprints/serproxy-0.1.3.src/error.h
new file mode 100644
index 0000000..a50bf60
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/error.h
@@ -0,0 +1,26 @@
+#ifndef MYERROR_H
+#define MYERROR_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <errno.h>
+
+void error(const char *fmt, ...);
+void errend(const char *fmt, ...);
+void perror2(const char *fmt, ...);
+void perrend(const char *fmt, ...);
+void dbg_msg(const char *fmt, ...);
+
+#ifdef DEBUG
+#define DBG_MSG1(x) dbg_msg((x))
+#define DBG_MSG2(x,y) dbg_msg((x),(y))
+#define DBG_MSG3(x,y,z) dbg_msg((x),(y),(z))
+#else
+#define DBG_MSG1(x) ;
+#define DBG_MSG2(x,y) ;
+#define DBG_MSG3(x,y,z) ;
+#endif
+
+
+#endif /* MYERROR_H */
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/README-wiring.txt b/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/README-wiring.txt
new file mode 100644
index 0000000..cb4083e
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/README-wiring.txt
@@ -0,0 +1,55 @@
+Using Wiring with Flash (via serproxy)
+--------------------------------------
+Connect the Wiring board to a USB port. Take note of which USB port you use, as different ones have different identifiers.
+
+Launch Wiring. Look in the Tools | Serial Port menu and take note of the identifier corresponding to the serial device for the USB port to which the Wiring board is connected (look for something WITHOUT "modem" in its name).
+
+Open serproxy.cfg in TextEdit.
+
+The serproxy can handle multiple serial devices (each of which corresponds to a USB or serial port). For example:
+
+comm_ports=1,2
+
+tells serproxy to use two comm ports, numbered 1 and 2. To tell serproxy which serial device (from the Wiring menu) corresponds to each comm port, use a line like this:
+
+serial_device1=/dev/tty.usbserial-1B1
+
+This tells serproxy that comm port 1 uses serial device /dev/tty.usbserial-1B1. Change this to the identifier from the Wiring menu.
+
+Then, you assign a network port the comm port:
+
+net_port1=5331
+
+This tells serproxy to listen for connections on port 5331. Set this to whatever port you wish to connect to from Flash (on host "localhost").
+
+To configure another port, repeat the above instructions, plugging the Wiring board into a different USB port (you'll have to quit Wiring, plug into the new USB port, and then relaunch Wiring). Then add the appropriate lines to the serproxy.cfg. For example:
+
+serial_device2=/dev/tty.usbserial-3B1
+net_port2=5332
+
+Will configure comm port 2 to use serial device /dev/tty.usbserial-3B1 and listen for connections from Flash on port 5332.
+
+Each serial device will always correspond to the same network port, so if you plug the Wiring board into a different USB port, you'll need to connect to a different network port from Flash.
+
+If you need more than two comm ports, you'll need to change the comm_ports line. For example:
+
+comm_ports=1,2,3,4
+
+allocates four comm ports numbered 1 through 4.
+
+You need to make sure that the baud rate specified by your Wiring code:
+
+beginSerial(19200);
+
+matches the baud rate specified in serproxy.cfg:
+
+comm_baud=19200
+
+Finally, Flash will not process any incoming data (i.e. call the onData() function of your XMLSocket) until it receives a nil (ASCII code 0, '\0'). If your Wiring code uses newlines (ASCII code 10, '\n') to delimit data (so that, for example, it's easier to read in the Wiring serial monitor, HyperTerminal, zterm, Terminal, etc), you can tell serproxy to convert them into nils:
+
+newlines_to_nils=true
+
+To launch serproxy, simply double-click it. (This version does not require a .command file.)
+--
+David A. Mellis
+7 June 2005
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.command b/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.command
new file mode 100755
index 0000000..7917b32
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.command
@@ -0,0 +1,4 @@
+#!/bin/sh
+cd "`dirname \"$0\"`"
+chmod 755 ./serproxy
+./serproxy serproxy.cfg
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.xcode/project.pbxproj b/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.xcode/project.pbxproj
new file mode 100644
index 0000000..511a758
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.xcode/project.pbxproj
@@ -0,0 +1,472 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 39;
+ objects = {
+ 014CEA520018CE5811CA2923 = {
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ ZERO_LINK = YES;
+ };
+ isa = PBXBuildStyle;
+ name = Development;
+ };
+ 014CEA530018CE5811CA2923 = {
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ ZERO_LINK = NO;
+ };
+ isa = PBXBuildStyle;
+ name = Deployment;
+ };
+//010
+//011
+//012
+//013
+//014
+//080
+//081
+//082
+//083
+//084
+ 08FB7793FE84155DC02AAC07 = {
+ buildSettings = {
+ };
+ buildStyles = (
+ 014CEA520018CE5811CA2923,
+ 014CEA530018CE5811CA2923,
+ );
+ hasScannedForEncodings = 1;
+ isa = PBXProject;
+ mainGroup = 08FB7794FE84155DC02AAC07;
+ projectDirPath = "";
+ targets = (
+ 8DD76FA90486AB0100D96B5E,
+ );
+ };
+ 08FB7794FE84155DC02AAC07 = {
+ children = (
+ 33A5FA1D0851E66E006F91E2,
+ 08FB7795FE84155DC02AAC07,
+ C6A0FF2B0290797F04C91782,
+ 1AB674ADFE9D54B511CA2CBB,
+ );
+ isa = PBXGroup;
+ name = serproxy;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 08FB7795FE84155DC02AAC07 = {
+ children = (
+ 33A5F9E40851DEB2006F91E2,
+ 33A5F9E50851DEB2006F91E2,
+ 33A5F9E60851DEB2006F91E2,
+ 33A5F9E70851DEB2006F91E2,
+ 33A5F9E80851DEB2006F91E2,
+ 33A5F9E90851DEB2006F91E2,
+ 33A5F9EA0851DEB2006F91E2,
+ 33A5F9EB0851DEB2006F91E2,
+ 33A5F9EC0851DEB2006F91E2,
+ 33A5F9ED0851DEB2006F91E2,
+ );
+ isa = PBXGroup;
+ name = Source;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+//080
+//081
+//082
+//083
+//084
+//1A0
+//1A1
+//1A2
+//1A3
+//1A4
+ 1AB674ADFE9D54B511CA2CBB = {
+ children = (
+ 8DD76FB20486AB0100D96B5E,
+ );
+ isa = PBXGroup;
+ name = Products;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+//1A0
+//1A1
+//1A2
+//1A3
+//1A4
+//330
+//331
+//332
+//333
+//334
+ 336FC5F60862E7DA00A796E4 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = "INSTALL-macosx.txt";
+ path = "../INSTALL-macosx.txt";
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 336FC5F80862E7FA00A796E4 = {
+ fileRef = 33A5FA1E0851E685006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9E40851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = cfglib.c;
+ path = ../cfglib.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9E50851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = config.c;
+ path = ../config.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9E60851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = error.c;
+ path = ../error.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9E70851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = main.c;
+ path = ../main.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9E80851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = pipe.c;
+ path = ../pipe.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9E90851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = sio.c;
+ path = ../sio.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9EA0851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = sock.c;
+ path = ../sock.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9EB0851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = string.c;
+ path = ../string.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9EC0851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = thread.c;
+ path = ../thread.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9ED0851DEB2006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ name = vlist.c;
+ path = ../vlist.c;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5F9EE0851DEB2006F91E2 = {
+ fileRef = 33A5F9E40851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9EF0851DEB2006F91E2 = {
+ fileRef = 33A5F9E50851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9F00851DEB2006F91E2 = {
+ fileRef = 33A5F9E60851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9F10851DEB2006F91E2 = {
+ fileRef = 33A5F9E70851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9F20851DEB2006F91E2 = {
+ fileRef = 33A5F9E80851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9F30851DEB2006F91E2 = {
+ fileRef = 33A5F9E90851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9F40851DEB2006F91E2 = {
+ fileRef = 33A5F9EA0851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9F50851DEB2006F91E2 = {
+ fileRef = 33A5F9EB0851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9F60851DEB2006F91E2 = {
+ fileRef = 33A5F9EC0851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5F9F70851DEB2006F91E2 = {
+ fileRef = 33A5F9ED0851DEB2006F91E2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 33A5FA000851E129006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = AUTHORS;
+ path = ../AUTHORS;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5FA010851E129006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = ChangeLog;
+ path = ../ChangeLog;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5FA020851E129006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = COPYING;
+ path = ../COPYING;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5FA030851E129006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = "INSTALL-unix";
+ path = "../INSTALL-unix";
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5FA040851E129006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = "INSTALL-win32.txt";
+ path = "../INSTALL-win32.txt";
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5FA050851E129006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = README;
+ path = ../README;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5FA060851E129006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = TODO;
+ path = ../TODO;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5FA070851E129006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = VERSION;
+ path = ../VERSION;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ 33A5FA1D0851E66E006F91E2 = {
+ children = (
+ 33A5FA1E0851E685006F91E2,
+ );
+ isa = PBXGroup;
+ name = Configuration;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 33A5FA1E0851E685006F91E2 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = text;
+ name = serproxy.cfg;
+ path = ../serproxy.cfg;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+//330
+//331
+//332
+//333
+//334
+//8D0
+//8D1
+//8D2
+//8D3
+//8D4
+ 8DD76FA90486AB0100D96B5E = {
+ buildPhases = (
+ 8DD76FAB0486AB0100D96B5E,
+ 8DD76FAD0486AB0100D96B5E,
+ 8DD76FAF0486AB0100D96B5E,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_PREPROCESSOR_DEFINITIONS = __UNIX__;
+ INSTALL_PATH = "$(HOME)/bin";
+ PRODUCT_NAME = serproxy;
+ };
+ dependencies = (
+ );
+ isa = PBXNativeTarget;
+ name = serproxy;
+ productInstallPath = "$(HOME)/bin";
+ productName = serproxy;
+ productReference = 8DD76FB20486AB0100D96B5E;
+ productType = "com.apple.product-type.tool";
+ };
+ 8DD76FAB0486AB0100D96B5E = {
+ buildActionMask = 2147483647;
+ files = (
+ 33A5F9EE0851DEB2006F91E2,
+ 33A5F9EF0851DEB2006F91E2,
+ 33A5F9F00851DEB2006F91E2,
+ 33A5F9F10851DEB2006F91E2,
+ 33A5F9F20851DEB2006F91E2,
+ 33A5F9F30851DEB2006F91E2,
+ 33A5F9F40851DEB2006F91E2,
+ 33A5F9F50851DEB2006F91E2,
+ 33A5F9F60851DEB2006F91E2,
+ 33A5F9F70851DEB2006F91E2,
+ );
+ isa = PBXSourcesBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8DD76FAD0486AB0100D96B5E = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ isa = PBXFrameworksBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8DD76FAF0486AB0100D96B5E = {
+ buildActionMask = 12;
+ dstPath = "";
+ dstSubfolderSpec = 16;
+ files = (
+ 336FC5F80862E7FA00A796E4,
+ );
+ isa = PBXCopyFilesBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8DD76FB20486AB0100D96B5E = {
+ explicitFileType = "compiled.mach-o.executable";
+ includeInIndex = 0;
+ isa = PBXFileReference;
+ path = serproxy;
+ refType = 3;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+//8D0
+//8D1
+//8D2
+//8D3
+//8D4
+//C60
+//C61
+//C62
+//C63
+//C64
+ C6A0FF2B0290797F04C91782 = {
+ children = (
+ 33A5FA000851E129006F91E2,
+ 33A5FA010851E129006F91E2,
+ 33A5FA020851E129006F91E2,
+ 33A5FA030851E129006F91E2,
+ 33A5FA040851E129006F91E2,
+ 33A5FA050851E129006F91E2,
+ 336FC5F60862E7DA00A796E4,
+ 33A5FA060851E129006F91E2,
+ 33A5FA070851E129006F91E2,
+ );
+ isa = PBXGroup;
+ name = Documentation;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ };
+ rootObject = 08FB7793FE84155DC02AAC07;
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.xcode/project.xcworkspace/contents.xcworkspacedata b/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.xcode/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..94b2795
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/macosx/serproxy.xcode/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+</Workspace>
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/main.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/main.c
new file mode 100644
index 0000000..2411920
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/main.c
@@ -0,0 +1,538 @@
+/*
+ * main.c
+ *
+ * main module for serproxy
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(__UNIX__)
+# include <unistd.h>
+# include <fcntl.h>
+# include <sys/time.h>
+#elif defined(__WIN32__)
+# include <windows.h>
+# include <io.h>
+#endif
+
+#include "string.h"
+#include "sio.h"
+#include "sock.h"
+#include "pipe.h"
+#include "thread.h"
+#include "vlist.h"
+#include "cfglib.h"
+#include "config.h"
+#include "error.h"
+
+int readcfg(char *);
+void cleanup(void);
+int waitclients(void);
+thr_startfunc_t serve_pipe(void *data);
+void debug(void);
+
+#if defined(__UNIX__)
+char defcfgfile[] = "/etc/serproxy.cfg";
+#elif defined(__WIN32__)
+char defcfgfile[] = "serproxy.cfg";
+#endif
+
+cfg_s cfg;
+vlist_s pipes;
+
+int main(int argc, char **argv)
+{
+ char *cfgfile;
+
+ if (sock_start())
+ return -1;
+ vlist_init(&pipes, pipe_destroy);
+ cfg_init(&cfg, 0);
+ atexit(cleanup);
+
+ /* Look for the config file in the executable directory. Windows
+ * uses it as the working directory, so we can use a relative
+ * filename. On UNIX or the Mac, use the executable path and
+ * filename from argv[0].
+ */
+#ifdef __WIN32__
+ cfgfile = defcfgfile;
+#else
+ cfgfile = malloc(strlen(argv[0]) + 4 + 1);
+ strcpy(cfgfile, argv[0]);
+ strcat(cfgfile, ".cfg");
+#endif
+ /* Prefer a config file specified on the command line */
+ readcfg(argc > 1 ? argv[argc - 1] : cfgfile);
+#ifdef DEBUG
+ debug();
+#endif
+ waitclients();
+
+ return 0;
+}
+
+void cleanup(void)
+{
+ cfg_cleanup(&cfg);
+ vlist_cleanup(&pipes);
+ sock_finish();
+}
+
+int readcfg(char *cfgfile)
+{
+ char ports[BUFSIZ], *p;
+ int port;
+ pipe_s *pipe;
+ cfg_s local;
+ serialinfo_s sinfo;
+ char *parity, *newlines;
+
+ /* Read the global config settings */
+ cfg_fromfile(&cfg, cfgfile);
+
+ /* Read the comm port list */
+ if (cfg_readbuf(cfgfile, "comm_ports", ports, sizeof(ports)) == NULL)
+ errend("Couldn't find 'comm_ports' entry in config file '%s'", cfgfile);
+
+ vlist_clear(&pipes);
+
+ /* Parse the comm ports list */
+ p = strtok(ports, ",");
+ while (p)
+ {
+ if (sscanf(p, "%d", &port) > 0)
+ {
+ pipe = malloc(sizeof(pipe_s));
+ //pipe_init(pipe);
+ if (pipe == NULL)
+ perrend("malloc(pipe_s)");
+
+ cfg_init(&local, port);
+
+ /* Copy global settings to those for current pipe */
+ cfg_assign(&local, &cfg);
+
+ /* Set the comm port */
+ local.ints[CFG_IPORT].val = port;
+
+ /* Load this pipe's config */
+ cfg_fromfile(&local, cfgfile);
+
+ /* Try initializing the pipe */
+ if (pipe_init(pipe, local.ints[CFG_INETPORT].val))
+ perrend("pipe_init");
+
+ /* Copy over the rest of the pipe's config */
+ pipe->timeout = local.ints[CFG_ITIMEOUT].val;
+ serialinfo_init(&sinfo);
+ sinfo.port = port;
+ sinfo.baud = local.ints[CFG_IBAUD].val;
+ sinfo.stopbits = local.ints[CFG_ISTOP].val;
+ sinfo.databits = local.ints[CFG_IDATA].val;
+ str_assign(&sinfo.device, local.strs[CFG_SDEVICE].val);
+
+ parity = local.strs[CFG_SPARITY].val;
+
+ if (strcmp(parity, "none") == 0)
+ {
+ sinfo.parity = SIO_PARITY_NONE;
+ }
+ else if (strcmp(parity, "even") == 0)
+ {
+ sinfo.parity = SIO_PARITY_EVEN;
+ }
+ else if (strcmp(parity, "odd") == 0)
+ {
+ sinfo.parity = SIO_PARITY_ODD;
+ }
+ else
+ {
+ errend("Unknown parity string '%s'", parity);
+ }
+
+ newlines = local.strs[CFG_SNEWLINES].val;
+
+ if (strcmp(newlines, "true") == 0)
+ {
+ pipe->newlines = 1;
+ }
+ else if (strcmp(newlines, "false") == 0)
+ {
+ pipe->newlines = 0;
+ }
+ else
+ {
+ errend("Unknown value '%s' for newlines to nils (must be 'true' or 'false')", newlines);
+ }
+
+ if (sio_setinfo(&pipe->sio, &sinfo))
+ errend("Unable to configure comm port %d", port);
+
+ /* Finally add the pipe to the pipes list */
+ vlist_add(&pipes, pipes.tail, pipe);
+
+ serialinfo_cleanup(&sinfo);
+
+ cfg_cleanup(&local);
+ }
+
+ p = strtok(NULL, ",");
+ }
+
+ /* Clean up local cfg struct */
+ cfg_cleanup(&local);
+
+ return 0;
+}
+
+int waitclients(void)
+{
+ int fd_max;
+ fd_set fds;
+ vlist_i *it;
+ pipe_s *pit, *newpipe;
+ tcpsock_s *newsock;
+ thr_t thread;
+
+ fd_max = 0;
+ FD_ZERO(&fds);
+
+ /* Set all sockets to listen */
+ for (it = pipes.head; it; it = it->next)
+ {
+ pit = (pipe_s *)it->data;
+
+ if (tcp_listen(&pit->sock))
+ perror("waitclients() - tcp_listen()");
+ }
+
+ printf("Serproxy - (C)1999 Stefano Busti, (C)2005 David A. Mellis - Waiting for clients\n");
+
+ while (1)
+ {
+ /* Iterate through the pipe list */
+ for (it = pipes.head; it; it = it->next)
+ {
+ pit = (pipe_s *)it->data;
+
+ /* Monitor socket fd of each */
+ FD_SET(pit->sock.fd, &fds);
+
+ /* Track max fd */
+ if (pit->sock.fd > fd_max)
+ fd_max = pit->sock.fd;
+ }
+
+ /* Wait for a read ( == accept() in this case) */
+ if (select(fd_max + 1, &fds, NULL, NULL, NULL) == -1)
+ perrend("waitclients() - select()");
+
+
+ /* Find which sockets are involved */
+ for (it = pipes.head; it; it = it->next)
+ {
+ pit = (pipe_s *)it->data;
+
+ if (FD_ISSET(pit->sock.fd, &fds))
+ {
+ /* Create a new pipe struct for the new thread */
+ newpipe = malloc(sizeof(pipe_s));
+ if (!newpipe)
+ perrend("waitclients() - malloc(pipe_s)");
+
+ sio_init(&newpipe->sio);
+ sio_assign(&newpipe->sio, &pit->sio);
+
+ /* Try to open serial port */
+ if (sio_open(&newpipe->sio))
+ {
+ tcp_refuse(&pit->sock);
+ error("Failed to open comm port - connection refused");
+ free(newpipe);
+ continue;
+ }
+
+ /* Accept the connection */
+ newsock = tcp_accept(&pit->sock);
+
+ /* All ok? */
+ if (newsock)
+ {
+ newpipe->sock = *newsock;
+ free(newsock);
+
+ newpipe->newlines = pit->newlines;
+ newpipe->timeout = pit->timeout;
+ newpipe->mutex = pit->mutex;
+
+ /* Create the server thread */
+ if (thr_create(&thread, 1, serve_pipe, newpipe))
+ {
+ error("Feck - thread creation failed");
+ free(newpipe);
+ }
+ else
+ {
+ fprintf(stderr, "Server thread launched\n");
+ }
+ }
+ else
+ {
+ perror("waitclients() - accept()");
+ free(newpipe);
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/* Main routine for the server threads */
+thr_startfunc_t serve_pipe(void *data)
+{
+ char sio_buf[BUFSIZ], sock_buf[BUFSIZ];
+ int fd_max, sio_fd, sock_fd;
+ int sio_count, sock_count;
+ int res, port;
+ int i;
+ fd_set rfds, wfds;
+ pipe_s *pipe = (pipe_s *)data;
+#if defined(__UNIX__)
+ struct timeval tv = {pipe->timeout, 0};
+ struct timeval *ptv = &tv;
+#elif defined(__WIN32__)
+ struct timeval tv = {0,10000};
+ struct timeval *ptv = &tv;
+ DWORD msecs = 0, timeout = pipe->timeout * 1000;
+#endif
+
+ port = pipe->sio.info.port;
+
+ /* Only proceed if we can lock the mutex */
+ if (thr_mutex_trylock(pipe->mutex))
+ {
+ error("server(%d) - resource is locked", port);
+ }
+ else
+ {
+
+ sio_count = 0;
+ sock_count = 0;
+ sio_fd = pipe->sio.fd;
+ sock_fd = pipe->sock.fd;
+#if defined(__UNIX__)
+ fd_max = sio_fd > sock_fd ? sio_fd : sock_fd;
+#elif defined(__WIN32__)
+ fd_max = sock_fd;
+ msecs = GetTickCount();
+#endif
+ fprintf(stderr, "server(%d) - thread started\n", port);
+
+ while (1)
+ {
+ FD_ZERO(&rfds);
+ FD_ZERO(&wfds);
+
+#if defined(__UNIX__)
+ /* Always ask for read notification to check for EOF */
+ FD_SET(sio_fd, &rfds);
+ /* Only ask for write notification if we have something to write */
+ if (sock_count > 0)
+ FD_SET(sio_fd, &wfds);
+
+ /* Reset timeout values */
+ tv.tv_sec = pipe->timeout;
+ tv.tv_usec = 0;
+
+#endif
+ /* Always ask for read notification to check for EOF */
+ FD_SET(sock_fd, &rfds);
+ /* Only ask for write notification if we have something to write */
+ if (sio_count > 0)
+ FD_SET(sock_fd, &wfds);
+
+ //DBG_MSG2("server(%d) waiting for events", port);
+
+ /* Wait for read/write events */
+ res = select(fd_max + 1, &rfds, &wfds, NULL, ptv);
+ if (res == -1)
+ {
+ perror2("server(%d) - select()", port);
+ break;
+ }
+#if defined(__UNIX__)
+
+ /* Use the select result for timeout detection */
+ if (res == 0)
+ {
+ fprintf(stderr, "server(%d) - timed out\n", port);
+ break;
+ }
+
+ /* Input from serial port? */
+ if (FD_ISSET(sio_fd, &rfds))
+#elif defined(__WIN32__)
+
+ if (1)
+#endif
+ {
+ /* Only read input if buffer is empty */
+ if (sio_count == 0)
+ {
+ sio_count = sio_read(&pipe->sio, sio_buf, sizeof(sio_buf));
+ if (sio_count <= 0)
+ {
+ if (sio_count == 0)
+ {
+#if defined(__UNIX__)
+ fprintf(stderr, "server(%d) - EOF from sio\n", port);
+ break;
+#endif
+ }
+ else
+ {
+ perror2("server(%d) - read(sio)", port);
+ break;
+ }
+ }
+ else
+ {
+ DBG_MSG3("server(%d) - read %d bytes from sio", port, sio_count);
+ }
+ }
+ }
+
+ if (pipe->newlines)
+ {
+ /* Replace incoming newlines with nils. */
+ for (i = 0; i < sio_count; i++)
+ {
+ if (sio_buf[i] == '\n')
+ sio_buf[i] = 0;
+ }
+ }
+
+ /* Write to socket possible? */
+ if (FD_ISSET(sock_fd, &wfds))
+ {
+ if (sio_count > 0)
+ {
+ if ((res = tcp_write(&pipe->sock, sio_buf, sio_count)) < 0)
+ {
+ perror2("server(%d) - write(sock)", port);
+ break;
+ }
+ DBG_MSG3("server(%d) - Wrote %d bytes to sock", port, res);
+ sio_count -= res;
+ }
+ }
+
+
+ /* Input from socket? */
+ if (FD_ISSET(sock_fd, &rfds))
+ {
+ /* Only read input if buffer is empty */
+ if (sock_count == 0)
+ {
+ sock_count = tcp_read(&pipe->sock, sock_buf, sizeof(sock_buf));
+ if (sock_count <= 0)
+ {
+ if (sock_count == 0)
+ {
+ fprintf(stderr, "server(%d) - EOF from sock\n", port);
+ break;
+ }
+ else
+ {
+ perror2("server(%d) - read(sock)", port);
+ break;
+ }
+ }
+ DBG_MSG3("server(%d) - read %d bytes from sock", port, sock_count);
+ }
+ }
+
+#if defined(__UNIX__)
+ /* Write to serial port possible? */
+ if (FD_ISSET(sio_fd, &wfds))
+#elif defined(__WIN32__)
+
+ /* No socket IO performed? */
+ if ((!FD_ISSET(sock_fd, &rfds)) && (!FD_ISSET(sock_fd, &wfds)))
+ {
+ /* Break on a time out */
+ if (GetTickCount() - msecs > timeout)
+ {
+ fprintf(stderr, "server(%d) - timed out\n", port);
+ break;
+ }
+ }
+ else
+ {
+ msecs = GetTickCount();
+ }
+
+ if (1)
+#endif
+ {
+ if (sock_count > 0)
+ {
+ if ((res = sio_write(&pipe->sio, sock_buf, sock_count)) < 0)
+ {
+ perror2("server(%d) - write(sio)", port);
+ break;
+ }
+ DBG_MSG3("server(%d) - wrote %d bytes to sio", port, res);
+ sock_count -= res;
+ }
+ }
+
+ }
+
+ /* Unlock our mutex */
+ thr_mutex_unlock(pipe->mutex);
+ }
+
+ fprintf(stderr, "server(%d) exiting\n", port);
+
+ /* Clean up - don't call pipe_cleanup() as that would nuke our mutex */
+ sio_cleanup(&pipe->sio);
+ tcp_cleanup(&pipe->sock);
+
+
+ free(pipe);
+
+ thr_exit((thr_exitcode_t)0);
+
+ return (thr_exitcode_t)0;
+}
+
+void debug(void)
+{
+ vlist_i *it;
+ pipe_s *pit;
+ int i = 1;
+
+ fprintf(stderr, "pipes:\n\n");
+ vlist_debug(&pipes, stderr);
+
+ for (it = pipes.head; it; it = it->next)
+ {
+ pit = (pipe_s *)it->data;
+
+ fprintf(stderr, "sio[%d]:\n\n", i);
+ sio_debug(&pit->sio, stderr);
+
+ fprintf(stderr, "sock[%d]:\n\n", i);
+ tcp_debug(&pit->sock, stderr);
+
+ i++;
+ }
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/pipe.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/pipe.c
new file mode 100644
index 0000000..48a82f3
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/pipe.c
@@ -0,0 +1,43 @@
+/*
+ * pipe.c
+ *
+ * serial port <-> TCP/IP piping
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+#include <stdlib.h>
+
+#include "pipe.h"
+
+int pipe_init(pipe_s *pipe, int sock_port)
+{
+ if (sio_init(&pipe->sio))
+ return -1;
+
+ if (tcp_init(&pipe->sock, sock_port))
+ return -1;
+
+ pipe->mutex = malloc(sizeof(thr_mutex_t));
+ *(pipe->mutex) = thr_mutex_create();
+
+ return 0;
+}
+
+void pipe_cleanup(pipe_s *pipe)
+{
+ sio_cleanup(&pipe->sio);
+ tcp_cleanup(&pipe->sock);
+ thr_mutex_unlock(pipe->mutex);
+ thr_mutex_destroy(pipe->mutex);
+ free(pipe->mutex);
+}
+
+void pipe_destroy(void *data)
+{
+ pipe_s *pipe = (pipe_s *)data;
+
+ pipe_cleanup(pipe);
+ free(pipe);
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/pipe.h b/RetoolingForOpenSprints/serproxy-0.1.3.src/pipe.h
new file mode 100644
index 0000000..a0786ab
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/pipe.h
@@ -0,0 +1,30 @@
+#ifndef PIPE_H
+#define PIPE_H
+
+#include "sio.h"
+#include "sock.h"
+#include "thread.h"
+
+typedef struct
+{
+ /* Serial port */
+ sio_s sio;
+
+ /* Socket */
+ tcpsock_s sock;
+
+ /* Mutex lock */
+ thr_mutex_t *mutex;
+
+ /* Time out in seconds */
+ int timeout;
+
+ /* Convert newlines from the serial port to nils? */
+ int newlines;
+} pipe_s;
+
+int pipe_init(pipe_s *pipe, int sock_port);
+void pipe_cleanup(pipe_s *pipe);
+void pipe_destroy(void *data);
+
+#endif /* PIPE_H */
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/serproxy b/RetoolingForOpenSprints/serproxy-0.1.3.src/serproxy
new file mode 100755
index 0000000..235d1ba
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/serproxy
Binary files differ
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/serproxy.cfg b/RetoolingForOpenSprints/serproxy-0.1.3.src/serproxy.cfg
new file mode 100644
index 0000000..0827f7a
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/serproxy.cfg
@@ -0,0 +1,38 @@
+# Config file for serproxy
+# See serproxy's README file for documentation
+
+# Transform newlines coming from the serial port into nils
+# true (e.g. if using Flash) or false
+newlines_to_nils=true
+#newlines_to_nils=false
+
+# Comm ports used
+comm_ports=1,2,3
+serial_device1=/dev/cu.usbserial-A700ew2y
+serial_device2=/dev/cu.usbserial-A601EYSU
+serial_device3=/dev/cu.usbserial-A601EYTR
+#serial_device1=/dev/cu.usbserial-A601EYTR
+#comm_baud=9600
+# Default settings
+comm_baud=115200
+#comm_baud2=9600
+#comm_baud3=9600
+comm_databits=8
+comm_stopbits=1
+comm_parity=none
+
+# Idle time out in seconds
+timeout=30000
+
+# Port 1 settings (sensors)
+net_port1=5330
+
+# Port 2 settings (clock)
+net_port2=5332
+
+# Port 3 settings (race)
+net_port3=5333
+
+# Port 4 settings (ttyS3)
+net_port4=5334
+
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/sio.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/sio.c
new file mode 100644
index 0000000..b14c784
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/sio.c
@@ -0,0 +1,383 @@
+/*
+ * sio.c
+ *
+ * serial port routines
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "sio.h"
+#include "string.h"
+
+#if defined(SIO_TTY)
+# include <unistd.h>
+# include <termios.h>
+#elif defined(SIO_WIN32)
+# include <io.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+void serialinfo_init(serialinfo_s *sinfo)
+{
+ sinfo->device = NULL;
+ sinfo->port = 1;
+ sinfo->baud = 9600;
+ sinfo->parity = SIO_PARITY_NONE;
+ sinfo->stopbits = 1;
+ sinfo->databits = 8;
+}
+
+void serialinfo_assign(serialinfo_s *dst, serialinfo_s *src)
+{
+ dst->port = src->port;
+ dst->baud = src->baud;
+ dst->parity = src->parity;
+ dst->stopbits = src->stopbits;
+ dst->databits = src->databits;
+ str_assign(&dst->device, src->device);
+}
+
+void serialinfo_cleanup(serialinfo_s *sinfo)
+{
+ str_cleanup(&sinfo->device);
+}
+
+int sio_init(sio_s *sio)
+{
+ sio->fd = 0;
+
+ serialinfo_init(&sio->info);
+
+ return 0;
+}
+
+void sio_cleanup(sio_s *sio)
+{
+ if (sio_isopen(sio))
+ sio_close(sio);
+
+ serialinfo_cleanup(&sio->info);
+}
+
+void sio_assign(sio_s *dst, sio_s *src)
+{
+ dst->fd = src->fd;
+#ifdef SIO_WIN32
+ dst->hComm = src->hComm;
+#endif
+ serialinfo_assign(&dst->info, &src->info);
+}
+
+int sio_open(sio_s *sio)
+{
+ char filename[20];
+
+#if defined(SIO_TTY)
+ struct termios t;
+ int fd, c_stop, c_data, i_parity, c_parity;
+ speed_t speed;
+
+ if (sio_isopen(sio))
+ return -1;
+
+ if (sio->info.device && strlen(sio->info.device) > 0)
+ {
+ fd = open(sio->info.device, O_RDWR);
+ }
+ else
+ {
+ sprintf(filename, "/dev/ttyS%hd", sio->info.port - 1);
+ fd = open(filename, O_RDWR);
+ }
+
+ if (fd == -1)
+ return -1;
+
+ if (tcgetattr(fd, &t))
+ {
+ close(fd);
+ return -1;
+ }
+
+ switch(sio->info.baud)
+ {
+ case 0: speed = B0; break;
+ case 50: speed = B50; break;
+ case 75: speed = B75; break;
+ case 110: speed = B110; break;
+ case 134: speed = B134; break;
+ case 150: speed = B150; break;
+ case 300: speed = B300; break;
+ case 600: speed = B600; break;
+ case 1200: speed = B1200; break;
+ case 1800: speed = B1800; break;
+ case 2400: speed = B2400; break;
+ case 4800: speed = B4800; break;
+ case 9600: speed = B9600; break;
+ case 19200: speed = B19200; break;
+ case 38400: speed = B38400; break;
+ case 57600: speed = B57600; break;
+ case 115200: speed = B115200; break;
+ case 230400: speed = B230400; break;
+ default: speed = B0; break;
+ }
+
+ if (speed == B0)
+ {
+ close(fd);
+ return -1;
+ }
+
+ if (cfsetospeed(&t, speed))
+ {
+ close(fd);
+ return -1;
+ }
+
+ if (cfsetispeed(&t, speed))
+ {
+ close(fd);
+ return -1;
+ }
+
+ switch(sio->info.stopbits)
+ {
+ case 1: c_stop = 0; break;
+ case 2: c_stop = CSTOPB; break;
+ default: close(fd); return -1;
+ }
+
+ switch(sio->info.databits)
+ {
+ case 5: c_data = CS5; break;
+ case 6: c_data = CS6; break;
+ case 7: c_data = CS7; break;
+ case 8: c_data = CS8; break;
+ default: close(fd); return -1;
+ }
+
+ switch(sio->info.parity)
+ {
+ case SIO_PARITY_NONE:
+ i_parity = IGNPAR;
+ c_parity = 0;
+ break;
+
+ case SIO_PARITY_EVEN:
+ i_parity = INPCK;
+ c_parity = PARENB;
+ break;
+
+ case SIO_PARITY_ODD:
+ i_parity = INPCK;
+ c_parity = PARENB | PARODD;
+ break;
+
+ default:
+ close(fd);
+ return -1;
+ }
+
+ if (tcsetattr(fd, TCSANOW, &t))
+ {
+ close(fd);
+ return -1;
+ }
+
+ sio->fd = fd;
+
+ return 0;
+#elif defined(SIO_WIN32)
+ int fd;
+ HANDLE hComm;
+ DCB dcb;
+ COMMTIMEOUTS cto = { MAXDWORD, 0, 0, 4, 4 };
+
+ if (sio_isopen(sio))
+ return -1;
+
+ if (sio->info.device && strlen(sio->info.device) > 0)
+ {
+ fd = _open(sio->info.device, _O_RDWR);
+ }
+ else
+ {
+ sprintf(filename, "COM%hd", sio->info.port);
+ fd = _open(filename, _O_RDWR);
+ }
+
+ if (fd == -1)
+ return -1;
+
+ /* Grab the fd's windows handle */
+ hComm = (HANDLE)_get_osfhandle(fd);
+
+ if (!SetCommTimeouts(hComm, &cto))
+ {
+ _close(fd);
+ return -1;
+ }
+
+ dcb.DCBlength = sizeof(dcb);
+ memset(&dcb, sizeof(dcb), 0);
+
+ if (!GetCommState(hComm, &dcb))
+ {
+ _close(fd);
+ return -1;
+ }
+
+ dcb.BaudRate = sio->info.baud;
+ //dcb.fBinary = TRUE;
+ dcb.fParity = (sio->info.parity == SIO_PARITY_NONE) ? FALSE : TRUE;
+ dcb.fOutxCtsFlow = FALSE;
+ dcb.fOutxDsrFlow = FALSE;
+ dcb.fDtrControl = DTR_CONTROL_DISABLE;
+ dcb.fDsrSensitivity = FALSE;
+ dcb.fTXContinueOnXoff = FALSE;
+ dcb.fOutX = FALSE;
+ dcb.fInX = FALSE;
+ dcb.fErrorChar = FALSE;
+ dcb.fNull = FALSE;
+ dcb.fRtsControl = RTS_CONTROL_DISABLE;
+ dcb.fAbortOnError = FALSE;
+ dcb.ByteSize = sio->info.databits;
+
+ switch (sio->info.parity)
+ {
+ case SIO_PARITY_NONE: dcb.Parity = 0; break;
+ case SIO_PARITY_ODD: dcb.Parity = 1; break;
+ case SIO_PARITY_EVEN: dcb.Parity = 2; break;
+ default: _close(fd); return -1;
+ }
+
+ switch (sio->info.stopbits)
+ {
+ case 1: dcb.StopBits = 0; break;
+ case 2: dcb.StopBits = 2; break;
+ default: _close(fd); return -1;
+ }
+
+ if (!SetCommState(hComm, &dcb))
+ {
+ _close(fd);
+ return -1;
+ }
+
+ sio->fd = fd;
+ sio->hComm = hComm;
+
+ return 0;
+#endif
+}
+
+void sio_close(sio_s *sio)
+{
+#if defined(SIO_TTY)
+ close(sio->fd);
+ sio->fd = 0;
+#elif defined(SIO_WIN32)
+ _close(sio->fd);
+ sio->fd = 0;
+ sio->hComm = INVALID_HANDLE_VALUE;
+#endif
+}
+
+#ifdef SIO_TTY
+__inline
+#endif
+int sio_read(sio_s *sio, void *buf, size_t count)
+{
+#if defined(SIO_TTY)
+ return read(sio->fd, buf, count);
+#elif defined(SIO_WIN32)
+ int res;
+ if (!ReadFile(sio->hComm, buf, count, &res, NULL))
+ return -1;
+ return res;
+#endif
+}
+
+#ifdef SIO_TTY
+__inline
+#endif
+int sio_write(sio_s *sio, void *buf, size_t count)
+{
+#if defined(SIO_TTY)
+ return write(sio->fd, buf, count);
+#elif defined(SIO_WIN32)
+ int res;
+ if (!WriteFile(sio->hComm, buf, count, &res, NULL))
+ return -1;
+ return res;
+#endif
+}
+
+int sio_isopen(sio_s *sio)
+{
+ return (sio->fd != 0);
+}
+
+int sio_setinfo(sio_s *sio, serialinfo_s *info)
+{
+ serialinfo_assign(&sio->info, info);
+ return 0;
+}
+
+void sio_flush(sio_s *sio, int dir)
+{
+ if (sio_isopen(sio))
+ {
+#if defined(SIO_TTY)
+ switch(dir)
+ {
+ case SIO_IN: tcflush(sio->fd, TCIFLUSH); break;
+ case SIO_OUT: tcflush(sio->fd, TCOFLUSH); break;
+ case SIO_IN | SIO_OUT: tcflush(sio->fd, TCIOFLUSH); break;
+ }
+#elif defined(SIO_WIN32)
+ DWORD flags = 0;
+
+ if (sio_isopen(sio))
+ {
+ if (dir & SIO_IN)
+ flags |= PURGE_RXCLEAR | PURGE_RXABORT;
+ if (dir & SIO_OUT)
+ flags |= PURGE_TXCLEAR | PURGE_TXABORT;
+ }
+
+ PurgeComm(sio->hComm, flags);
+#endif
+ }
+}
+
+void sio_drain(sio_s *sio)
+{
+ if (sio_isopen(sio))
+ {
+#if defined(SIO_TTY)
+ tcdrain(sio->fd);
+#elif defined(SIO_WIN32)
+ FlushFileBuffers(sio->hComm);
+#endif
+ }
+}
+
+void sio_debug(sio_s *sio, FILE *f)
+{
+ fprintf(f, "sio {\n");
+ fprintf(f, "\tfd = %d\n", sio_isopen(sio) ? sio->fd : 0);
+ fprintf(f, "\tport = %d\n", sio->info.port);
+ fprintf(f, "\tbaud = %ld\n", sio->info.baud);
+ fprintf(f, "\tparity = %d\n", sio->info.parity);
+ fprintf(f, "\tstopbits = %d\n", sio->info.stopbits);
+ fprintf(f, "\tdatabits = %d\n", sio->info.databits);
+ fprintf(f, "\topen = %d\n", sio_isopen(sio));
+ fprintf(f, "}\n\n");
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/sio.h b/RetoolingForOpenSprints/serproxy-0.1.3.src/sio.h
new file mode 100644
index 0000000..591a81d
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/sio.h
@@ -0,0 +1,61 @@
+#ifndef SIO_H
+#define SIO_H
+
+#define SIO_OUT 0x01
+#define SIO_IN 0x02
+
+#define SIO_PARITY_NONE 0
+#define SIO_PARITY_EVEN 1
+#define SIO_PARITY_ODD 2
+
+#include <stdio.h>
+
+#if defined(__WIN32__)
+# define SIO_WIN32
+//# define SIO_TTY
+#elif defined(__UNIX__)
+# define SIO_TTY
+#endif
+
+#if defined(SIO_WIN32)
+# include <windows.h>
+#endif
+
+typedef struct
+{
+ short port;
+ long baud;
+ int parity;
+ int stopbits;
+ int databits;
+ char *device;
+} serialinfo_s;
+
+void serialinfo_init(serialinfo_s *sinfo);
+void serialinfo_cleanup(serialinfo_s *sinfo);
+void serialinfo_assign(serialinfo_s *dst, serialinfo_s *src);
+
+typedef struct
+{
+ int fd;
+#ifdef SIO_WIN32
+ HANDLE hComm;
+#endif
+ serialinfo_s info;
+} sio_s;
+
+int sio_init(sio_s *sio);
+void sio_cleanup(sio_s *sio);
+void sio_assign(sio_s *dst, sio_s *src);
+
+int sio_open(sio_s *sio);
+void sio_close(sio_s *sio);
+int sio_read(sio_s *sio, void *buf, size_t count);
+int sio_write(sio_s *sio, void *buf, size_t count);
+int sio_isopen(sio_s *sio);
+int sio_setinfo(sio_s *sio, serialinfo_s *info);
+void sio_flush(sio_s *sio, int dir);
+void sio_drain(sio_s *sio);
+void sio_debug(sio_s *sio, FILE *f);
+
+#endif /* SIO_H */
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/sock.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/sock.c
new file mode 100644
index 0000000..9b6980b
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/sock.c
@@ -0,0 +1,206 @@
+/*
+ * sock.c
+ *
+ * socket routines
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+
+#include <stdlib.h>
+
+#include "sock.h"
+
+#if defined(SOCK_BSD)
+# include <unistd.h>
+# include <sys/types.h>
+# include <sys/socket.h>
+# include <netdb.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <fcntl.h>
+# include <sys/ioctl.h>
+#elif defined(SOCK_WIN)
+# define ioctl ioctlsocket
+#endif
+
+int sock_start(void)
+{
+#if defined(SOCK_BSD)
+ return 0;
+#elif defined (SOCK_WIN)
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ wVersionRequested = MAKEWORD(1, 1);
+ return WSAStartup(wVersionRequested, &wsaData);
+#endif
+}
+
+
+void sock_finish(void)
+{
+#if defined(SOCK_WIN)
+ WSACleanup();
+#endif
+}
+
+int tcp_init(tcpsock_s *sock, int port)
+{
+ int optval = 1;
+
+ //struct protoent *ent;
+ struct sockaddr_in name;
+
+ //ent = getprotobyname("TCP");
+
+ //if (!ent)
+ // return -1;
+
+ sock->fd = socket(AF_INET, SOCK_STREAM, 0/*ent->p_proto*/);
+
+ if (sock->fd < 0)
+ return -1;
+
+ /* Allow reuse of existing TIME_WAIT sockets */
+ if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR,
+ (void *)&optval, sizeof(optval)))
+ {
+ tcp_cleanup(sock);
+ return -1;
+ }
+
+ if (ioctl(sock->fd, FIONBIO, &optval))
+ {
+ tcp_cleanup(sock);
+ return -1;
+ }
+
+ name.sin_family = AF_INET;
+ name.sin_port = htons(port);
+ name.sin_addr.s_addr = htonl(INADDR_ANY);
+
+ if (bind(sock->fd, (struct sockaddr *)&name, sizeof(name)) < 0)
+ {
+ tcp_cleanup(sock);
+ return -1;
+ }
+
+ sock->port = port;
+
+ return 0;
+}
+
+void tcp_cleanup(tcpsock_s *sock)
+{
+#if defined(SOCK_BSD)
+ close(sock->fd);
+#elif defined(SOCK_WIN)
+ closesocket(sock->fd);
+#endif
+}
+
+int tcp_listen(tcpsock_s *sock)
+{
+ return listen(sock->fd, 0);
+}
+
+tcpsock_s *tcp_accept(tcpsock_s *sock)
+{
+ struct sockaddr addr;
+ int addrlen;
+ int fd;
+ tcpsock_s *newsock;
+
+ addrlen = sizeof(addr);
+
+ fd = accept(sock->fd, &addr, &addrlen);
+
+ if (fd < 0)
+ return NULL;
+
+ newsock = malloc(sizeof(tcpsock_s));
+
+ if (newsock)
+ newsock->fd = fd;
+
+ return newsock;
+}
+
+void tcp_refuse(tcpsock_s *sock)
+{
+ tcpsock_s *temp = tcp_accept(sock);
+
+ if (temp)
+ {
+ /* Disconnect immediately */
+ tcp_disconnect(temp);
+
+ /* Clean up */
+ tcp_cleanup(temp);
+ free(temp);
+ }
+}
+
+int tcp_connect(tcpsock_s *sock, char *host, int port)
+{
+ struct sockaddr_in name;
+ struct hostent *hostinfo;
+ u_long addr;
+
+ name.sin_family = AF_INET;
+ name.sin_port = htons(port);
+
+ addr = inet_addr(host);
+ hostinfo = gethostbyaddr((char *)&addr, 4, PF_INET);
+ /*hostinfo = gethostbyname(hostname);*/
+
+ if (hostinfo == NULL)
+ return -1;
+
+ name.sin_addr = *(struct in_addr *) hostinfo->h_addr;
+
+ return connect(sock->fd, (struct sockaddr *)&name, sizeof(name));
+}
+
+void tcp_disconnect(tcpsock_s *sock)
+{
+ shutdown(sock->fd, 2);
+}
+
+#ifdef SOCK_BSD
+__inline
+#endif
+int tcp_read(tcpsock_s *sock, void *buf, size_t count)
+{
+#if defined(SOCK_BSD)
+ return read(sock->fd, buf, count);
+#elif defined(SOCK_WIN)
+ return recv(sock->fd, buf, count, 0);
+#endif
+}
+
+#ifdef SOCK_BSD
+__inline
+#endif
+int tcp_write(tcpsock_s *sock, void *buf, size_t count)
+{
+#if defined(SOCK_BSD)
+ return write(sock->fd, buf, count);
+#elif defined(SOCK_WIN)
+ return send(sock->fd, buf, count, 0);
+#endif
+}
+
+int tcp_getport(tcpsock_s *sock)
+{
+ return sock->port;
+}
+
+void tcp_debug(tcpsock_s *sock, FILE *f)
+{
+ fprintf(f, "tcp_socket {\n");
+ fprintf(f, "\tfd = %d\n", sock->fd);
+ fprintf(f, "\tport = %d\n", sock->port);
+ fprintf(f, "}\n\n");
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/sock.h b/RetoolingForOpenSprints/serproxy-0.1.3.src/sock.h
new file mode 100644
index 0000000..19ddf42
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/sock.h
@@ -0,0 +1,38 @@
+#ifndef SOCK_H
+#define SOCK_H
+
+#include <stdio.h>
+
+#if defined (__UNIX__)
+# define SOCK_BSD
+#elif defined (__WIN32__)
+# define SOCK_WIN
+#endif
+
+#if defined(SOCK_WIN)
+# include <winsock.h>
+//#define sockaddr_in SOCKADDR_IN
+#endif
+
+typedef struct
+{
+ int fd;
+ int port;
+} tcpsock_s;
+
+int sock_start(void);
+void sock_finish(void);
+
+int tcp_init(tcpsock_s *sock, int port);
+void tcp_cleanup(tcpsock_s *sock);
+int tcp_listen(tcpsock_s *sock);
+tcpsock_s *tcp_accept(tcpsock_s *sock);
+void tcp_refuse(tcpsock_s *sock);
+int tcp_connect(tcpsock_s *sock, char *host, int port);
+void tcp_disconnect(tcpsock_s *sock);
+int tcp_read(tcpsock_s *sock, void *buf, size_t count);
+int tcp_write(tcpsock_s *sock, void *buf, size_t count);
+int tcp_getport(tcpsock_s *sock);
+void tcp_debug(tcpsock_s *sock, FILE *f);
+
+#endif /* SOCK_H */
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/string.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/string.c
new file mode 100644
index 0000000..a15fef5
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/string.c
@@ -0,0 +1,70 @@
+/*
+ * string.c
+ *
+ * string handling routines
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "string.h"
+
+int str_assign(char **pstr, char *text)
+{
+ char *p;
+
+ if (!text)
+ {
+ free(*pstr);
+ *pstr = NULL;
+ return 0;
+ }
+
+ p = realloc(*pstr, strlen(text) + 1);
+ if (!p)
+ return -1;
+ *pstr = p;
+ strcpy(p, text);
+
+ return 0;
+}
+
+int str_cat(char **pstr, char *text)
+{
+ char *p = realloc(*pstr, strlen(*pstr) + strlen(text) + 1);
+ if (!p)
+ return -1;
+
+ *pstr = p;
+ strcat(p, text);
+
+ return 0;
+}
+
+/* strips trailing spaces */
+int str_striptrail(char *str)
+{
+ char *p;
+
+ for (p = str + strlen(str) - 1; p >= str; p--)
+ {
+ if (*p != ' ')
+ {
+ *(p + 1) = '\0';
+ return 0;
+ }
+ }
+ return 0;
+}
+
+void str_cleanup(char **pstr)
+{
+ if (*pstr)
+ {
+ free(*pstr);
+ *pstr = NULL;
+ }
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/string.h b/RetoolingForOpenSprints/serproxy-0.1.3.src/string.h
new file mode 100644
index 0000000..64d8ecb
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/string.h
@@ -0,0 +1,9 @@
+#ifndef STRING_H
+#define STRING_H
+
+int str_assign(char **pstr, char *text);
+int str_cat(char **pstr, char *text);
+int str_striptrail(char *str);
+void str_cleanup(char **pstr);
+
+#endif /* STRING_H */
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.c
new file mode 100644
index 0000000..e39dbd7
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.c
@@ -0,0 +1,149 @@
+/*
+ * thread.c
+ *
+ * Multithreading routines
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+#include "thread.h"
+
+int thr_create(thr_t *thread, int detached,
+ thr_startfunc_ptr_t startfunc, void *arg)
+{
+#if defined(PTHREADS)
+ int res;
+ pthread_attr_t attr;
+
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, detached
+ ? PTHREAD_CREATE_DETACHED
+ : PTHREAD_CREATE_JOINABLE);
+
+ res = pthread_create(thread, &attr, startfunc, arg);
+ pthread_attr_destroy(&attr);
+
+ return res;
+
+#elif defined(WINTHREADS)
+ DWORD ThreadID;
+ HANDLE hThread = CreateThread(NULL, 0, startfunc, arg, 0, &ThreadID);
+
+ if (hThread == NULL)
+ return GetLastError();
+
+ *thread = hThread;
+
+ return 0;
+#endif
+}
+
+int thr_cancel(thr_t thread)
+{
+#if defined(PTHREADS)
+ return pthread_cancel(thread);
+#elif defined(WINTHREADS)
+ BOOL res = TerminateThread(thread, 0);
+ if (!res)
+ return GetLastError();
+ return 0;
+#endif
+}
+
+void thr_exit(thr_exitcode_t retval)
+{
+#if defined(PTHREADS)
+ pthread_exit(retval);
+#elif defined(WINTHREADS)
+ ExitThread(retval);
+#endif
+}
+
+thr_t thr_self(void)
+{
+#if defined(PTHREADS)
+ return pthread_self();
+#elif defined(WINTHREADS)
+ return GetCurrentThread();
+#endif
+}
+
+int thr_equal(thr_t thread1, thr_t thread2)
+{
+#if defined(PTHREADS)
+ return pthread_equal(thread1, thread2);
+#elif defined(WINTHREADS)
+ return thread1 == thread2;
+#endif
+}
+
+int thr_join(thr_t thread, thr_exitcode_t *retval)
+{
+#if defined(PTHREADS)
+ return pthread_join(thread, retval);
+#elif defined(WINTHREADS)
+ return -1;
+#endif
+}
+
+int thr_detach(thr_t thread)
+{
+#if defined(PTHREADS)
+ return pthread_detach(thread);
+#elif defined(WINTHREADS)
+ return 0;
+#endif
+}
+
+/*
+ * Mutex functions
+ */
+
+thr_mutex_t thr_mutex_create(void)
+{
+#if defined(PTHREADS)
+ thr_mutex_t mutex;
+ pthread_mutex_init(&mutex, NULL);
+
+ return mutex;
+#elif defined(WINTHREADS)
+ return CreateMutex(NULL, FALSE, NULL);
+#endif
+}
+
+int thr_mutex_destroy(thr_mutex_t *mutex)
+{
+#if defined(PTHREADS)
+ return pthread_mutex_destroy(mutex);
+#elif defined(WINTHREADS)
+ return CloseHandle(*mutex) ? 0 : -1;
+#endif
+}
+
+int thr_mutex_lock(thr_mutex_t *mutex)
+{
+#if defined(PTHREADS)
+ return pthread_mutex_lock(mutex);
+#elif defined(WINTHREADS)
+ return WaitForSingleObject(*mutex, INFINITE) == WAIT_TIMEOUT ? -1 : 0;
+#endif
+}
+
+int thr_mutex_trylock(thr_mutex_t *mutex)
+{
+#if defined(PTHREADS)
+ return pthread_mutex_trylock(mutex);
+#elif defined(WINTHREADS)
+ return WaitForSingleObject(*mutex, 0) == WAIT_TIMEOUT ? -1 : 0;
+#endif
+}
+
+int thr_mutex_unlock(thr_mutex_t *mutex)
+{
+#if defined(PTHREADS)
+ return pthread_mutex_unlock(mutex);
+#elif defined(WINTHREADS)
+ return ReleaseMutex(*mutex) ? 0 : -1;
+#endif
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h b/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h
new file mode 100644
index 0000000..c741c51
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h
@@ -0,0 +1,44 @@
+#ifndef THREAD_H
+#define THREAD_H
+
+#if defined(__UNIX__)
+# define PTHREADS
+#elif defined(__WIN32__)
+# define WINTHREADS
+#endif
+
+#if defined(PTHREADS)
+
+# include <pthread.h>
+typedef pthread_t thr_t;
+typedef pthread_mutex_t thr_mutex_t;
+typedef void * thr_exitcode_t;
+typedef void *(*thr_startfunc_ptr_t)(void *);
+typedef void * thr_startfunc_t;
+
+#elif defined(WINTHREADS)
+
+# include <windows.h>
+typedef HANDLE thr_t;
+typedef HANDLE thr_mutex_t;
+typedef DWORD thr_exitcode_t;
+typedef LPTHREAD_START_ROUTINE thr_startfunc_ptr_t;
+#define thr_startfunc_t thr_exitcode_t WINAPI
+#endif
+
+int thr_create(thr_t *thread, int detached,
+ thr_startfunc_ptr_t startfunc, void *arg);
+int thr_cancel(thr_t thread);
+void thr_exit(thr_exitcode_t retval);
+thr_t thr_self(void);
+int thr_equal(thr_t thread1, thr_t thread2);
+int thr_join(thr_t thread, thr_exitcode_t *retval);
+int thr_detach(thr_t thread);
+
+thr_mutex_t thr_mutex_create(void);
+int thr_mutex_destroy(thr_mutex_t *mutex);
+int thr_mutex_lock(thr_mutex_t *mutex);
+int thr_mutex_trylock(thr_mutex_t *mutex);
+int thr_mutex_unlock(thr_mutex_t *mutex);
+
+#endif /* THREAD_H */
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/vlist.c b/RetoolingForOpenSprints/serproxy-0.1.3.src/vlist.c
new file mode 100644
index 0000000..a04138c
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/vlist.c
@@ -0,0 +1,250 @@
+/*
+ * vlist.c
+ *
+ * "void linked list" structure and helper functions
+ *
+ * (C)1999 Stefano Busti
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <sys/types.h>
+
+#if defined(__WIN32__)
+# include <windows.h>
+#endif
+
+#include "vlist.h"
+
+/*
+ * Initializes a list, 2nd parameter is a pointer to
+ * a function which will be used to free the items
+ * if the list is an owner list.
+ * Call this once just after creating the list.
+ */
+int vlist_init(vlist_s *st, vlist_destroy_func_t destroyitem)
+{
+ st->head = NULL;
+ st->tail = NULL;
+ st->count = 0;
+ st->owner = 1;
+ st->destroyitem = destroyitem;
+ return 0;
+}
+
+/*
+ * Cleans up a list - call this when you've finished
+ * with the list.
+ */
+void vlist_cleanup(vlist_s *st)
+{
+ vlist_clear(st);
+}
+
+/*
+ * Removes all the items in the list. If the list is
+ * an owner list, item data is also freed.
+ */
+void vlist_clear(vlist_s *st)
+{
+ vlist_i *it = st->head;
+ while(it)
+ {
+ vlist_delete(st, it);
+ it = st->head;
+ }
+}
+
+vlist_i *vlist_addfirst(vlist_s *st, void *data)
+{
+ vlist_i *it = malloc(sizeof(vlist_i));
+
+ if (!it)
+ return NULL;
+
+ it->data = data;
+ it->prev = NULL;
+ it->next = NULL;
+ st->head = it;
+ st->tail = it;
+ st->count = 1;
+
+ return it;
+}
+
+/*
+ * Adds a new item after item it, using the data 'data'
+ */
+vlist_i *vlist_add(vlist_s *st, vlist_i *it, void *data)
+{
+ vlist_i *nextit;
+
+ /* handle special case where list is empty */
+ if (st->count == 0)
+ {
+ return vlist_addfirst(st, data);
+ }
+
+ /* grab a pointer to the next item */
+ nextit = it->next;
+
+ /* create our new item */
+ it->next = malloc(sizeof(vlist_i));
+
+ if (!it->next)
+ return NULL;
+
+ /* set up the new item */
+ it->next->data = data;
+ it->next->prev = it;
+ it->next->next = nextit;
+
+ if (nextit)
+ {
+ /* link the next item to the new one */
+ nextit->prev = it->next;
+ }
+ else
+ {
+ /* update tail */
+ st->tail = it->next;
+ }
+
+ /* add one to item count */
+ st->count++;
+
+ return it->next;
+}
+
+/*
+ * Inserts a new item before item it, using the data 'data'
+ */
+vlist_i *vlist_insert(vlist_s *st, vlist_i *it, void *data)
+{
+ vlist_i *previt;
+
+ /* handle special case where list is empty */
+ if (st->count == 0)
+ {
+ return vlist_addfirst(st, data);
+ }
+
+ /* grab a pointer to the previous item */
+ previt = it->prev;
+
+ /* create our new item */
+ it->prev = malloc(sizeof(vlist_i));
+
+ if (!it->prev)
+ return NULL;
+
+ /* set up the new item */
+ it->prev->data = data;
+ it->prev->prev = previt;
+ it->prev->next = it;
+
+ if (previt)
+ {
+ /* link the previous item to the new one */
+ previt->next = it->prev;
+ }
+ else
+ {
+ /* update head */
+ st->head = it->prev;
+ }
+
+ /* add one to item count */
+ st->count++;
+
+ return it->prev;
+}
+
+/*
+ * Removes the item 'it' from the list. If the list is
+ * an owner list, item data is also freed.
+ */
+void vlist_delete(vlist_s *st, vlist_i *it)
+{
+ /* call destroyitem() if we're the owner */
+ if (st->owner) {
+ st->destroyitem(it->data);
+ it->data = NULL;
+ }
+ if (it->next)
+ it->next->prev = it->prev;
+ else
+ st->tail = it->prev;
+
+ if (it->prev)
+ it->prev->next = it->next;
+ else
+ st->head = it->next;
+
+ free(it);
+ st->count--;
+}
+
+/*
+ * Returns the item data for item it
+ */
+void *vlist_get(vlist_i *it)
+{
+ return it->data;
+}
+
+/*
+ * Searches the list forwards for 'data',
+ * starting at item 'it'.
+ * Returns NULL if not found.
+ */
+vlist_i *vlist_findfwd(vlist_i *it, void *data)
+{
+ vlist_i *item;
+
+ /* iterate forwards searching for data */
+ for (item = it; item; item = item->next)
+ if (item->data == data)
+ return item;
+
+ /* not found */
+ return NULL;
+}
+
+/*
+ * Searches the list backwards for 'data',
+ * starting at item 'it'.
+ * Returns NULL if not found.
+ */
+vlist_i *vlist_findrev(vlist_i *it, void *data)
+{
+ vlist_i *item;
+
+ /* iterate backwards searching for data */
+ for (item = it; item; item = item->prev)
+ if (item->data == data)
+ return item;
+
+ /* not found */
+ return NULL;
+}
+
+void vlist_debug(vlist_s *st, FILE *stream)
+{
+ vlist_i *it;
+ fprintf(stream, "list with %d items\n", st->count);
+ fprintf(stream, "head = 0x%08lx\n", (u_long)st->head);
+ fprintf(stream, "tail = 0x%08lx\n", (u_long)st->tail);
+ fprintf(stream, "items are:\n{\n");
+
+ for (it = st->head; it; it = it->next)
+ {
+ fprintf(stream, "\t0x%08lx << [ 0x%08lx ] >> 0x%08lx (data:0x%08lx)\n",
+ (u_long)it->prev, (u_long)it,
+ (u_long)it->next, (u_long)it->data);
+ }
+
+ fprintf(stream, "}\n\n");
+}
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/vlist.h b/RetoolingForOpenSprints/serproxy-0.1.3.src/vlist.h
new file mode 100644
index 0000000..d7c7e6f
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/vlist.h
@@ -0,0 +1,55 @@
+#ifndef VLIST_H
+#define VLIST_H
+
+#include <stdio.h>
+
+/* A single list item. */
+struct vlist_i
+{
+ /* The item's data. */
+ void *data;
+
+ /* Pointers to previous and next items */
+ struct vlist_i *prev, *next;
+};
+
+typedef struct vlist_i vlist_i;
+
+/* A doubly-linked list structure */
+struct vlist_s
+{
+ /* First and last items in the list */
+ vlist_i *head, *tail;
+
+ /* Number of items in the list */
+ int count;
+
+ /*
+ * If this is non-zero, the list owns its items
+ * and will free data when any items are removed
+ */
+ int owner;
+
+ /*
+ * Pointer to the function used to free data
+ */
+ void (*destroyitem)(void *);
+};
+
+typedef struct vlist_s vlist_s;
+
+typedef void vlist_destroy_func_t (void *);
+
+/* function declarations */
+int vlist_init(vlist_s *st, vlist_destroy_func_t destroyitem);
+void vlist_cleanup(vlist_s *st);
+void vlist_clear(vlist_s *st);
+vlist_i *vlist_add(vlist_s *st, vlist_i *it, void *data);
+vlist_i *vlist_insert(vlist_s *st, vlist_i *it, void *data);
+void vlist_delete(vlist_s *st, vlist_i *it);
+void *vlist_get(vlist_i *it);
+vlist_i *vlist_findfwd(vlist_i *it, void *data);
+vlist_i *vlist_findrev(vlist_i *it, void *data);
+void vlist_debug(vlist_s *st, FILE *stream);
+
+#endif /* VLIST_H */
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/win32/.cvsignore b/RetoolingForOpenSprints/serproxy-0.1.3.src/win32/.cvsignore
new file mode 100644
index 0000000..4eb10fa
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/win32/.cvsignore
@@ -0,0 +1,5 @@
+*.ncb *.opt *.aps *.plg *.zip *.001 *.gz
+serproxy
+Debug
+Release
+Output
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/win32/serproxy.dsp b/RetoolingForOpenSprints/serproxy-0.1.3.src/win32/serproxy.dsp
new file mode 100644
index 0000000..f038a67
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/win32/serproxy.dsp
@@ -0,0 +1,162 @@
+# Microsoft Developer Studio Project File - Name="serproxy" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=serproxy - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "serproxy.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "serproxy.mak" CFG="serproxy - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "serproxy - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "serproxy - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "serproxy - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__WIN32__" /YX /FD /c
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "serproxy - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "__WIN32__" /D "_DEBUG" /D "DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "serproxy - Win32 Release"
+# Name "serproxy - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\cfglib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\cfglib.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\config.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\config.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\error.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\error.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\main.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\pipe.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\pipe.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\sio.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sio.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\sock.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\sock.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\string.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\string.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\thread.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\thread.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\vlist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\vlist.h
+# End Source File
+# End Target
+# End Project
diff --git a/RetoolingForOpenSprints/serproxy-0.1.3.src/win32/serproxy.dsw b/RetoolingForOpenSprints/serproxy-0.1.3.src/win32/serproxy.dsw
new file mode 100644
index 0000000..70a5a1d
--- /dev/null
+++ b/RetoolingForOpenSprints/serproxy-0.1.3.src/win32/serproxy.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "serproxy"=.\serproxy.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+