diff options
| author | Richard M. Stallman | 1994-02-23 16:18:10 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-02-23 16:18:10 +0000 |
| commit | dfe05faccceaa886204b14a66eece91e5e365e58 (patch) | |
| tree | 5da7c01e3861d1990ccd9c7ccb2ac38a718c1a92 | |
| parent | c52de5eb23d80b964cebe1d7376818e0de933229 (diff) | |
| download | emacs-dfe05faccceaa886204b14a66eece91e5e365e58.tar.gz emacs-dfe05faccceaa886204b14a66eece91e5e365e58.zip | |
(jka-compr-partial-uncompress): Make dd give you
one more block than you think you need.
(jka-compr-dd-blocksize): Change default value to 256.
| -rw-r--r-- | lisp/jka-compr.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index 2a0eb5a2e2d..1519e056c21 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | ;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. | 2 | ;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | ;; Author: jka@ece.cmu.edu (Jay K. Adams) | 4 | ;; Author: jka@ece.cmu.edu (Jay K. Adams) |
| 5 | ;; Version: 0.10 | 5 | ;; Version: 0.11 |
| 6 | ;; Keywords: data | 6 | ;; Keywords: data |
| 7 | 7 | ||
| 8 | ;;; Commentary: | 8 | ;;; Commentary: |
| @@ -12,7 +12,7 @@ | |||
| 12 | ;;; I/O functions (including write-region and insert-file-contents) so | 12 | ;;; I/O functions (including write-region and insert-file-contents) so |
| 13 | ;;; that they automatically compress or uncompress a file if the file | 13 | ;;; that they automatically compress or uncompress a file if the file |
| 14 | ;;; appears to need it (based on the extension of the file name). | 14 | ;;; appears to need it (based on the extension of the file name). |
| 15 | ;;; Packages like Rmail, Vm, Gnus, and Info should be able to work | 15 | ;;; Packages like Rmail, VM, GNUS, and Info should be able to work |
| 16 | ;;; with compressed files without modification. | 16 | ;;; with compressed files without modification. |
| 17 | 17 | ||
| 18 | 18 | ||
| @@ -225,7 +225,7 @@ based on the filename itself and jka-compr-compression-info-list." | |||
| 225 | "/bin/dd") | 225 | "/bin/dd") |
| 226 | 226 | ||
| 227 | 227 | ||
| 228 | (defvar jka-compr-dd-blocksize 512) | 228 | (defvar jka-compr-dd-blocksize 256) |
| 229 | 229 | ||
| 230 | 230 | ||
| 231 | (defun jka-compr-partial-uncompress (prog message args infile beg len) | 231 | (defun jka-compr-partial-uncompress (prog message args infile beg len) |
| @@ -238,7 +238,6 @@ the BEGth char." | |||
| 238 | (prefix (- beg (* skip jka-compr-dd-blocksize))) | 238 | (prefix (- beg (* skip jka-compr-dd-blocksize))) |
| 239 | (count (and len (1+ (/ (+ len prefix) jka-compr-dd-blocksize)))) | 239 | (count (and len (1+ (/ (+ len prefix) jka-compr-dd-blocksize)))) |
| 240 | (start (point)) | 240 | (start (point)) |
| 241 | (end (and count (+ start (* count jka-compr-dd-blocksize)))) | ||
| 242 | (err-file (jka-compr-make-temp-name)) | 241 | (err-file (jka-compr-make-temp-name)) |
| 243 | (run-string (format "%s %s 2> %s | %s bs=%d skip=%d %s 2> /dev/null" | 242 | (run-string (format "%s %s 2> %s | %s bs=%d skip=%d %s 2> /dev/null" |
| 244 | prog | 243 | prog |
| @@ -247,7 +246,10 @@ the BEGth char." | |||
| 247 | jka-compr-dd-program | 246 | jka-compr-dd-program |
| 248 | jka-compr-dd-blocksize | 247 | jka-compr-dd-blocksize |
| 249 | skip | 248 | skip |
| 250 | (if count (concat "count=" count) "")))) | 249 | ;; dd seems to be unreliable about |
| 250 | ;; providing the last block. So, always | ||
| 251 | ;; read one more than you think you need. | ||
| 252 | (if count (concat "count=" (1+ count)) "")))) | ||
| 251 | 253 | ||
| 252 | (unwind-protect | 254 | (unwind-protect |
| 253 | (or (memq (call-process jka-compr-shell | 255 | (or (memq (call-process jka-compr-shell |
| @@ -260,8 +262,8 @@ the BEGth char." | |||
| 260 | (jka-compr-delete-temp-file err-file)) | 262 | (jka-compr-delete-temp-file err-file)) |
| 261 | 263 | ||
| 262 | (and | 264 | (and |
| 263 | end | 265 | len |
| 264 | (delete-region (+ start prefix len) end)) | 266 | (delete-region (+ start prefix len) (point))) |
| 265 | 267 | ||
| 266 | (delete-region start (+ start prefix)))) | 268 | (delete-region start (+ start prefix)))) |
| 267 | 269 | ||
| @@ -677,7 +679,7 @@ There should be no more than seven characters after the final '/'") | |||
| 677 | 679 | ||
| 678 | (defvar jka-compr-op-table | 680 | (defvar jka-compr-op-table |
| 679 | (make-vector 127 0) | 681 | (make-vector 127 0) |
| 680 | "Hash table of operations supported by jka-compr") | 682 | "Hash table of operations supported by jka-compr.") |
| 681 | 683 | ||
| 682 | 684 | ||
| 683 | (defun jka-compr-intern-operation (op) | 685 | (defun jka-compr-intern-operation (op) |