:type 'string)
 
 (defcustom pgg-gpg-shell-file-name "/bin/sh"
-  "The GnuPG executable."
+  "File name to load inferior shells from.  Bourne shell or its equivalent
+\(not tcsh) is needed for \"2>\"."
+  :group 'pgg-gpg
+  :type 'string)
+
+(defcustom pgg-gpg-shell-command-switch "-c"
+  "Switch used to have the shell execute its command line argument."
   :group 'pgg-gpg
   :type 'string)
 
           (list (concat "2>" errors-file-name)
                 (concat "3>" status-file-name))))
         (shell-file-name pgg-gpg-shell-file-name)
+        (shell-command-switch pgg-gpg-shell-command-switch)
         (output-buffer pgg-output-buffer)
         (errors-buffer pgg-errors-buffer)
         (status-buffer pgg-status-buffer)
       (replace-match ""))
     (pgg-process-when-success
       (goto-char (point-min))
-      (while (re-search-forward "\r$" end t)
+      (while (re-search-forward "\r$" nil t)
        (replace-match ""))
       (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX
        (let ((packet 
 
   :type 'string)
 
 (defcustom pgg-pgp-shell-file-name "/bin/sh"
-  "The GnuPG executable."
+  "File name to load inferior shells from.  Bourne shell or its equivalent
+\(not tcsh) is needed for \"2>\"."
+  :group 'pgg-pgp
+  :type 'string)
+
+(defcustom pgg-pgp-shell-command-switch "-c"
+  "Switch used to have the shell execute its command line argument."
   :group 'pgg-pgp
   :type 'string)
 
                  pgg-pgp-extra-args
                  (list (concat "2>" errors-file-name))))
         (shell-file-name pgg-pgp-shell-file-name)
+        (shell-command-switch pgg-pgp-shell-command-switch)
         (output-buffer pgg-output-buffer)
         (errors-buffer pgg-errors-buffer)
         (process-connection-type nil)
                             pgg-pgp-program args)
     (pgg-process-when-success
       (goto-char (point-min))
-      (while (re-search-forward "\r$" end t)
+      (while (re-search-forward "\r$" nil t)
        (replace-match ""))
       (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX
        (let ((packet 
 
   :type 'string)
 
 (defcustom pgg-pgp5-shell-file-name "/bin/sh"
-  "The GnuPG executable."
+  "File name to load inferior shells from.  Bourne shell or its equivalent
+\(not tcsh) is needed for \"2>\"."
+  :group 'pgg-pgp5
+  :type 'string)
+
+(defcustom pgg-pgp5-shell-command-switch "-c"
+  "Switch used to have the shell execute its command line argument."
   :group 'pgg-pgp5
   :type 'string)
 
                  pgg-pgp5-extra-args
                  (list (concat "2>" errors-file-name))))
         (shell-file-name pgg-pgp5-shell-file-name)
+        (shell-command-switch pgg-pgp5-shell-command-switch)
         (output-buffer pgg-output-buffer)
         (errors-buffer pgg-errors-buffer)
         (process-connection-type nil)
                             pgg-pgp5-pgps-program args)
     (pgg-process-when-success
       (goto-char (point-min))
-      (while (re-search-forward "\r$" end t)
+      (while (re-search-forward "\r$" nil t)
        (replace-match ""))
       (when (re-search-forward "^-+BEGIN PGP SIGNATURE" nil t);XXX
        (let ((packet