Commit 8d649b6c authored by rswindell's avatar rswindell
Browse files

Cosmetic change only:

Wrap all read_*_cfg() and write_*_cfg() calls with simple functions that
display popup messages that the Reading or Writing is being performed.
There was already copy/pasta everywhere for the Reading ... cnf files, but
nothing for writing.
parent bb721a40
......@@ -491,106 +491,80 @@ int main(int argc, char **argv)
switch(uifc.list(WIN_ORG|WIN_MID|WIN_ESC|WIN_ACT,0,0,30,&main_dflt,0
,"Configure",mopt)) {
case 0:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
node_menu();
free_main_cfg(&cfg);
break;
case 1:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop("Reading xtrn.cnf ...");
if(!read_xtrn_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_xtrn_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
sys_cfg();
free_xtrn_cfg(&cfg);
free_main_cfg(&cfg);
break;
case 2:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop("Reading msgs.cnf ...");
if(!read_msgs_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_msgs_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
net_cfg();
free_msgs_cfg(&cfg);
free_main_cfg(&cfg);
break;
case 3:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop("Reading file.cnf ...");
if(!read_file_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_file_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
xfer_cfg();
free_file_cfg(&cfg);
free_main_cfg(&cfg);
break;
case 4:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop("Reading file.cnf ...");
if(!read_file_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_file_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
xfer_opts();
free_file_cfg(&cfg);
free_main_cfg(&cfg);
break;
case 5:
uifc.pop("Reading chat.cnf ...");
if(!read_chat_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_chat_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
while(1) {
i=0;
strcpy(opt[i++],"Artificial Gurus");
......@@ -609,7 +583,7 @@ int main(int argc, char **argv)
if(j==-1)
continue;
if(!j) {
write_chat_cfg(&cfg,backup_level);
save_chat_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
break;
......@@ -632,93 +606,70 @@ int main(int argc, char **argv)
free_chat_cfg(&cfg);
break;
case 6:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop("Reading msgs.cnf ...");
if(!read_msgs_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_msgs_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
msgs_cfg();
free_msgs_cfg(&cfg);
free_main_cfg(&cfg);
break;
case 7:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop("Reading msgs.cnf ...");
if(!read_msgs_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_msgs_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
msg_opts();
free_msgs_cfg(&cfg);
free_main_cfg(&cfg);
break;
case 8:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
shell_cfg();
free_main_cfg(&cfg);
break;
case 9:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop("Reading xtrn.cnf ...");
if(!read_xtrn_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_xtrn_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
xprogs_cfg();
free_xtrn_cfg(&cfg);
free_main_cfg(&cfg);
break;
case 10:
uifc.pop("Reading main.cnf ...");
if(!read_main_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_main_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop("Reading file.cnf ...");
if(!read_file_cfg(&cfg,error)) {
uifc.pop(0);
if(!load_file_cfg(&cfg,error)) {
sprintf(errormsg,"ERROR: %s",error);
uifc.msg(errormsg);
break;
}
uifc.pop(0);
txt_cfg();
free_file_cfg(&cfg);
free_main_cfg(&cfg);
......@@ -742,6 +693,103 @@ int main(int argc, char **argv)
}
}
BOOL load_main_cfg(scfg_t* cfg, char *error)
{
uifc.pop("Reading main.cnf ...");
BOOL result = read_main_cfg(cfg, error);
uifc.pop(NULL);
return result;
}
BOOL load_node_cfg(scfg_t* cfg, char *error)
{
uifc.pop("Reading node.cnf ...");
BOOL result = read_node_cfg(cfg, error);
uifc.pop(NULL);
return result;
}
BOOL load_msgs_cfg(scfg_t* cfg, char *error)
{
uifc.pop("Reading msgs.cnf ...");
BOOL result = read_msgs_cfg(cfg, error);
uifc.pop(NULL);
return result;
}
BOOL load_file_cfg(scfg_t* cfg, char *error)
{
uifc.pop("Reading file.cnf ...");
BOOL result = read_file_cfg(cfg, error);
uifc.pop(NULL);
return result;
}
BOOL load_chat_cfg(scfg_t* cfg, char *error)
{
uifc.pop("Reading chat.cnf ...");
BOOL result = read_chat_cfg(cfg, error);
uifc.pop(NULL);
return result;
}
BOOL load_xtrn_cfg(scfg_t* cfg, char *error)
{
uifc.pop("Reading xtrn.cnf ...");
BOOL result = read_xtrn_cfg(cfg, error);
uifc.pop(NULL);
return result;
}
BOOL save_main_cfg(scfg_t* cfg, int backup_level)
{
uifc.pop("Writing main.cnf ...");
BOOL result = write_main_cfg(cfg, backup_level);
uifc.pop(NULL);
return result;
}
BOOL save_node_cfg(scfg_t* cfg, int backup_level)
{
uifc.pop("Writing node.cnf ...");
BOOL result = write_node_cfg(cfg, backup_level);
uifc.pop(NULL);
return result;
}
BOOL save_msgs_cfg(scfg_t* cfg, int backup_level)
{
uifc.pop("Writing msgs.cnf ...");
BOOL result = write_msgs_cfg(cfg, backup_level);
uifc.pop(NULL);
return result;
}
BOOL save_file_cfg(scfg_t* cfg, int backup_level)
{
uifc.pop("Writing file.cnf ...");
BOOL result = write_file_cfg(cfg, backup_level);
uifc.pop(NULL);
return result;
}
BOOL save_chat_cfg(scfg_t* cfg, int backup_level)
{
uifc.pop("Writing chat.cnf ...");
BOOL result = write_chat_cfg(cfg, backup_level);
uifc.pop(NULL);
return result;
}
BOOL save_xtrn_cfg(scfg_t* cfg, int backup_level)
{
uifc.pop("Writing xtrn.cnf ...");
BOOL result = write_xtrn_cfg(cfg, backup_level);
uifc.pop(NULL);
return result;
}
/****************************************************************************/
/* Checks the uifc.changes variable. If there have been no uifc.changes, returns 2. */
/* If there have been uifc.changes, it prompts the user to change or not. If the */
......@@ -815,7 +863,7 @@ void txt_cfg()
if(j==-1)
continue;
if(!j) {
write_file_cfg(&cfg,backup_level);
save_file_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
return;
......@@ -987,7 +1035,7 @@ void shell_cfg()
continue;
if(!j) {
cfg.new_install=new_install;
write_main_cfg(&cfg,backup_level);
save_main_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
return;
......@@ -2158,21 +2206,17 @@ void bail(int code)
getchar();
}
else if(forcesave) {
uifc.pop("Loading Configs...");
read_main_cfg(&cfg,error);
read_msgs_cfg(&cfg,error);
read_file_cfg(&cfg,error);
read_chat_cfg(&cfg,error);
read_xtrn_cfg(&cfg,error);
uifc.pop(NULL);
uifc.pop("Writing Configs...");
load_main_cfg(&cfg,error);
load_msgs_cfg(&cfg,error);
load_file_cfg(&cfg,error);
load_chat_cfg(&cfg,error);
load_xtrn_cfg(&cfg,error);
cfg.new_install=new_install;
write_main_cfg(&cfg,backup_level);
write_msgs_cfg(&cfg,backup_level);
write_file_cfg(&cfg,backup_level);
write_chat_cfg(&cfg,backup_level);
write_xtrn_cfg(&cfg,backup_level);
uifc.pop(NULL);
save_main_cfg(&cfg,backup_level);
save_msgs_cfg(&cfg,backup_level);
save_file_cfg(&cfg,backup_level);
save_chat_cfg(&cfg,backup_level);
save_xtrn_cfg(&cfg,backup_level);
}
uifc.pop("Exiting");
......
......@@ -148,8 +148,19 @@ void sort_subs(int grpnum);
void sort_dirs(int libnum);
unsigned subs_in_group(unsigned grpnum);
char random_code_char(void);
BOOL load_main_cfg(scfg_t*, char*);
BOOL load_node_cfg(scfg_t*, char*);
BOOL load_msgs_cfg(scfg_t*, char*);
BOOL load_file_cfg(scfg_t*, char*);
BOOL load_chat_cfg(scfg_t*, char*);
BOOL load_xtrn_cfg(scfg_t*, char*);
BOOL save_main_cfg(scfg_t*, int);
BOOL save_node_cfg(scfg_t*, int);
BOOL save_msgs_cfg(scfg_t*, int);
BOOL save_file_cfg(scfg_t*, int);
BOOL save_chat_cfg(scfg_t*, int);
BOOL save_xtrn_cfg(scfg_t*, int);
long import_msg_areas(enum import_list_type, FILE*, unsigned grpnum, int min_confnum, int max_confnum, qhub_t*, long* added);
/* Prepare a string to be used as an internal code; Note: use the return value, Luke */
......
......@@ -449,7 +449,7 @@ void msgs_cfg()
if(j==-1)
continue;
if(!j) {
write_msgs_cfg(&cfg,backup_level);
save_msgs_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
return;
......@@ -1024,8 +1024,8 @@ void msg_opts()
continue;
if(!i) {
cfg.new_install=new_install;
write_msgs_cfg(&cfg,backup_level);
write_main_cfg(&cfg,backup_level);
save_msgs_cfg(&cfg,backup_level);
save_main_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
return;
......
......@@ -785,7 +785,7 @@ void net_cfg()
if(i==-1)
continue;
if(!i) {
write_msgs_cfg(&cfg,backup_level);
save_msgs_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
break;
......@@ -1246,7 +1246,7 @@ BOOL import_qwk_conferences(uint qhubnum)
long added = 0;
long ported = import_msg_areas(IMPORT_LIST_TYPE_QWK_CONTROL_DAT, fp, grpnum, min_confnum, max_confnum, cfg.qhub[qhubnum], &added);
fclose(fp);
uifc.pop(0);
uifc.pop(NULL);
if(ported < 0)
sprintf(str, "!ERROR %ld imported message areas", ported);
else {
......
......@@ -88,7 +88,7 @@ void node_menu()
if(!i) {
--cfg.sys_nodes;
cfg.new_install=new_install;
write_main_cfg(&cfg,backup_level);
save_main_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
continue;
......@@ -96,9 +96,7 @@ void node_menu()
if(msk == MSK_INS) {
SAFECOPY(cfg.node_dir,cfg.node_path[cfg.sys_nodes-1]);
i=cfg.sys_nodes+1;
uifc.pop("Reading node.cnf ...");
read_node_cfg(&cfg,error);
uifc.pop(0);
load_node_cfg(&cfg,error);
sprintf(str,"../node%d/",i);
sprintf(tmp,"Node %d Path",i);
uifc.helpbuf=
......@@ -124,8 +122,8 @@ void node_menu()
SAFEPRINTF(cfg.node_name,"Node %u",cfg.node_num);
SAFECOPY(cfg.node_phone,"N/A");
cfg.new_install=new_install;
write_node_cfg(&cfg,backup_level);
write_main_cfg(&cfg,backup_level);
save_node_cfg(&cfg,backup_level);
save_main_cfg(&cfg,backup_level);
free_node_cfg(&cfg);
refresh_cfg(&cfg);
continue;
......@@ -135,9 +133,7 @@ void node_menu()
free_node_cfg(&cfg);
i&=MSK_OFF;
SAFECOPY(cfg.node_dir,cfg.node_path[i]);
uifc.pop("Reading node.cnf ...");
read_node_cfg(&cfg,error);
uifc.pop(0);
load_node_cfg(&cfg,error);
savnode=1;
continue;
}
......@@ -145,7 +141,7 @@ void node_menu()
i&=MSK_OFF;
SAFECOPY(cfg.node_dir,cfg.node_path[i]);
cfg.node_num=i+1;
write_node_cfg(&cfg,backup_level);
save_node_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
uifc.changes=1;
continue;
......@@ -158,12 +154,10 @@ void node_menu()
SAFECOPY(cfg.node_dir,cfg.node_path[i]);
prep_dir(cfg.ctrl_dir, cfg.node_dir, sizeof(cfg.node_dir));
uifc.pop("Reading node.cnf ...");
read_node_cfg(&cfg,error);
uifc.pop(0);
load_node_cfg(&cfg,error);
if (cfg.node_num != i + 1) { /* Node number isn't right? */
cfg.node_num = i + 1; /* so fix it */
write_node_cfg(&cfg, backup_level); /* and write it back */
save_node_cfg(&cfg, backup_level); /* and write it back */
}
node_cfg();
......@@ -199,7 +193,7 @@ void node_cfg()
case -1:
i=save_changes(WIN_MID|WIN_SAV);
if(!i) {
write_node_cfg(&cfg,backup_level);
save_node_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
if(i!=-1)
......
......@@ -125,7 +125,7 @@ void sys_cfg(void)
break;
if(!i) {
cfg.new_install=new_install;
write_main_cfg(&cfg,backup_level);
save_main_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
return;
......
......@@ -102,7 +102,7 @@ void xfer_opts()
if(i==-1)
break;
if(!i) {
write_file_cfg(&cfg,backup_level);
save_file_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
return;
......
......@@ -171,7 +171,7 @@ BOOL create_raw_dir_list(const char* list_file)
backslash(path);
uifc.pop("Scanning Directories...");
append_dir_list(path, path, fp, /* depth: */0, /* max_depth: */k, include_empty_dirs);
uifc.pop(0);
uifc.pop(NULL);
fclose(fp);
return(TRUE);
}
......@@ -261,7 +261,7 @@ void xfer_cfg()
if(j==-1)
continue;
if(!j) {
write_file_cfg(&cfg,backup_level);
save_file_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
return;
......@@ -630,7 +630,7 @@ void xfer_cfg()
fprintf(stream,"***END-OF-DIR***\n\n");
}
fclose(stream);
uifc.pop(0);
uifc.pop(NULL);
sprintf(str,"%lu File Areas Exported Successfully",ported);
uifc.msg(str);
uifc.changes=q;
......@@ -907,7 +907,7 @@ void xfer_cfg()
fclose(stream);
if(ported && cfg.lib[i]->sort)
sort_dirs(i);
uifc.pop(0);
uifc.pop(NULL);
sprintf(str,"%lu File Areas Imported Successfully (%lu added)",ported, added);
uifc.msg(str);
break;
......
......@@ -307,8 +307,8 @@ void xprogs_cfg()
break;
if(!i) {
cfg.new_install=new_install;
write_xtrn_cfg(&cfg,backup_level);
write_main_cfg(&cfg,backup_level);
save_xtrn_cfg(&cfg,backup_level);
save_main_cfg(&cfg,backup_level);
refresh_cfg(&cfg);
}
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment