Add actual image processing
This commit is contained in:
parent
60dd2f5b70
commit
52ad6f619d
@ -3,10 +3,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <netpbm/pam.h>
|
||||||
#include "commit.inc"
|
#include "commit.inc"
|
||||||
|
#include "pixels.hpp"
|
||||||
|
|
||||||
void print_help() {
|
void print_help() {
|
||||||
std::cout << "usage: termage [-h|--version]\n";
|
std::cout << "usage: termage [-h|--version] <imagefile>\n";
|
||||||
std::cout << " -h, --help show this help text and exit\n";
|
std::cout << " -h, --help show this help text and exit\n";
|
||||||
std::cout << " --version show version number and exit\n";
|
std::cout << " --version show version number and exit\n";
|
||||||
}
|
}
|
||||||
@ -21,6 +23,7 @@ void print_version() {
|
|||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
try {
|
try {
|
||||||
|
pm_init("termage", 0);
|
||||||
int opt_char, opt_val;
|
int opt_char, opt_val;
|
||||||
struct option long_options[] = {
|
struct option long_options[] = {
|
||||||
{"help", no_argument, nullptr, 'h'},
|
{"help", no_argument, nullptr, 'h'},
|
||||||
@ -52,11 +55,11 @@ int main(int argc, char* argv[]) {
|
|||||||
for (int i = optind; i < argc; ++i) {
|
for (int i = optind; i < argc; ++i) {
|
||||||
try {
|
try {
|
||||||
// process file argv[i]
|
// process file argv[i]
|
||||||
|
write_image(std::cout, argv[i]);
|
||||||
} catch (const std::runtime_error& ex) {
|
} catch (const std::runtime_error& ex) {
|
||||||
std::cerr << "termage: " << ex.what() << '\n';
|
std::cerr << "termage: " << ex.what() << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cout << "hello, termage\n";
|
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
std::cerr << "termage: " << ex.what() << '\n';
|
std::cerr << "termage: " << ex.what() << '\n';
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user