Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Stefan Rueger
be59cf916d Revert "Look for ~/.config/avrdude/avrduce.rc configuration file (#1131)"
This reverts commit 34fa2faba5.
2022-10-23 21:53:16 +01:00
5 changed files with 29 additions and 59 deletions

View file

@ -1320,10 +1320,10 @@ the CS line being managed outside the application.
.Sh FILES .Sh FILES
.Bl -tag -offset indent -width /dev/ppi0XXX .Bl -tag -offset indent -width /dev/ppi0XXX
.It Pa /dev/ppi0 .It Pa /dev/ppi0
Default device to be used for communication with the programming default device to be used for communication with the programming
hardware hardware
.It Pa avrdude.conf .It Pa avrdude.conf
Programmer and parts configuration file programmer and parts configuration file
.Pp .Pp
On Windows systems, this file is looked up in the same directory as the On Windows systems, this file is looked up in the same directory as the
executable file. executable file.
@ -1332,22 +1332,14 @@ On all other systems, the file is first looked up in
relative to the path of the executable, then in the same directory as relative to the path of the executable, then in the same directory as
the executable itself, and finally in the system default location the executable itself, and finally in the system default location
.Pa ${PREFIX}/etc/avrdude.conf . .Pa ${PREFIX}/etc/avrdude.conf .
.It Pa ${XDG_CONFIG_HOME}/avrdude/avrdude.rc
Local programmer and parts configuration file (per-user overrides); it follows the same syntax as
.Pa avrdude.conf ;
if the
.Pa ${XDG_CONFIG_HOME}
environment variable is not set or empty, the directory
.Pa ${HOME}/.config/
is used instead.
.It Pa ${HOME}/.avrduderc .It Pa ${HOME}/.avrduderc
Alternative location of the per-user configuration file if above file does not exist programmer and parts configuration file (per-user overrides)
.It Pa ~/.inputrc .It Pa ~/.inputrc
Initialization file for the Initialization file for the
.Xr readline 3 .Xr readline 3
library library
.It Pa <prefix>/doc/avrdude/avrdude.pdf .It Pa ${PREFIX}/share/doc/avrdude/avrdude.pdf
User manual Schematic of programming hardware
.El .El
.\" .Sh EXAMPLES .\" .Sh EXAMPLES
.Sh DIAGNOSTICS .Sh DIAGNOSTICS

View file

@ -389,7 +389,7 @@
# ATmega169 0x78 # ATmega169 0x78
# #
# Overall avrdude defaults; suitable for ~/.config/avrdude/config # Overall avrdude defaults; suitable for ~/.avrduderc
# #
default_parallel = "@DEFAULT_PAR_PORT@"; default_parallel = "@DEFAULT_PAR_PORT@";
default_serial = "@DEFAULT_SER_PORT@"; default_serial = "@DEFAULT_SER_PORT@";

View file

@ -26,7 +26,6 @@
#define USER_CONF_FILE "avrdude.rc" #define USER_CONF_FILE "avrdude.rc"
#else #else
#define USER_CONF_FILE ".avrduderc" #define USER_CONF_FILE ".avrduderc"
#define XDG_USER_CONF_FILE "avrdude/avrdude.rc"
#endif #endif
extern char *progname; // name of program, for messages extern char *progname; // name of program, for messages

View file

