diff options
author | Mageia SVN-Git Migration <svn-git-migration@mageia.org> | 2007-04-25 15:16:21 +0000 |
---|---|---|
committer | Mageia SVN-Git Migration <svn-git-migration@mageia.org> | 2007-04-25 15:16:21 +0000 |
commit | be4fff49f0164e606d4b2f76f64d4d108895f236 (patch) | |
tree | a46bc8c23de0b885f8a2962a9069930b48836fd9 /src/config_file.ml | |
parent | 4746e8e79a5b3cdf3f72400a5a5d6742f6a76a8c (diff) | |
download | perl_checker-be4fff49f0164e606d4b2f76f64d4d108895f236.tar perl_checker-be4fff49f0164e606d4b2f76f64d4d108895f236.tar.gz perl_checker-be4fff49f0164e606d4b2f76f64d4d108895f236.tar.bz2 perl_checker-be4fff49f0164e606d4b2f76f64d4d108895f236.tar.xz perl_checker-be4fff49f0164e606d4b2f76f64d4d108895f236.zip |
Rename folder to match history.
This is a Synthesized commit to combine perl-MDK-Common and perl_checker repository
history.
Diffstat (limited to 'src/config_file.ml')
-rw-r--r-- | src/config_file.ml | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/config_file.ml b/src/config_file.ml new file mode 100644 index 0000000..a5ee94f --- /dev/null +++ b/src/config_file.ml @@ -0,0 +1,40 @@ +open Common + +type config_file = { + basedir : int option ; + } + +let ignored_packages = ref [] + +let default = { basedir = None } + + +let config_cache = Hashtbl.create 16 + +let read dir = + try Hashtbl.find config_cache dir with Not_found -> + try + let file_name = dir ^ "/.perl_checker" in + let fh = open_in file_name in + let config = + fold_lines (fun config line -> + match words line with + | [ "Basedir"; ".." ] -> { config with basedir = Some 1 } + | [ "Basedir"; "../.." ] -> { config with basedir = Some 2 } + | [] -> config (* blank line *) + | [ "Ignore"; pkg ] + | [ pkg ] (* the deprecated form *) + -> lpush ignored_packages pkg; config + | _ -> prerr_endline (Printf.sprintf "bad line \"%s\" in %s" line file_name); config + ) default fh + in + Hashtbl.add config_cache dir config ; + if !Flags.verbose then print_endline_flush ("reading config file " ^ file_name); + config + with Sys_error _ -> default + + +let rec read_any dir depth = + if depth = 0 then () else + let _ = read dir in + read_any (updir dir 1) (depth - 1) |