diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 16 | ||||
| -rw-r--r-- | asm/jo_c_args.asm | 8 | ||||
| -rw-r--r-- | asm/jo_f_percent.asm | 8 | ||||
| -rw-r--r-- | asm/jo_f_status.asm | 8 | ||||
| -rw-r--r-- | asm/jo_r_cpyhead.asm | 8 | ||||
| -rw-r--r-- | asm/jo_r_loop.asm | 8 | ||||
| -rw-r--r-- | asm/jo_r_lowbat.asm | 18 | ||||
| -rw-r--r-- | src/jo_lowbat.c | 22 | ||||
| -rw-r--r-- | src/jo_lowbat.h | 38 | ||||
| -rw-r--r-- | src/jo_n_notify.c | 2 | ||||
| -rw-r--r-- | src/jo_n_notify.h | 2 | ||||
| -rw-r--r-- | src/jo_n_speak.h | 8 | 
12 files changed, 51 insertions, 95 deletions
@@ -18,7 +18,7 @@ PREFIX		?= /usr/local  BINPREFIX	?= ${PREFIX}/bin  MANPREFIX	?= ${PREFIX}/share/man  # ====================================== FILES ========================================= # -C_SRCS		 = ${C_SRCS_DIR}/jo_lowbat.c +# C_SRCS		 = ${C_SRCS_DIR}/jo_lowbat.c  C_SRCS		+= ${C_SRCS_DIR}/jo_n_speak.c  C_SRCS		+= ${C_SRCS_DIR}/jo_n_notify.c  # -------------------------------------------------------------------------------------- # @@ -33,8 +33,7 @@ A_SRCS		+= ${A_SRCS_DIR}/jo_f_percent.asm  # -------------------------------------------------------------------------------------- #  A_OBJS		= ${A_SRCS:.asm=.o}  # ===================================== COMPILER ======================================= # -${CC}		= clang -# -------------------------------------------------------------------------------------- # +CC			?= clang  CFLAGS		+= -std=c89  CFLAGS		+= -Wall  CFLAGS		+= -Wextra @@ -45,8 +44,7 @@ CFLAGS		+= -Wno-variadic-macros  CFLAGS		+= -Werror  CFLAGS		+= -pedantic  # CFLAGS		+= -O0 -glldb -# -------------------------------------------------------------------------------------- # -# DEBUG		+= -fsanitize=address +# CFLAGS		+= -fsanitize=address  # -------------------------------------------------------------------------------------- #  CINCS		 = -Isrc/  CINCS		+= -I/usr/local/include @@ -67,6 +65,12 @@ TARGET		= lowbat  ASM			= nasm  # ASMFLAGS	= -g  ASMARCH		= -f elf64 +# ====================================== LINKER ======================================== # +LDFLAGS		?= +LDLIBS		 = ${LDFLAGS} +LDLIBS		+= -L/usr/local/lib +LDLIBS		+= -lnotify +LDLIBS		+= -lespeak  # ======================================= UNIX ========================================= #  SHELL		:= /bin/sh  RM			= rm -f @@ -84,7 +88,7 @@ SED			= sed  	${CC} -c ${CFLAGS} ${CINCS} -o ${.TARGET} ${.IMPSRC}  # -------------------------------------------------------------------------------------- #  ${TARGET}: ${A_OBJS} ${C_OBJS} -	${CC} ${CFLAGS} ${CINCS} -o ${.TARGET} ${A_OBJS} ${C_OBJS} ${LDLIBS} +	${CC} ${CFLAGS} -o ${.TARGET} ${A_OBJS} ${C_OBJS} ${LDLIBS}  # -------------------------------------------------------------------------------------- #  depend:  	${CC} ${CINCS} -E -MM ${C_SRCS} > .depend diff --git a/asm/jo_c_args.asm b/asm/jo_c_args.asm index bb24057..67a83c8 100644 --- a/asm/jo_c_args.asm +++ b/asm/jo_c_args.asm @@ -1,9 +1,9 @@  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;                                                                                      ;; -;;  File      : jo_c_args.asm                                             /_________/   ;; -;;  Author    : Joe                                                             |       ;; -;;  Date      : 04/2020                                                         |       ;; -;;  Info      : Check args                                                      |       ;; +;;  File     : jo_c_args.asm                                              /_________/   ;; +;;  Author   : Joe                                                              |       ;; +;;  Date     : 04/2020                                                          |       ;; +;;  Info     : Check args                                                       |       ;;  ;;                                                                      /       |       ;;  ;;                                                                      \       /       ;;  ;;                                                                       \_____/        ;; diff --git a/asm/jo_f_percent.asm b/asm/jo_f_percent.asm index 6ce918b..6a41c2f 100644 --- a/asm/jo_f_percent.asm +++ b/asm/jo_f_percent.asm @@ -1,9 +1,9 @@  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;                                                                                      ;; -;;  File      : jo_f_percent.asm                                          /_________/   ;; -;;  Author    : Joe                                                             |       ;; -;;  Date      : 04/2020                                                         |       ;; -;;  Info      : Gets batt remaining capacity                                    |       ;; +;;  File     : jo_f_percent.asm                                           /_________/   ;; +;;  Author   : Joe                                                              |       ;; +;;  Date     : 04/2020                                                          |       ;; +;;  Info     : Gets batt remaining capacity                                     |       ;;  ;;                                                                      /       |       ;;  ;;                                                                      \       /       ;;  ;;                                                                       \_____/        ;; diff --git a/asm/jo_f_status.asm b/asm/jo_f_status.asm index 5abaf24..0c1c39f 100644 --- a/asm/jo_f_status.asm +++ b/asm/jo_f_status.asm @@ -1,9 +1,9 @@  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;                                                                                      ;; -;;  File      : jo_f_status.asm                                           /_________/   ;; -;;  Author    : Joe                                                             |       ;; -;;  Date      : 04/2020                                                         |       ;; -;;  Info      : Gets batt status                                                |       ;; +;;  File     : jo_f_status.asm                                            /_________/   ;; +;;  Author   : Joe                                                              |       ;; +;;  Date     : 04/2020                                                          |       ;; +;;  Info     : Gets batt status                                                 |       ;;  ;;                                                                      /       |       ;;  ;;                                                                      \       /       ;;  ;;                                                                       \_____/        ;; diff --git a/asm/jo_r_cpyhead.asm b/asm/jo_r_cpyhead.asm index 35cdcb2..4b51542 100644 --- a/asm/jo_r_cpyhead.asm +++ b/asm/jo_r_cpyhead.asm @@ -1,9 +1,9 @@  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;                                                                                      ;; -;;  File      : jo_r_cpyhead.asm                                          /_________/   ;; -;;  Author    : Joe                                                             |       ;; -;;  Date      : 04/2020                                                         |       ;; -;;  Info      : Formats and returns notification head title                     |       ;; +;;  File     : jo_r_cpyhead.asm                                           /_________/   ;; +;;  Author   : Joe                                                              |       ;; +;;  Date     : 04/2020                                                          |       ;; +;;  Info     : Formats and returns notification head title                      |       ;;  ;;                                                                      /       |       ;;  ;;                                                                      \       /       ;;  ;;                                                                       \_____/        ;; diff --git a/asm/jo_r_loop.asm b/asm/jo_r_loop.asm index dccb46c..987f68f 100644 --- a/asm/jo_r_loop.asm +++ b/asm/jo_r_loop.asm @@ -1,9 +1,9 @@  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;                                                                                      ;; -;;  File      : jo_r_loop.asm                                             /_________/   ;; -;;  Author    : Joe                                                             |       ;; -;;  Date      : 04/2020                                                         |       ;; -;;  Info      : The main loop                                                   |       ;; +;;  File     : jo_r_loop.asm                                              /_________/   ;; +;;  Author   : Joe                                                              |       ;; +;;  Date     : 04/2020                                                          |       ;; +;;  Info     : The main loop                                                    |       ;;  ;;                                                                      /       |       ;;  ;;                                                                      \       /       ;;  ;;                                                                       \_____/        ;; diff --git a/asm/jo_r_lowbat.asm b/asm/jo_r_lowbat.asm index 53d56fa..4bc6126 100644 --- a/asm/jo_r_lowbat.asm +++ b/asm/jo_r_lowbat.asm @@ -1,9 +1,9 @@  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;                                                                                      ;; -;;  File      : jo_r_lowbat.asm                                           /_________/   ;; -;;  Author    : Joe                                                             |       ;; -;;  Date      : 04/2020                                                         |       ;; -;;  Info      : The main program                                                |       ;; +;;  File     : jo_r_lowbat.asm                                            /_________/   ;; +;;  Author   : Joe                                                              |       ;; +;;  Date     : 04/2020                                                          |       ;; +;;  Info     : The main program                                                 |       ;;  ;;                                                                      /       |       ;;  ;;                                                                      \       /       ;;  ;;                                                                       \_____/        ;; @@ -20,10 +20,14 @@  section .text  	extern jo_c_args  	extern jo_r_loop -	global jo_r_lowbat +	global main -jo_r_lowbat: +main:  	call	jo_c_args  	mov		rdi, rax  	call	jo_r_loop			; jo_r_loop(speak: 0-1, *argv[]) -	retq + +	xor		rax, rax +	xor		rdi, rdi +	mov		rax, 0x1 +	syscall diff --git a/src/jo_lowbat.c b/src/jo_lowbat.c deleted file mode 100644 index bcfd3c8..0000000 --- a/src/jo_lowbat.c +++ /dev/null @@ -1,22 +0,0 @@ -/****************************************************************************************/ -/*                                                                                      */ -/*  File     : jo_lowbat.c                                                /_________/   */ -/*  Author   : Joe                                                              |       */ -/*  Date     : 04/2020                                                          |       */ -/*  Info     : The main                                                         |       */ -/*                                                                      /       |       */ -/*                                                                      \       /       */ -/*                                                                       \_____/        */ -/*                                                                                      */ -/****************************************************************************************/ - -#include <jo_lowbat.h> -#include <libnotify/notify.h> - -int -main -(int		argc, - const char	*argv[]) -{ -	return (jo_r_lowbat(argc, argv)); -} diff --git a/src/jo_lowbat.h b/src/jo_lowbat.h deleted file mode 100644 index 2a664db..0000000 --- a/src/jo_lowbat.h +++ /dev/null @@ -1,38 +0,0 @@ -/****************************************************************************************/ -/*                                                                                      */ -/*  File     : jo_lowbat.h                                                /_________/   */ -/*  Author   : Joe                                                              |       */ -/*  Date     : 04/2020                                                          |       */ -/*  Info     : The general header                                               |       */ -/*                                                                      /       |       */ -/*                                                                      \       /       */ -/*                                                                       \_____/        */ -/*                                                                                      */ -/****************************************************************************************/ - -#ifndef JO_LOWBAT_H -#define JO_LOWBAT_H - -#include <jo_lowbat.h> -#include <jo_n_speak.h> -#include <jo_n_notify.h> -#include <stdlib.h> -#include <stddef.h> -#include <stdint.h> -#include <stdio.h> - -enum -{ -	JO_RET_FINE, -	JO_RET_RD_FAILED, -	JO_RET_ESPEAK_FAILED -}; - -int8_t	jo_r_lowbat( -			int, -			const char** -			); -int8_t	jo_f_status(void); -int8_t	jo_f_percent(void); - -#endif diff --git a/src/jo_n_notify.c b/src/jo_n_notify.c index a92f2b2..f98ea1d 100644 --- a/src/jo_n_notify.c +++ b/src/jo_n_notify.c @@ -21,7 +21,7 @@ jo_n_notify  {  	NotifyNotification *n; -	notify_init("lowbat"); +	notify_init(JO_LOWBAT);  	n = notify_notification_new(head, body, NULL);  	notify_notification_set_urgency(n, u);  	notify_notification_set_timeout(n, t); diff --git a/src/jo_n_notify.h b/src/jo_n_notify.h index 0bf7ca1..a72395a 100644 --- a/src/jo_n_notify.h +++ b/src/jo_n_notify.h @@ -17,6 +17,8 @@  #include <stddef.h>  #include <stdint.h> +#define	JO_LOWBAT "lowbat" +  void	jo_n_notify(  			const char[],  			const char[], diff --git a/src/jo_n_speak.h b/src/jo_n_speak.h index aedd837..79ca683 100644 --- a/src/jo_n_speak.h +++ b/src/jo_n_speak.h @@ -13,7 +13,6 @@  #ifndef JO_N_SPEAK_H  #define JO_N_SPEAK_H -#include <jo_lowbat.h>  #include <espeak/speak_lib.h>  #include <string.h>  #include <stdlib.h> @@ -21,6 +20,13 @@  #include <stdio.h>  #include <unistd.h> +enum +{ +	JO_RET_FINE, +	JO_RET_RD_FAILED, +	JO_RET_ESPEAK_FAILED +}; +  #define JO_ESPEAK_VOICE "English"  void	jo_n_speak(const char *);  | 
