Search for .mspdebug in current directory first.

This commit is contained in:
Daniel Beer 2013-04-04 15:53:38 +13:00
parent 8bed72bb48
commit 09c2acbfd6
2 changed files with 18 additions and 11 deletions

View File

@ -20,10 +20,13 @@ It supports a variety of file formats, described in the section
\fBBINARY FORMATS\fR below. It can also be used as a remote stub \fBBINARY FORMATS\fR below. It can also be used as a remote stub
for \fBgdb\fR(1). for \fBgdb\fR(1).
On startup, MSPDebug will look for a file called .mspdebug in the user's On startup, MSPDebug will look for a file called .mspdebug first in the
home directory. If it exists, commands will be read and executed from this current directory, and then in the user's home directory. If either file
file before executing any other commands or starting the interactive exists, commands will be read and executed from this file before
reader. executing any other commands or starting the interactive reader.
Alternatively, a configuration file can be explicitly specified with the
\fB-C\fR option.
.SH COMMAND-LINE OPTIONS .SH COMMAND-LINE OPTIONS
Command-line options accepted by MSPDebug are described below. If Command-line options accepted by MSPDebug are described below. If
commands are specified on the end of the command-line, then they are commands are specified on the end of the command-line, then they are

View File

@ -152,14 +152,18 @@ static void process_rc_file(const char *config)
char text[256]; char text[256];
if (!config) { if (!config) {
const char *home = getenv("HOME"); if (!access(".mspdebug", F_OK)) {
config = ".mspdebug";
} else {
const char *home = getenv("HOME");
if (!home) if (home) {
return; snprintf(text, sizeof(text), "%s/.mspdebug",
home);
snprintf(text, sizeof(text), "%s/.mspdebug", home); if (!access(text, F_OK))
if (!access(text, F_OK)) config = text;
config = text; }
}
} }
if (config) if (config)