patch #7699 Read additional config files

* main.c: Added reading of additional config files
* avrdude.1: updated man page
* doc/avrdude.texi: updated documentation


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1038 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Rene Liebscher 2012-01-10 18:07:19 +00:00
parent 4ecc6bb0fb
commit 581b66b3a2
4 changed files with 61 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2012-01-10 Rene Liebscher <R.Liebscher@gmx.de>
patch #7699 Read additional config files
* main.c: Added reading of additional config files
* avrdude.1: updated man page
* doc/avrdude.texi: updated documentation
2012-01-10 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Bob Frazier:

View File

@ -269,6 +269,16 @@ submit a patch back to the author so that it can be incorporated for
the next version). See the config file, located at
.Pa ${PREFIX}/etc/avrdude.conf ,
which contains a description of the format.
.Pp
If
.Ar config-file
is written as
.Pa +filename
then this file is read after the system wide and user configuration
files. This can be used to add entries to the configuration
without patching your system wide configuration file. It can be used
several times, the files are read in same order as given on the command
line.
.It Fl D
Disable auto erase for flash. When the
.Fl U

View File

@ -513,6 +513,14 @@ specified, AVRDUDE reads the configuration file from
/usr/local/etc/avrdude.conf (FreeBSD and Linux). See Appendix A for
the method of searching for the configuration file for Windows.
If @var{config-file} is written as @var{+filename}
then this file is read after the system wide and user configuration
files. This can be used to add entries to the configuration
without patching your system wide configuration file. It can be used
several times, the files are read in same order as given on the command
line.
@item -D
Disable auto erase for flash. When the -U option with flash memory is
specified, avrdude will perform a chip erase before starting any of the

34
main.c
View File

@ -75,6 +75,8 @@ static LISTID updates;
static LISTID extended_params;
static LISTID additional_config_files;
static PROGRAMMER * pgm;
/*
@ -342,6 +344,12 @@ int main(int argc, char * argv [])
exit(1);
}
additional_config_files = lcreat(NULL, 0);
if (additional_config_files == NULL) {
fprintf(stderr, "%s: cannot initialize additional config files list\n", progname);
exit(1);
}
partdesc = NULL;
port = default_parallel;
erase = 0;
@ -448,8 +456,12 @@ int main(int argc, char * argv [])
break;
case 'C': /* system wide configuration file */
if (optarg[0] == '+') {
ladd(additional_config_files, optarg+1);
} else {
strncpy(sys_config, optarg, PATH_MAX);
sys_config[PATH_MAX-1] = 0;
}
break;
case 'D': /* disable auto erase */
@ -620,6 +632,28 @@ int main(int argc, char * argv [])
}
}
}
if (lsize(additional_config_files) > 0) {
LNODEID ln1;
const char * p = NULL;
for (ln1=lfirst(additional_config_files); ln1; ln1=lnext(ln1)) {
p = ldata(ln1);
if (verbose) {
fprintf(stderr, "%sAdditional configuration file is \"%s\"\n",
progbuf, p);
}
rc = read_config(p);
if (rc) {
fprintf(stderr,
"%s: error reading additional configuration file \"%s\"\n",
progname, p);
exit(1);
}
}
}
// set bitclock from configuration files unless changed by command line
if (default_bitclock > 0 && bitclock == 0.0) {
bitclock = default_bitclock;