diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-07-26 23:09:29 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-07-26 23:09:29 +0300 |
commit | 11bbc1b9d551ceb2783c575d2d1d4d451d7e4ecf (patch) | |
tree | 5ccf070967875b7309579307f93e550881720bdc /src/cmdline.opt | |
parent | 7deb822b3b7789f5b3a982895b30ec757d1ab5f2 (diff) | |
download | idest-11bbc1b9d551ceb2783c575d2d1d4d451d7e4ecf.tar.gz idest-11bbc1b9d551ceb2783c575d2d1d4d451d7e4ecf.tar.bz2 |
Various improvements.
* src/Makefile.am: Initialize MAINTAINERCLEANFILES.
* src/cmdline.opt: New options: --prepend-load-path and --no-init-files.
* src/guile.c (no_init_files_option): New variable.
(guile_load): Bail out on error.
(load_path_prepend): Rewrite.
(load_path_append): New function.
(user_load_path_list): Replace with user_path_list (array).
(guile_add_load_path): Second arg indicates which list to modify.
(flush_user_load_path): Argument indicates which list to flush.
(load_startup_file): Don't touch load path. It is done elsewhere.
(guile_init): Set up load path. Call load_startup_file unless
no_init_files_option is set.
* src/idest.h (no_init_files_option): New extern.
(guile_add_load_path): Change signature.
* src/main.c (main): Fix coredump.
Diffstat (limited to 'src/cmdline.opt')
-rw-r--r-- | src/cmdline.opt | 87 |
1 files changed, 49 insertions, 38 deletions
diff --git a/src/cmdline.opt b/src/cmdline.opt index 0043164..c43d285 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt @@ -1,25 +1,25 @@ /* This file is part of Idest. -*- c -*- Copyright (C) 2009-2011 Sergey Poznyakoff - + Idest is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + Idest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with Idest. If not, see <http://www.gnu.org/licenses/>. */ static int mode_set = 0; #define SET_MODE(m) do { \ - if (mode_set++ && mode != m) \ - error(1, 0, "only one of -q, -s, -d may be used"); \ - mode = m; \ - } while(0) + if (mode_set++ && mode != m) \ + error(1, 0, "only one of -q, -s, -d may be used"); \ + mode = m; \ + } while(0) static unsigned get_version_list(const char *arg) @@ -48,10 +48,10 @@ get_version_list(const char *arg) } return vers; } - + OPTIONS_BEGIN(gnu, "idest", - [<idest - ID3 Edit and Scripting Tool>], - [<FILE [FILE...]>]) + [<idest - ID3 Edit and Scripting Tool>], + [<FILE [FILE...]>]) GROUP([<Operation mode>]) @@ -74,12 +74,12 @@ OPTION(set,s,FIELD=VALUE, [<set FIELD to VALUE>]) BEGIN char *p; - + SET_MODE(MODE_MOD); p = strchr(optarg, '='); if (!p) error(1, 0, "missing `=' sign in assignment"); - *p++ = 0; + *p++ = 0; input_list_add_assignment(optarg, p); END @@ -89,18 +89,18 @@ BEGIN SET_MODE(MODE_DELETE); if (optarg) parse_filter_items(optarg); -END +END OPTION(info,i,, [<display information about ID3 tags>]) BEGIN SET_MODE(MODE_INFO); -END +END OPTION(copy,c,FILE, [<copy frames from FILE>]) BEGIN - source_file = optarg; + source_file = optarg; END OPTION(list-frames,L,, @@ -110,7 +110,7 @@ BEGIN END GROUP([<Operation modifiers>]) - + OPTION(filter,F,FRAME-LIST, [<operate only on matching frames>]) BEGIN @@ -125,7 +125,7 @@ END OPTION(default-id-version,U,VERSION, [<create new tags in the given ID3 version>]) -BEGIN +BEGIN default_version_option = get_version_list(optarg); END @@ -139,19 +139,19 @@ OPTION(latin1,,, [<force latin1 output>]) BEGIN latin1_option = 1; -END +END OPTION(verbose,v,, [<verbosely list files processed>]) BEGIN - verbose_option = 1; -END + verbose_option = 1; +END OPTION(describe,D,, [<print verbose frame descriptions instead of short names>]) BEGIN describe_option = 1; -END +END GROUP([<Backup options>]) @@ -159,23 +159,23 @@ OPTION(backup,,[CONTROL], [<backup before modifying, choose version CONTROL>]) BEGIN if (optarg) - backup_type = xget_version ("--backup", optarg); + backup_type = xget_version ("--backup", optarg); else backup_type = xget_version ("VERSION_CONTROL", - getenv("VERSION_CONTROL")); + getenv("VERSION_CONTROL")); END OPTION(backup-suffix,,SUF, [<set backup suffix, instead of the default ~>]) BEGIN simple_backup_suffix = optarg; -END +END OPTION(backup-directory,,DIR, [<backup to given DIR>]) BEGIN backup_dir = optarg; -END +END IFDEF(GUILE_VERSION,[< @@ -185,24 +185,24 @@ OPTION(script,S,FILE, [<read Guile script from FILE; this stops further argument processing>]) BEGIN set_guile_argv(argc - optind, argv + optind); /* Save rest of arguments */ - *--guile_argv = optarg; - optind = argc; /* Stop argument processing */ + *--guile_argv = optarg; + optind = argc; /* Stop argument processing */ END OPTION(format,H,NAME, [<apply external format NAME; this stops further argument processing>]) BEGIN - format_name = optarg; - stop = 1; /* Stop argument processing */ + format_name = optarg; + stop = 1; /* Stop argument processing */ END OPTION(batch,B,NAME, [<apply batch modification module NAME; this stops further argument processing>]) BEGIN batch_name = optarg; - stop = 1; /* Stop argument processing */ + stop = 1; /* Stop argument processing */ END - + OPTION(dry-run,n,, [<run the script, print modified frames but do not write them to the file>]) BEGIN @@ -213,17 +213,28 @@ OPTION(trace,,[LEVEL], [<start with debugging evaluator and backtraces>]) BEGIN if (optarg) - guile_debug = atoi(optarg); + guile_debug = atoi(optarg); else - guile_debug = 1; -END + guile_debug = 1; +END OPTION(load-path,P,PATH, - [<set load path>]) + [<append PATH to the load path>]) +BEGIN + guile_add_load_path(optarg, 1); +END + +OPTION(prepend-load-path,p,PATH, + [<prepend PATH to the load path>]) +BEGIN + guile_add_load_path(optarg, 0); +END + +OPTION(no-init-files,N,, + [<do not load Scheme init files>]) BEGIN - guile_add_load_path(optarg); + no_init_files_option = 1; END - >]) OPTIONS_END @@ -236,7 +247,7 @@ get_options(int argc, char *argv[]) char *p; /* See if we've been given any assignment arguments */ while (p = strchr(argv[optind], '=')) { - *p++ = 0; + *p++ = 0; input_list_add_assignment(argv[optind++], p); } } |