@ -1714,24 +1714,21 @@ AVRDUDE reads a configuration file upon startup which describes all of
the parts and programmers that it knows about. The advantage of this is the parts and programmers that it knows about. The advantage of this is
that if you have a chip that is not currently supported by AVRDUDE, you that if you have a chip that is not currently supported by AVRDUDE, you
can add it to the configuration file without waiting for a new release can add it to the configuration file without waiting for a new release
of AVRDUDE. Likewise, if you have a parallel port programmer that is of AVRDUDE. Likewise, if you have a parallel port programmer that is
not supported, chances are that you can copy an not supported by AVRDUDE, chances are good that you can copy and
existing programmer definition and, with only a few changes, make your existing programmer definition, and with only a few changes, make your
programmer work. programmer work with AVRDUDE.
AVRDUDE first looks for a system wide configuration file in a platform AVRDUDE first looks for a system wide configuration file in a platform
dependent location. On Unix, this is usually dependent location. On Unix, this is usually
@code{/usr/local/etc/avrdude.conf}, whilst on Windows it is usually in the @code{/usr/local/etc/avrdude.conf}, while on Windows it is usually in the
same location as the executable file. The full name of this file can be same location as the executable file. The name of this file can be
specified using the @option{-C} command line option. After parsing the system wide changed using the @option{-C} command line option. After the system wide
configuration file, AVRDUDE looks for a per-user configuration configuration file is parsed, AVRDUDE looks for a per-user configuration
file to augment or override the system wide defaults. On Unix, the file to augment or override the system wide defaults. On Unix, the
per-user file is @code{$@{XDG_CONFIG_HOME@}/avrdude/avrdude.rc}, whereas per-user file is @code{.avrduderc} within the user's home directory. On
if @code{$@{XDG_CONFIG_HOME@}} is either not set or empty, Windows, this file is the @code{avrdude.rc} file located in the same
@code{$@{HOME@}/.config/} is used instead. If that does not exists directory as the executable.
@code{.avrduderc} within the user's home directory is used. On Windows,
this file is the @code{avrdude.rc} file located in the same directory as
the executable.
@menu @menu
* AVRDUDE Defaults:: * AVRDUDE Defaults::

View file

@ -425,32 +425,6 @@ static void exit_part_not_found(const char *partdesc) {
} }
#if !defined(WIN32)
// Safely concatenate dir/file into dst that has size n
static char *concatpath(char *dst, char *dir, char *file, size_t n) {
// Dir or file empty?
if(!dir || !*dir || !file || !*file)
return NULL;
size_t len = strlen(dir);
// Insufficient space?
if(len + (dir[len-1] != '/') + strlen(file) > n-1)
return NULL;
if(dst != dir)
strcpy(dst, dir);
if(dst[len-1] != '/')
strcat(dst, "/");
strcat(dst, file);
return dst;
}
#endif
/* /*
* main routine * main routine
*/ */
@ -491,6 +465,10 @@ int main(int argc, char * argv [])
char * logfile; /* Use logfile rather than stderr for diagnostics */ char * logfile; /* Use logfile rather than stderr for diagnostics */
enum updateflags uflags = UF_AUTO_ERASE | UF_VERIFY; /* Flags for do_op() */ enum updateflags uflags = UF_AUTO_ERASE | UF_VERIFY; /* Flags for do_op() */
#if !defined(WIN32)
char * homedir;
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
_set_printf_count_output(1); _set_printf_count_output(1);
#endif #endif
@ -878,10 +856,14 @@ int main(int argc, char * argv [])
win_usr_config_set(usr_config); win_usr_config_set(usr_config);
#else #else
usr_config[0] = 0; usr_config[0] = 0;
if(!concatpath(usr_config, getenv("XDG_CONFIG_HOME"), XDG_USER_CONF_FILE, sizeof usr_config)) homedir = getenv("HOME");
concatpath(usr_config, getenv("HOME"), ".config/" XDG_USER_CONF_FILE, sizeof usr_config); if (homedir != NULL) {
if(stat(usr_config, &sb) < 0 || (sb.st_mode & S_IFREG) == 0) strcpy(usr_config, homedir);
concatpath(usr_config, getenv("HOME"), USER_CONF_FILE, sizeof usr_config); i = strlen(usr_config);
if (i && (usr_config[i - 1] != '/'))
strcat(usr_config, "/");
strcat(usr_config, USER_CONF_FILE);
}
#endif #endif
if (quell_progress == 0) if (quell_progress == 0)