Skip to content
Snippets Groups Projects
Commit 056eafe6 authored by rswindell's avatar rswindell
Browse files

Added support for -y command-line switch which forces the saving of changes

without prompting the user (for automated configuration changes via script).
parent 04d4f503
Branches
Tags
No related merge requests found
...@@ -45,6 +45,7 @@ scfg_t cfg; /* Synchronet Configuration */ ...@@ -45,6 +45,7 @@ scfg_t cfg; /* Synchronet Configuration */
uifcapi_t uifc; /* User Interface (UIFC) Library API */ uifcapi_t uifc; /* User Interface (UIFC) Library API */
BOOL no_dirchk=FALSE,forcesave=FALSE; BOOL no_dirchk=FALSE,forcesave=FALSE;
static BOOL auto_save=FALSE;
extern BOOL all_msghdr; extern BOOL all_msghdr;
extern BOOL no_msghdr; extern BOOL no_msghdr;
char **opt; char **opt;
...@@ -144,6 +145,9 @@ int main(int argc, char **argv) ...@@ -144,6 +145,9 @@ int main(int argc, char **argv)
textmode(atoi(argv[i]+2)); textmode(atoi(argv[i]+2));
#endif #endif
break; break;
case 'Y':
auto_save=TRUE;
break;
default: default:
printf("\nusage: scfg [ctrl_dir] [options]" printf("\nusage: scfg [ctrl_dir] [options]"
"\n\noptions:\n\n" "\n\noptions:\n\n"
...@@ -166,6 +170,7 @@ int main(int argc, char **argv) ...@@ -166,6 +170,7 @@ int main(int argc, char **argv)
#endif #endif
"-l# = set screen lines to # (default=auto-detect)\r\n" "-l# = set screen lines to # (default=auto-detect)\r\n"
"-b# = set automatic back-up level (default=%d)\r\n" "-b# = set automatic back-up level (default=%d)\r\n"
"-y = automatically save changes (don't ask)\r\n"
,backup_level ,backup_level
); );
exit(0); exit(0);
...@@ -552,6 +557,10 @@ int save_changes(int mode) ...@@ -552,6 +557,10 @@ int save_changes(int mode)
if(!uifc.changes) if(!uifc.changes)
return(2); return(2);
if(auto_save==TRUE) { /* -y switch used, return "Yes" */
uifc.changes=0;
return(0);
}
strcpy(opt[0],"Yes"); strcpy(opt[0],"Yes");
strcpy(opt[1],"No"); strcpy(opt[1],"No");
opt[2][0]=0; opt[2][0]=0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment