.
.\" Document /////////////////////////////////////////////////////////////
.\" ----------------------------------------------------------------------
-.TH TOP 1 "January 2018" "procps-ng" "User Commands"
+.TH TOP 1 "May 2018" "procps-ng" "User Commands"
.\" ----------------------------------------------------------------------
.\" ----------------------------------------------------------------------
" # discussed below
.fi
-If the $HOME and $XDG_CONFIG_HOME variables are not present, \*(We will try
-to write the personal \*(CF in the current directory, subject to permissions.
+If a valid absolute path to the rcfile cannot be established, customizations
+made to a running \*We will be impossible to preserve.
.\" ......................................................................
.SS 6b. ADDING INSPECT Entries
/*
- * A configs_read *Helper* function responsible for processing
+ * A configs_reads *Helper* function responsible for processing
* a configuration file (personal or system-wide default) */
static const char *config_file (FILE *fp, const char *name, float *delay) {
char fbuf[LRGBUFSIZ];
} // end: config_file
-static int snprintf_Rc_name (const char *const format, ...) __attribute__((format(printf,1,2)));
-static int snprintf_Rc_name (const char *const format, ...) {
+ /*
+ * A configs_reads *Helper* function responsible for ensuring the
+ * complete path was established, otherwise force the 'W' to fail */
+static int configs_path (const char *const fmts, ...) __attribute__((format(printf,1,2)));
+static int configs_path (const char *const fmts, ...) {
int len;
va_list ap;
- va_start(ap, format);
- len = vsnprintf(Rc_name, sizeof(Rc_name), format, ap);
+
+ va_start(ap, fmts);
+ len = vsnprintf(Rc_name, sizeof(Rc_name), fmts, ap);
va_end(ap);
if (len <= 0 || (size_t)len >= sizeof(Rc_name)) {
Rc_name[0] = '\0';
- return 0;
+ len = 0;
}
return len;
-}
+} // end: configs_path
+
/*
* Try reading up to 3 rcfiles
* Any remaining lines are devoted to the 'Inspect Other' feature
* 3. 'SYS_RCDEFAULTS' system-wide defaults if 'Rc_name' absent
* format is identical to #2 above */
-static void configs_read (void) {
+static void configs_reads (void) {
float tmp_delay = DEF_DELAY;
const char *p, *p_home;
FILE *fp;
}
}
if (p_home) {
- snprintf_Rc_name("%s/.%src", p_home, Myname);
+ configs_path("%s/.%src", p_home, Myname);
}
if (!(fp = fopen(Rc_name, "r"))) {
p = fmtmk("%s/.config", p_home);
(void)mkdir(p, 0700);
}
- if (!snprintf_Rc_name("%s/procps", p)) goto system_default;
+ if (!configs_path("%s/procps", p)) goto system_default;
(void)mkdir(Rc_name, 0700);
- if (!snprintf_Rc_name("%s/procps/%src", p, Myname)) goto system_default;
+ if (!configs_path("%s/procps/%src", p, Myname)) goto system_default;
fp = fopen(Rc_name, "r");
}
#else
error_exit(p);
#endif
-} // end: configs_read
+} // end: configs_reads
/*
before(*argv);
// +-------------+
wins_stage_1(); // top (sic) slice
- configs_read(); // > spread etc, <
+ configs_reads(); // > spread etc, <
parse_args(&argv[1]); // > lean stuff, <
whack_terminal(); // > onions etc. <
wins_stage_2(); // as bottom slice
//atic void before (char *me);
//atic int config_cvt (WIN_t *q);
//atic const char *config_file (FILE *fp, const char *name, float *delay);
-//atic void configs_read (void);
+//atic int configs_path (const char *const fmts, ...);
+//atic void configs_reads (void);
//atic void parse_args (char **args);
//atic void whack_terminal (void);
/*------ Windows/Field Groups support ----------------------------------*/