One small checkpoint
diff --git a/client/client.cc b/client/client.cc
new file mode 100644
index 0000000..746de70
--- /dev/null
+++ b/client/client.cc
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * 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
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *	   Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ */
+
+#include <iostream>
+#include <boost/algorithm/string.hpp>
+#include <config.h>
+
+using namespace std;
+using namespace boost;
+
+void
+usage ()
+{
+  cerr << "Usage: chronoshare <cmd> [<options>]\n"
+       << "\n"
+       << "   <cmd> is one of:\n"
+       << "       version\n"
+       << "       update <filename>\n"
+       << "       delete <filename>\n"
+       << "       move <filename> <filename>\n";
+  exit (1);
+}
+
+int
+main (int argc, char **argv)
+{
+  if (argc < 2)
+    {
+      usage ();
+    }
+
+  string cmd = argv[1];
+  algorithm::to_lower (cmd);
+  
+  if (cmd == "version")
+    {
+      cout << "chronoshare version " << CHRONOSHARE_VERSION << endl;
+      exit (0);
+    }
+  else if (cmd == "update")
+    {
+      if (argc != 3)
+        {
+          usage ();
+        }
+    }
+  else if (cmd == "delete")
+    {
+      if (argc != 3)
+        {
+          usage ();
+        }
+    }
+  else if (cmd == "move")
+    {
+      if (argc != 4)
+        {
+          usage ();
+        }
+    }
+  
+  return 0;
+}
diff --git a/src/main.cc b/daemon/daemon.cc
similarity index 100%
copy from src/main.cc
copy to daemon/daemon.cc
diff --git a/ice_cxx.py b/ice_cxx.py
index 54d9386..a876fb8 100644
--- a/ice_cxx.py
+++ b/ice_cxx.py
@@ -5,6 +5,8 @@
 
 from waflib.Task import Task
 from waflib.TaskGen import extension 
+from waflib import Logs
+from waflib import Node
 
 """
 A simple tool to integrate zeroc ICE into your build system.
@@ -50,8 +52,9 @@
         else:
                 conf.find_program('slice2cpp', var='SLICE2CPP', path_list=["%s/bin" % path for path in ICE_PATHS], mandatory=True)
         
-        conf.env['LIB_ICE'] = ["ZeroCIce", "IceUtil"]
-        # self.env['LIBPATH_ICE'] = ""
-        # self.env['CXXFLAGS_ICE'] = ""
-	
+        ICE_PATH = conf.env.SLICE2CPP[:-14]
+        
+	conf.env['LIB_ICE'] = ["Ice", "ZeroCIce", "IceUtil"]
+	conf.env['INCLUDES_ICE']= '%s/include' % ICE_PATH
+	conf.env['LIBPATH_ICE'] = '%s/lib' % ICE_PATH
 
diff --git a/src/main.cc b/src/database-test.cc
similarity index 100%
rename from src/main.cc
rename to src/database-test.cc
diff --git a/wscript b/wscript
index c8f63ad..2c0f727 100644
--- a/wscript
+++ b/wscript
@@ -17,6 +17,8 @@
 def configure(conf):
     conf.load("compiler_cxx")
 
+    conf.define ("CHRONOSHARE_VERSION", VERSION)
+
     conf.check_cfg(package='sqlite3', args=['--cflags', '--libs'], uselib_store='SQLITE3', mandatory=True)
 
     if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False):
@@ -79,14 +81,34 @@
           includes = ['include', ],
           )
 
-    chronoshare = bld (
-        target="tmp",
+    common = bld.objects (
+        target = "common",
+        features = ["cxx"],
+        source = bld.path.ant_glob(
+            'src/chronoshare-client.ice'
+            ),
+        use = 'BOOST',
+        includes = ['include', 'src'],
+        )
+
+
+    client = bld (
+        target="cs-client",
+        features=['cxx', 'cxxprogram'],
+        source = ['client/client.cc', 
+                  ],
+        use = "BOOST CCNX SSL ICE common",
+        includes = ['include', 'src'],
+        )
+
+    daemon = bld (
+        target="cs-daemon",
         features=['cxx', 'cxxprogram'],
         # source = bld.path.ant_glob(['src/**/*.cc']),
-        source = ['src/main.cc', 
+        source = ['daemon/daemon.cc', 
                   'src/db-helper.cc',
                   'src/hash-string-converter.cc',
-                  'src/chronoshare-client.ice'],
-        use = 'BOOST BOOST_IOSTREAMS BOOST_REGEX CCNX SSL SQLITE3',
+                  ],
+        use = "BOOST CCNX SSL SQLITE3 ICE common",
         includes = ['include', 'src'],
         )