about summary refs log tree commit diff stats
path: root/snitch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'snitch.cpp')
-rw-r--r--snitch.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/snitch.cpp b/snitch.cpp index 700a0a9..3758dc0 100644 --- a/snitch.cpp +++ b/snitch.cpp
@@ -8,7 +8,14 @@
8 8
9int main(int argc, char** argv) 9int main(int argc, char** argv)
10{ 10{
11 YAML::Node config = YAML::LoadFile("config.yml"); 11 if (argc != 2)
12 {
13 std::cout << "usage: snitch [configfile]" << std::endl;
14 return -1;
15 }
16
17 std::string configfile(argv[1]);
18 YAML::Node config = YAML::LoadFile(configfile);
12 19
13 twitter::auth auth; 20 twitter::auth auth;
14 auth.setConsumerKey(config["consumer_key"].as<std::string>()); 21 auth.setConsumerKey(config["consumer_key"].as<std::string>());
@@ -16,7 +23,7 @@ int main(int argc, char** argv)
16 auth.setAccessKey(config["access_key"].as<std::string>()); 23 auth.setAccessKey(config["access_key"].as<std::string>());
17 auth.setAccessSecret(config["access_secret"].as<std::string>()); 24 auth.setAccessSecret(config["access_secret"].as<std::string>());
18 25
19 std::ifstream img_file("image.jpg"); 26 std::ifstream img_file(config["image"].as<std::string>());
20 img_file.seekg(0, std::ios::end); 27 img_file.seekg(0, std::ios::end);
21 size_t img_len = img_file.tellg(); 28 size_t img_len = img_file.tellg();
22 char* img_buf = new char[img_len]; 29 char* img_buf = new char[img_len];