Moved restore file logic into its own file
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RECBACKLIGHT_CMD_H
|
||||
#ifndef REXBACKLIGHT_CMD_H
|
||||
#define REXBACKLIGHT_CMD_H
|
||||
|
||||
#define OP_INC 1
|
||||
|
||||
@@ -30,11 +30,26 @@
|
||||
#define RETVAL_INTERNAL_ERROR 7
|
||||
#define RETVAL_SUCCESS EXIT_SUCCESS
|
||||
|
||||
#define IO_ERROR_DIR "directory"
|
||||
#define IO_ERROR_FILE "file"
|
||||
#define IO_ERROR_OPEN "open"
|
||||
#define IO_ERROR_READ "read"
|
||||
#define IO_ERROR_WRITE "write to"
|
||||
|
||||
void io_error(const char* error, const char* type, const char* name);
|
||||
void io_error_2(const char* error, const char* type, const char* name, const char* name2);
|
||||
void io_error_3(const char* error, const char* type, const char* name, const char* name2, const char* name3);
|
||||
|
||||
|
||||
extern int return_value;
|
||||
|
||||
struct string_array{
|
||||
char** list;
|
||||
int size;
|
||||
};
|
||||
|
||||
void mem_error(void);
|
||||
_Noreturn void version(void);
|
||||
_Noreturn void usage(int exit_val);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
28
include/globals.h
Normal file
28
include/globals.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
rexbacklight
|
||||
Copyright (C) 2018 rexy712
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
|
||||
const char* device_dir(void);
|
||||
const char* executable_name(void);
|
||||
const char* restore_file(void);
|
||||
const char* brightness_file(void);
|
||||
const char* max_brightness_file(void);
|
||||
|
||||
#endif
|
||||
36
include/restore.h
Normal file
36
include/restore.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
rexbacklight
|
||||
Copyright (C) 2018 rexy712
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RESTORE_H
|
||||
#define RESTORE_H
|
||||
|
||||
#include <rjp.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "cmd.h"
|
||||
|
||||
void save_restore_file(struct string_array* devices);
|
||||
void process_restore_file(void);
|
||||
int prep_restore(struct arg_values* curr, RJP_value** root, int* try_restore);
|
||||
RJP_value* find_matching_json_device(const char* name, RJP_value* root);
|
||||
RJP_value* read_restore_file(const char* file);
|
||||
char* get_home_folder();
|
||||
char* get_home_restore_file();
|
||||
|
||||
|
||||
#endif
|
||||
27
include/rexbacklight.h
Normal file
27
include/rexbacklight.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
rexbacklight
|
||||
Copyright (C) 2018 rexy712
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef REXBACKLIGHT_H
|
||||
#define REXBACKLIGHT_H
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
float get_brightness(const char* file);
|
||||
int individual_device_op(struct arg_values* curr);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user