[xmp] Add --norc option and fix option parsing

Add the --norc option to bypass configuration files. When parsing lines
in the configuration file, disable paramter matching if we're not in the
section that match the current file's MD5 sum.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
master
Claudio Matsuoka 13 years ago
parent 463a77bba7
commit afea99da32
  1. 1
      src/common.h
  2. 8
      src/main.c
  3. 6
      src/options.c
  4. 2
      src/read_config.c

@ -21,6 +21,7 @@ struct options {
int info; /* display information and exit */
int probeonly; /* probe sound driver and exit */
int nocmd; /* disable interactive commands */
int norc; /* don't read the configuration files */
int dparm; /* driver parameter index */
char *driver_id; /* sound driver ID */
char *out_file; /* output file name */

@ -178,7 +178,9 @@ int main(int argc, char **argv)
opt.dsp = XMP_DSP_LOWPASS;
/* read configuration file */
read_config(&opt);
if (!opt.norc) {
read_config(&opt);
}
get_options(argc, argv, &opt);
@ -316,7 +318,9 @@ int main(int argc, char **argv)
}
xmp_get_module_info(handle, &mi);
read_modconf(&opt, mi.md5);
if (!opt.norc) {
read_modconf(&opt, mi.md5);
}
skipprev = 0;
control.time = 0.0;

@ -34,6 +34,7 @@ enum {
OPT_NOCMD,
OPT_VBLANK,
OPT_FIXLOOP,
OPT_NORC,
};
static void usage(char *s)
@ -66,6 +67,7 @@ static void usage(char *s)
" -l --loop Enable module looping\n"
" -M --mute ch-list Mute the specified channels\n"
" --nocmd Disable interactive commands\n"
" --norc Don't read configuration files\n"
" --offset-bug-emulation Emulate Protracker 2.x bug in effect 9\n"
" -R --random Random order playing\n"
" -S --solo ch-list Set channels to solo mode\n"
@ -113,6 +115,7 @@ static struct option lopt[] = {
{ "mute", 1, 0, 'M' },
{ "null", 0, 0, 'N' },
{ "nocmd", 0, 0, OPT_NOCMD },
{ "norc", 0, 0, OPT_NORC },
{ "nofilter", 0, 0, 'F' },
{ "offset-bug-emulation",0, 0, OPT_FX9BUG },
{ "output-file", 1, 0, 'o' },
@ -209,6 +212,9 @@ void get_options(int argc, char **argv, struct options *options)
case OPT_NOCMD:
options->nocmd = 1;
break;
case OPT_NORC:
options->norc = 1;
break;
case 'o':
options->out_file = optarg;
if (strlen(optarg) >= 4 &&

@ -198,6 +198,8 @@ static void parse_modconf(struct options *o, char *confname, unsigned char *md5)
if (line[0] == '[') {
if (compare_md5(md5, line + 1) == 0) {
active = 1;
} else {
active = 0;
}
continue;
}

Loading…
Cancel
Save