}
void version() {
- printf("mdp %d.%d\n", MAJOR_VERSION, MINOR_VERSION);
+ printf("mdp %d.%d.%d\n", MDP_VER_MAJOR, MDP_VER_MINOR, MDP_VER_REVISION);
printf("Copyright (C) 2014 Michael Goehler\n");
printf("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n");
printf("This is free software: you are free to change and redistribute it.\n");
fclose(input);
// replace stdin with current tty if input was a pipe
- if(input == stdin)
- freopen("/dev/tty", "rw", stdin);
+ if(input == stdin) {
+ input = freopen("/dev/tty", "rw", stdin);
+ if(!input) {
+ fprintf(stderr, "%s: %s: %s\n", argv[0], "/dev/tty", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ }
if(debug > 0) {
markdown_debug(deck, debug);