summaryrefslogtreecommitdiff
path: root/utilities/addcomment.cpp
blob: 46de6a745fe89eb538e68e06ed455c2252ed81f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/******************************************************************************
 *
 *  addcomment.cpp -	
 *
 * $Id: addcomment.cpp 2833 2013-06-29 06:40:28Z chrislit $
 *
 * Copyright 1998-2013 CrossWire Bible Society (http://www.crosswire.org)
 *	CrossWire Bible Society
 *	P. O. Box 2528
 *	Tempe, AZ  85280-2528
 *
 * 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 version 2.
 *
 * 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.
 *
 */

#include <stdio.h>
#include <iostream>
#include <versekey.h>
#include <rawtext.h>
#include <zcom.h>
#include <rawcom.h>
#include <rawfiles.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
	int loop;
	int max;
	RawFiles  personal("modules/comments/rawfiles/personal/", "MINE", "Personal Comments");
	VerseKey mykey;

	if (argc < 3) {
		fprintf(stderr, "usage: %s <\"comment\"> <\"verse\"> [count] [disable AutoNormalization]\n", argv[0]);
		exit(-1);
	}

	if (argc > 4)
		mykey.AutoNormalize(0);  // Turn off autonormalize if 3 args to allow for intros
				// This is kludgy but at lease you can try it
				// with something like: sword "Matthew 1:0" 1 1

	mykey = argv[2];
	mykey.Persist(1);
	personal.setKey(mykey);

	max = (argc < 4) ? 1 : atoi(argv[3]);

	for (loop = 0; loop < max; loop++) {
		personal << argv[1];
		mykey++;
	}
	std::cout << "Added Comment" << std::endl;
	return 0;
}