aboutsummaryrefslogtreecommitdiff
path: root/marsond.c
diff options
context:
space:
mode:
Diffstat (limited to 'marsond.c')
-rw-r--r--marsond.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/marsond.c b/marsond.c
index 1e0393f..18016d5 100644
--- a/marsond.c
+++ b/marsond.c
@@ -35,6 +35,7 @@ int debugging = 0; /* -v */
int foreground = 0; /* -v */
const char *keyboard_dev = DEFAULT_KBD; /* -k */
int delay_ms = DEFAULT_DELAY_MS; /* -d */
+int pause_ms = 0; /* -p */
int infd = -1, outfd = -1;
@@ -95,12 +96,13 @@ void parse_args(int argc, char **argv) {
}
}
- while( (opt = getopt(argc, argv, "d:hfk:vV")) != -1) {
+ while( (opt = getopt(argc, argv, "d:hfk:p:vV")) != -1) {
switch(opt) {
case 'd': delay_ms = atoi(optarg); break;
case 'f': foreground++; break;
case 'h': print_help(); exit(0); break;
case 'k': keyboard_dev = optarg; break;
+ case 'p': pause_ms = atoi(optarg); break;
case 'v': debugging++; break;
case 'V': version(); exit(0); break;
case '?': die("invalid option (try --help)"); break;
@@ -276,6 +278,11 @@ int main(int argc, char **argv) {
parse_args(argc, argv);
+ if(pause_ms > 0) {
+ debug("pausing %dms due to -p option");
+ usleep(pause_ms * 1000);
+ }
+
if((outfd = open("/dev/uinput", O_WRONLY | O_NONBLOCK)) >= 0) {
debug("opened /dev/uinput");
} else {