about summary refs log tree commit diff
path: root/Functions/MIME/zsh-mime-setup
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-07-26 16:59:53 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-07-26 16:59:53 +0000
commit8c9a6b01d1bf727d27bc12d7e63fbb34fa157587 (patch)
tree3932e6e59f6b42c1b9be84c4b375c412c10a708a /Functions/MIME/zsh-mime-setup
parent17e576782c4fd64194d4908af5b9774308f1205f (diff)
downloadzsh-8c9a6b01d1bf727d27bc12d7e63fbb34fa157587.tar.gz
zsh-8c9a6b01d1bf727d27bc12d7e63fbb34fa157587.tar.xz
zsh-8c9a6b01d1bf727d27bc12d7e63fbb34fa157587.zip
20199: improve MIME handling.
Diffstat (limited to 'Functions/MIME/zsh-mime-setup')
-rw-r--r--Functions/MIME/zsh-mime-setup24
1 files changed, 20 insertions, 4 deletions
diff --git a/Functions/MIME/zsh-mime-setup b/Functions/MIME/zsh-mime-setup
index fee3237f7..d0149ba29 100644
--- a/Functions/MIME/zsh-mime-setup
+++ b/Functions/MIME/zsh-mime-setup
@@ -53,14 +53,30 @@ fi
 # to handlers and their flags.
 typeset -A suffix_type_map type_handler_map type_flags_map
 
+local -a default_type_files default_cap_files
 local -a type_files cap_files array match mbegin mend
 local file line type suffix exts elt flags line2
+integer ind
+
+default_type_files=(~/.mime.types /etc/mime.types)
+default_cap_files=(~/.mailcap /etc/mailcap)
 
 # Customizable list of files to examine.
-zstyle -a :mime: mime-types type_files ||
-  type_files=(~/.mime.types /etc/mime.types)
-zstyle -a :mime: mailcap cap_files ||
-  cap_files=(~/.mailcap /etc/mailcap)
+if zstyle -a :mime: mime-types type_files; then
+  while (( (ind = ${type_files[(I)+]}) > 0 )); do
+    type_files[$ind]=($default_type_files)
+  done
+else
+  type_files=($default_type_files)
+fi
+
+if zstyle -a :mime: mailcap cap_files; then
+  while (( (ind = ${cap_files[(I)+]}) > 0 )); do
+    cap_files[$ind]=($default_cap_files)
+  done
+else
+  cap_files=($default_cap_files)
+fi
 
 {
   mime-setup-add-type() {