+;;;
+;;; A kludge that allows reprocessing of the command line. This is mostly
+;;; to allow a spawned VMS mail process to do something reasonable when
+;;; used in conjunction with the modifications to sysdep.c that allow
+;;; Emacs to attach to a "foster" parent.
+;;;
+(defun vms-command-line-again ()
+ "Reprocess command line arguments. VMS specific.
+Command line arguments are initialized from the logical EMACS_COMMAND_ARGS
+which is defined by kepteditor.com. On VMS this allows attaching to a
+spawned Emacs and doing things like \"emacs -l myfile.el -f doit\""
+ (let* ((args (downcase (vms-system-info "LOGICAL" "EMACS_COMMAND_ARGS")))
+ (command-line-args (list "emacs"))
+ (beg 0)
+ (end 0)
+ (len (length args))
+ this-char)
+ (if args
+ (progn
+;;; replace non-printable stuff with spaces
+ (while (< beg (length args))
+ (if (or (> 33 (setq this-char (aref args beg)))
+ (< 127 this-char))
+ (aset args beg 32))
+ (setq beg (1+ beg)))
+ (setq beg (1- (length args)))
+ (while (= 32 (aref args beg)) (setq beg (1- beg)))
+ (setq args (substring args 0 (1+ beg)))
+ (setq beg 0)
+;;; now start parsing args
+ (while (< beg (length args))
+ (while (and (< beg (length args))
+ (or (> 33 (setq this-char (aref args beg)))
+ (< 127 this-char))
+ (setq beg (1+ beg))))
+ (setq end (1+ beg))
+ (while (and (< end (length args))
+ (< 32 (setq this-char (aref args end)))
+ (> 127 this-char))
+ (setq end (1+ end)))
+ (setq command-line-args (append
+ command-line-args
+ (list (substring args beg end))))
+ (setq beg (1+ end)))
+ (command-line)))))
+