blob: 746de70faf695fb8345f7d74a7c1e47c0ba96dc8 [file] [log] [blame]
Alexander Afanasyevf2890632013-01-02 13:40:02 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 * Zhenkai Zhu <zhenkai@cs.ucla.edu>
20 */
21
22#include <iostream>
23#include <boost/algorithm/string.hpp>
24#include <config.h>
25
26using namespace std;
27using namespace boost;
28
29void
30usage ()
31{
32 cerr << "Usage: chronoshare <cmd> [<options>]\n"
33 << "\n"
34 << " <cmd> is one of:\n"
35 << " version\n"
36 << " update <filename>\n"
37 << " delete <filename>\n"
38 << " move <filename> <filename>\n";
39 exit (1);
40}
41
42int
43main (int argc, char **argv)
44{
45 if (argc < 2)
46 {
47 usage ();
48 }
49
50 string cmd = argv[1];
51 algorithm::to_lower (cmd);
52
53 if (cmd == "version")
54 {
55 cout << "chronoshare version " << CHRONOSHARE_VERSION << endl;
56 exit (0);
57 }
58 else if (cmd == "update")
59 {
60 if (argc != 3)
61 {
62 usage ();
63 }
64 }
65 else if (cmd == "delete")
66 {
67 if (argc != 3)
68 {
69 usage ();
70 }
71 }
72 else if (cmd == "move")
73 {
74 if (argc != 4)
75 {
76 usage ();
77 }
78 }
79
80 return 0;
81}