Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jul 29, 2024
1 parent 0b834e8 commit 5df6aab
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ add_executable(
src/callbacks.c
src/resources.c
src/biggestint.c
src/signals.c
)

foreach(target kai)
Expand Down
9 changes: 9 additions & 0 deletions src/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "terminal.h"
#include "callbacks.h"
#include "signals.h"

void progress_callback(const size_t total, const size_t current) {

Expand All @@ -11,3 +12,11 @@ void progress_callback(const size_t total, const size_t current) {
fflush(stdout);

}

SIGNAL_HANDLER_RETURN sigint_handler(SIGNAL_HANDLER_ARGS) {

show_cursor();

SIGNAL_HANDLER_END

}
3 changes: 3 additions & 0 deletions src/callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include <stdlib.h>

#include "signals.h"

void progress_callback(const size_t total, const size_t current);
SIGNAL_HANDLER_RETURN sigint_handler(SIGNAL_HANDLER_ARGS);

#endif
3 changes: 3 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>

#include <curl/curl.h>
#include <libavutil/error.h>
Expand Down Expand Up @@ -30,6 +31,7 @@
#include "biggestint.h"
#include "sslcerts.h"
#include "resources.h"
#include "signals.h"

#if defined(_WIN32) && defined(_UNICODE)
#include "wio.h"
Expand Down Expand Up @@ -210,6 +212,7 @@ int main(int argc, argv_t* argv[]) {
}

hide_cursor();
signal_sethandler(SIGINT, &sigint_handler);

temporary_directory = get_temporary_directory();

Expand Down
8 changes: 8 additions & 0 deletions src/signals.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "signals.h"

void signal_sethandler(
const int signal,
SIGNAL_HANDLER_RETURN (*handler)(SIGNAL_HANDLER_ARGS)
) {

}
14 changes: 14 additions & 0 deletions src/signals.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#if !defined(SIGNALS_H)
#define SIGNALS_H

#if defined(_WIN32)
#define SIGNAL_HANDLER_RETURN int
#define SIGNAL_HANDLER_ARGS int value, int subcode
#define SIGNAL_HANDLER_END return 0;
#else
#define SIGNAL_HANDLER_RETURN void
#define SIGNAL_HANDLER_ARGS
#define SIGNAL_HANDLER_END
#endif

#endif

0 comments on commit 5df6aab

Please sign in to comment.