Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

many improvements to the config facility and usage #519

Merged
merged 8 commits into from
Mar 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
some more atoi(get_conf_value(...)) replacements
Those didn't match the sed formula.
  • Loading branch information
npitre committed Mar 21, 2021
commit 21cd10563f1eb3a989dd9ebf3dd3c8d5de4ccdf2
2 changes: 1 addition & 1 deletion src/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void free_colors_param_dict() {
*/

void chg_color(char * str) {
if (atoi((char *) get_conf_value("nocurses"))) return;
if (get_conf_int("nocurses")) return;

// Create key-value dictionary for the content of the string
struct dictionary * d = create_dictionary();
Expand Down
28 changes: 14 additions & 14 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ int main (int argc, char ** argv) {
read_argv(argc, argv);

// check if help is in argv. if so, show usage and quit
if (atoi((char *) get_conf_value("help"))) // atoi converts string to an int
if (get_conf_int("help"))
show_usage_and_quit();

// check if version is in argv. if so, show version and quit
if (atoi((char *) get_conf_value("version"))) // atoi converts string to an int
if (get_conf_int("version"))
show_version_and_quit();

// create command line history structure
if (! atoi((char *) get_conf_value("nocurses"))) {
if (! get_conf_int("nocurses")) {
#ifdef HISTORY_FILE
commandline_history = (struct history *) create_history(':');
load_history(commandline_history, ':'); // load the command history file
Expand All @@ -229,7 +229,7 @@ int main (int argc, char ** argv) {
if (! growtbl(GROWNEW, 0, 0)) return exit_app(1);

// initiate NCURSES if that is what is wanted
if (! atoi((char *) get_conf_value("nocurses"))) {
if (! get_conf_int("nocurses")) {
ui_start_screen();

#ifdef USECOLORS
Expand Down Expand Up @@ -258,7 +258,7 @@ int main (int argc, char ** argv) {
return exit_app(-1);
}

if (! atoi((char *) get_conf_value("nocurses"))) { // WE MUST STOP SCREEN!
if (! get_conf_int("nocurses")) { // WE MUST STOP SCREEN!
ui_stop_screen();

// if output is set, nocurses should always be 1 !
Expand Down Expand Up @@ -292,7 +292,7 @@ int main (int argc, char ** argv) {

// initiate ui
FILE * f;
if ( ! atoi((char *) get_conf_value("nocurses"))) {
if ( ! get_conf_int("nocurses")) {
// we show welcome screen if no spreadsheet was passed to SC-IM
// and no input was sent throw pipeline
if ( ! curfile[0] && ! wcslen(stdin_buffer)) {
Expand All @@ -310,7 +310,7 @@ int main (int argc, char ** argv) {
}

// handle input from keyboard
if (! atoi((char *) get_conf_value("nocurses")))
if (! get_conf_int("nocurses"))
buffer = (struct block *) create_buf(); // this should only take place if curses ui

wchar_t nocurses_buffer[BUFFERSIZE];
Expand Down Expand Up @@ -340,15 +340,15 @@ int main (int argc, char ** argv) {
}


while ( ! shall_quit && ! atoi((char *) get_conf_value("quit_afterload"))) {
while ( ! shall_quit && ! get_conf_int("quit_afterload")) {
// save current time for runtime timer
gettimeofday(&current_tv, NULL);