+(defun vc-rcs-unregister (file)
+ "Unregister FILE from RCS.
+If this leaves the RCS subdirectory empty, ask the user
+whether to remove it."
+ (let* ((master (vc-name file))
+ (dir (file-name-directory master)))
+ (delete-file master)
+ (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS")
+ ;; check whether RCS dir is empty, i.e. it does not
+ ;; contain any files except "." and ".."
+ (not (directory-files dir nil
+ "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*"))
+ (yes-or-no-p (format "Directory %s is empty; remove it? " dir))
+ (delete-directory dir))))
+
+(defun vc-rcs-receive-file (file move)
+ "Implementation of receive-file for RCS."
+ (let ((old-backend (vc-backend file))
+ (rev (vc-workfile-version file))
+ (state (vc-state file))
+ (checkout-model (vc-checkout-model file))
+ (comment (and move
+ (vc-find-backend-function old-backend 'comment-history)
+ (vc-call 'comment-history file))))
+ (if move (vc-unregister file old-backend))
+ (vc-file-clearprops file)
+ (if (not (vc-rcs-registered file))
+ (progn
+ (with-vc-properties
+ file
+ ;; TODO: If the file was 'edited under the old backend,
+ ;; this should actually register the version
+ ;; it was based on.
+ (vc-rcs-register file rev "")
+ `((vc-backend ,backend)))
+ (if (eq checkout-model 'implicit)
+ (vc-rcs-set-non-strict-locking file))
+ (if (not move)
+ (vc-do-command nil 0 "rcs" file (concat "-b" rev ".1"))))
+ (vc-file-setprop file 'vc-backend backend)
+ (vc-file-setprop file 'vc-state 'edited)
+ (set-file-modes file
+ (logior (file-modes file) 128)))
+ (when (or move (eq state 'edited))
+ (vc-file-setprop file 'vc-state 'edited)
+ ;; TODO: The comment history should actually become the
+ ;; initial contents of the log entry buffer.
+ (and comment (ring-insert vc-comment-ring comment))
+ (vc-checkin file (concat rev ".1.1")))))
+
+(defun vc-rcs-set-non-strict-locking (file)
+ (vc-do-command nil 0 "rcs" file "-U")
+ (vc-file-setprop file 'vc-checkout-model 'implicit)
+ (set-file-modes file (logior (file-modes file) 128)))
+