summaryrefslogtreecommitdiff
path: root/src/cli/sighandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/sighandler.h')
-rw-r--r--src/cli/sighandler.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cli/sighandler.h b/src/cli/sighandler.h
new file mode 100644
index 000000000..877223e02
--- /dev/null
+++ b/src/cli/sighandler.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+
+#ifndef CLI_sighandler_h__
+#define CLI_sighandler_h__
+
+/**
+ * Sets up a signal handler that will run when the process is interrupted
+ * (via SIGINT on POSIX or Control-C or Control-Break on Windows).
+ *
+ * @param handler The function to run on interrupt
+ * @return 0 on success, -1 on failure
+ */
+int cli_sighandler_set_interrupt(void (*handler)(void));
+
+#endif /* CLI_sighandler_h__ */