Mercurial > projects > pwm
diff pwm.h @ 19:5c6155c8e9b6
Handle signals
Handled signals are generally blocked and only unblocked when doing blocking
I/O, i.e. either when reading commands or printing results. A (possibly
queued) signal will then interrupt I/O and can be dealt with in the main loop.
author | Guido Berhoerster <guido+pwm@berhoerster.name> |
---|---|
date | Fri, 01 Sep 2017 22:33:41 +0200 |
parents | 1e39a251cbe9 |
children | efef93e54c5f |
line wrap: on
line diff
--- a/pwm.h Thu Aug 24 13:10:56 2017 +0200 +++ b/pwm.h Fri Sep 01 22:33:41 2017 +0200 @@ -31,6 +31,18 @@ #define PWM_LINE_MAX 16384 #endif /* !PWM_LINE_MAX */ +#ifndef PWM_HISTORY_ENTRIES_MAX +#define PWM_HISTORY_ENTRIES_MAX 1024 +#endif /* !PWM_HISTORY_MAX */ + +#ifndef PWM_HISTORY_LINES_MAX +#define PWM_HISTORY_LINES_MAX 256 +#endif /* !PWM_HISTORY_LINES_MAX */ + +#ifndef PWM_HISTORY_MAX +#define PWM_HISTORY_MAX (PWM_HISTORY_LINES_MAX * PWM_LINE_MAX) +#endif /* !PWM_HISTORY_MAX */ + struct pwm_ctx { const char *prev_cmd; char *errmsg; @@ -43,6 +55,8 @@ }; void pwm_err(struct pwm_ctx *, char *, ...); +void pwm_block_signals(void); +void pwm_unblock_signals(void); int pwm_read_password(struct pwm_ctx *, int); #endif /* PWM_H */