print the selected date to stdout on exit
Doesn't quite work yet in the presence of redirects. For some reason the highlights disappear.
This commit is contained in:
parent
8458d95e8f
commit
6398f526d8
9
ncal.c
9
ncal.c
|
@ -563,7 +563,9 @@ main(int argc, char *argv[])
|
||||||
printeaster(y, flag_julian_cal, flag_orthodox);
|
printeaster(y, flag_julian_cal, flag_orthodox);
|
||||||
else {
|
else {
|
||||||
int key;
|
int key;
|
||||||
initscr();
|
FILE *f = fopen("/dev/tty", "r+");
|
||||||
|
SCREEN *screen = newterm(NULL, f, f);
|
||||||
|
set_term(screen);
|
||||||
noecho();
|
noecho();
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
keypad(stdscr, 1);
|
keypad(stdscr, 1);
|
||||||
|
@ -579,9 +581,12 @@ main(int argc, char *argv[])
|
||||||
mvprintw(30, 60, "%d %d", key, highlightdate);
|
mvprintw(30, 60, "%d %d", key, highlightdate);
|
||||||
processkeyr(key, y, m, flag_julian_day, before, after, &highlightdate);
|
processkeyr(key, y, m, flag_julian_day, before, after, &highlightdate);
|
||||||
}
|
}
|
||||||
} while (key != 'q');
|
} while (key != /*enter*/10);
|
||||||
endwin();
|
endwin();
|
||||||
}
|
}
|
||||||
|
struct date result;
|
||||||
|
sdateb(highlightdate, &result);
|
||||||
|
printf("%d/%02d/%02d\n", result.y, result.m, result.d);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue