summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2024-11-01 13:37:17 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2024-11-01 13:37:17 -0400
commitc7a1f098990bd88ed33abff07541e61b50851d57 (patch)
treebcaf686072b2737aa199f6be9852b78ed15de1dc
parent75891efd33e720208f4d353e892f8ed590f45d7d (diff)
Don't redundantly `setq` after `defconst`externals/cpio-mode
After all, the "const" is because it's not supposed to be changed.
-rw-r--r--cpio-affiliated-buffers.el17
-rw-r--r--cpio-bin.el57
-rw-r--r--cpio-crc.el14
-rw-r--r--cpio-dired.el13
-rw-r--r--cpio-entry-contents-mode.el6
-rw-r--r--cpio-entry-header.el4
-rw-r--r--cpio-generic.el59
-rw-r--r--cpio-hpbin.el4
-rw-r--r--cpio-hpodc.el4
-rw-r--r--cpio-mode.el6
-rw-r--r--cpio-modes.el9
-rw-r--r--cpio-newc.el126
-rw-r--r--cpio-odc.el111
-rw-r--r--cpio-tar.el4
-rw-r--r--cpio-ustar.el4
15 files changed, 151 insertions, 287 deletions
diff --git a/cpio-affiliated-buffers.el b/cpio-affiliated-buffers.el
index 42fe890..e075181 100644
--- a/cpio-affiliated-buffers.el
+++ b/cpio-affiliated-buffers.el
@@ -1,8 +1,8 @@
-;;; cpio-affiliated-buffers.el --- Establish and manage buffers affiliated with each other. -*- coding: utf-8 -*-
+;;; cpio-affiliated-buffers.el --- Establish and manage buffers affiliated with each other. -*- lexical-binding:t; coding: utf-8 -*-
;; COPYRIGHT
-;; Copyright © 2019 Free Software Foundation, Inc.
+;; Copyright © 2019-2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -78,6 +78,10 @@
;;
;; Development
;;
+
+(eval-when-compile (require 'cl-lib))
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
+
(defun cab-setup-parenthood-check ()
"Set up a simple situation where the parenthood check should error out."
(let ((b0 (find-file-noselect "b0"))
@@ -167,9 +171,6 @@ It's not strictly a hook, but it pairs with the above kill-buffer-hook."
;;
;; Dependencies
;;
-(eval-when-compile
- (require 'cl-lib))
-
;;
;; Vars
@@ -218,7 +219,7 @@ Return NIL if buffer is already affiliated to another parent."
(local-set-key "\C-x\C-k" (lambda () (cab-deregister buffer))))
(with-current-buffer parent
(push buffer *cab-subordinates*)
- (add-hook 'kill-buffer-hook 'cab-kill-buffer-hook nil 'local)
+ (add-hook 'kill-buffer-hook #'cab-kill-buffer-hook nil 'local)
(local-set-key "\C-x\C-k" (lambda () (cab-deregister parent))))))))
(defun cab-detect-parenthood-cycle (buffer parent)
@@ -276,7 +277,7 @@ if you want to lose registry information."
(with-current-buffer buffer
(setq parent *cab-parent*)
(setq subordinates *cab-subordinates*))
- (mapc 'cab-deregister subordinates)
+ (mapc #'cab-deregister subordinates)
(if (and parent
(bufferp parent)
(buffer-live-p parent)
@@ -295,7 +296,7 @@ if you want to lose registry information."
(with-current-buffer buffer
(setq parent *cab-parent*)
(setq subordinates *cab-subordinates*))
- (mapc 'cab-simple-deregister subordinates)
+ (mapc #'cab-simple-deregister subordinates)
(with-current-buffer parent
(setq *cab-subordinates* (delete buffer *cab-subordinates*)))))
diff --git a/cpio-bin.el b/cpio-bin.el
index ff3e793..6faf619 100644
--- a/cpio-bin.el
+++ b/cpio-bin.el
@@ -1,8 +1,8 @@
-;;; cpio-bin.el --- handle bin cpio entry header formats -*- coding: utf-8 -*-
+;;; cpio-bin.el --- handle bin cpio entry header formats -*- lexical-binding:t; coding: utf-8 -*-
;; COPYRIGHT
;;
-;; Copyright © 2019-2020 Free Software Foundation, Inc.
+;; Copyright © 2019-2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -30,6 +30,8 @@
;;; Documentation:
;;; Code:
+
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
;;
;; Dependencies
@@ -61,62 +63,48 @@
;; Vars
;;
-(defconst *cpio-bin-header-length* (length (string-as-unibyte "\307q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0"))
+(defconst *cpio-bin-header-length* (length (string-to-unibyte "\307q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0"))
"The length of a bin header.")
;; \307q\0\375c\9\244\201\350\3\350\3\1\0\0\0\377Z\320q\2\0\0\0\4\0a\0
;; \307q \0\375 c\9 \244\201 \350\3 \350\3 \1\0 \0\0 \377Z\320q \2\0 \0\0\4\0 a\0
(defconst *cpio-bin-magic-re* "\307q" ; 070707 \307q
"RE to match the magic number of a bin archive.")
-(setq *cpio-bin-magic-re* "\307q")
(defconst *cpio-bin-dev-re* "\\w\\w"
"RE to match the c_dev field in a bin header.")
-(setq *cpio-bin-dev-re* "\\w\\w")
(defconst *cpio-bin-ino-re* "\\w\\w"
"RE to match the c_ino field in a bin header.")
-(setq *cpio-bin-ino-re* "\\w\\w")
(defconst *cpio-bin-mode-re* "\\w\\w"
"RE to match the c_mode field in a bin header.")
-(setq *cpio-bin-mode-re* "\\w\\w")
(defconst *cpio-bin-uid-re* "\\w\\w"
"RE to match the c_uid field in a bin header.")
-(setq *cpio-bin-uid-re* "\\w\\w")
(defconst *cpio-bin-gid-re* "\\w\\w"
"RE to match the c_gid field in a bin header.")
-(setq *cpio-bin-gid-re* "\\w\\w")
(defconst *cpio-bin-nlink-re* "\\w\\w"
"RE to match the c_nlink field in a bin header.")
-(setq *cpio-bin-nlink-re* "\\w\\w")
(defconst *cpio-bin-rdev-re* "\\w\\w"
"RE to match the c_rdev field in a bin header.")
-(setq *cpio-bin-rdev-re* "\\w\\w")
(defconst *cpio-bin-mtime-re* "\\w\\w\\w\\w"
"RE to match the c_mtime field in a bin header.")
-(setq *cpio-bin-mtime-re* "\\w\\w\\w\\w")
(defconst *cpio-bin-namesize-re* "\\w\\w"
"RE to match the c_rdev field in a bin header.")
-(setq *cpio-bin-rdev-re* "\\w\\w")
(defconst *cpio-bin-filesize-re* "\\w\\w\\w\\w"
"RE to match the c_filesize field in a bin header.")
-(setq *cpio-bin-filesize-re* "\\w\\w\\w\\w")
-(defconst *cpio-bin-filename-re* ()
+(defconst *cpio-bin-filename-re* "[[:print:]]+"
"RE to match a filename in a bin header.")
-(setq *cpio-bin-filename-re* "[[:print:]]+")
-(defconst *cpio-bin-header-re* ()
- "RE to match bin header format cpio archives.")
-(setq *cpio-bin-header-re* (concat "\\(" *cpio-bin-magic-re* "\\)"
+(defconst *cpio-bin-header-re* (concat "\\(" *cpio-bin-magic-re* "\\)"
"\\(" *cpio-bin-dev-re* "\\)"
"\\(" *cpio-bin-ino-re* "\\)"
"\\(" *cpio-bin-mode-re* "\\)"
@@ -128,25 +116,13 @@
"\\(" *cpio-bin-namesize-re* "\\)"
"\\(" *cpio-bin-filesize-re* "\\)"
"\\(" *cpio-bin-filename-re* "\\)"
- "\0"))
+ "\0")
+ "RE to match bin header format cpio archives.")
(defvar *cpio-bin-name-field-offset* (length "\307q\0\375z\r\244\201\350\350\0\0\0[\211\255\0\0\0\0")
"The offset of the name field in a cpio binary header.")
(defconst cpio-bin-index-spec
- '(;; (:magic u16)
- (:dev u16)
- (:ino u16)
- (:mode u16)
- (:uid u16)
- (:gid u16)
- (:nlink u16)
- (:rdev u16)
- (:mtime u32)
- (:namesize u16)
- (:filesize u32)
- (:filename strz (:namesize))))
-(setq cpio-bin-index-spec
'((:magic u16r)
(:dev u16r)
(:ino u16r)
@@ -164,27 +140,23 @@
(defconst *cpio-bin-magic* *cpio-bin-magic-re*
"The string that identifies an entry as a BIN style cpio(1) entry.")
-(setq *cpio-bin-magic* *cpio-bin-magic-re*)
(defconst *cpio-bin-magic-int* #o070707
"An integer value of the cpio bin magic number.")
(defconst *cpio-bin-padding-modulus* 2
"The modulus to which some things are padded in a BIN cpio archive.")
-(setq *cpio-bin-padding-modulus* 2)
(defconst *cpio-bin-padding-char* ?\0
"A character to be used for padding headers and entry contents
in a bin cpio archive.")
-(setq *cpio-bin-padding-char* ?\0)
(defconst *cpio-bin-padding-str* "\0"
"A single character string of the character
to be used for padding headers and entry contents
in a bin cpio archive.")
-(setq *cpio-bin-padding-str* "\0")
-(defconst *cpio-bin-trailer* (string-as-unibyte "\307q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0TRAILER!!!\0\0")
+(defconst *cpio-bin-trailer* (string-to-unibyte "\307q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0TRAILER!!!\0\0")
"The TRAILER string of a cpio binary archive.")
(defcustom *cpio-bin-blocksize* 512
@@ -211,13 +183,14 @@ CAVEATS:
(found nil))
(save-match-data
(cond ((looking-at *cpio-bin-header-re*)
- (string-as-unibyte (match-string-no-properties 0)))
+ ;; FIXME: Why isn't it already unibyte?
+ (string-to-unibyte (match-string-no-properties 0)))
(t
(forward-char (length *cpio-bin-magic-re*))
(while (and (re-search-backward *cpio-bin-magic-re* (point-min) t)
(not (setq found (looking-at *cpio-bin-header-re*)))))
(if found
- (string-as-unibyte (match-string-no-properties 0))))))))
+ (string-to-unibyte (match-string-no-properties 0))))))))
(defun cpio-bin-parse-header (header-string)
"Return the internal entry header structure encoded in HEADER-STRING.
@@ -350,7 +323,7 @@ This function does NOT include the contents."
"Return an 8 digit hex string for the filesize attribute among the given ATTRs."
(let ((fname "cpio-bin-make-filesize")
(filesize (cpio-entry-size attrs)))
- (cons (lsh (logand #xFFFF0000 filesize) 8)
+ (cons (ash (logand #xFFFF0000 filesize) 8)
(logand #xFFFF filesize))))
(defun cpio-bin-make-dev-maj (attrs)
@@ -390,7 +363,7 @@ If there is no header there, then signal an error."
(let ((fname "cpio-bin-parse-header-at-point"))
(unless (looking-at-p *cpio-bin-header-re*)
(error "%s(): point is not looking at a bin header." fname))
- (cpio-bin-parse-header (string-as-unibyte (match-string-no-properties 0)))))
+ (cpio-bin-parse-header (string-to-unibyte (match-string-no-properties 0)))))
(defun cpio-bin-goto-next-header ()
"Move the point to the beginning of the next bin cpio header.
diff --git a/cpio-crc.el b/cpio-crc.el
index 6a16a09..b51ced7 100644
--- a/cpio-crc.el
+++ b/cpio-crc.el
@@ -1,8 +1,8 @@
-;;; cpio-crc.el --- handle crc cpio entry header formats -*- coding: utf-8 -*-
+;;; cpio-crc.el --- handle crc cpio entry header formats -*- lexical-binding:t; coding: utf-8 -*-
;; COPYRIGHT
;;
-;; Copyright © 2019-2020 Free Software Foundation, Inc.
+;; Copyright © 2019-2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -52,6 +52,8 @@
(require 'cpio-newc)
(eval-when-compile (require 'cpio-generic)) ;For `with-writable-buffer'!
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
+
;;;;;;;;;;;;;;;;
;; Things to make the byte compiler happy.
(declare-function cg-pad-right "cpio-generic.el")
@@ -91,7 +93,6 @@
;; MAINTENANCE The following must remain in synch with *cpio-newc-header-re*.
(defconst *cpio-crc-magic-re* "070702"
"RE to match the magic number of a newc archive.")
-(setq *cpio-crc-magic-re* "070702")
(defconst *cpio-crc-ino-re* *cpio-newc-ino-re*)
(defconst *cpio-crc-mode-re* *cpio-newc-mode-re*)
@@ -108,9 +109,7 @@
(defconst *cpio-crc-namesize-re* *cpio-newc-namesize-re*)
(defconst *cpio-crc-chksum-re* *cpio-newc-chksum-re*)
(defconst *cpio-crc-filename-re* *cpio-newc-filename-re*)
-(defconst *cpio-crc-header-re* ()
- "RE to match crc header format cpio archives.")
-(setq *cpio-crc-header-re* (concat "\\(" *cpio-crc-magic-re* "\\)"
+(defconst *cpio-crc-header-re* (concat "\\(" *cpio-crc-magic-re* "\\)"
"\\(" *cpio-crc-ino-re* "\\)"
"\\(" *cpio-crc-mode-re* "\\)"
"\\(" *cpio-crc-uid-re* "\\)"
@@ -127,7 +126,8 @@
"\\(" *cpio-crc-namesize-re* "\\)"
"\\(" *cpio-crc-chksum-re* "\\)"
"\\(" *cpio-crc-filename-re* "\\)"
- "\0"))
+ "\0")
+ "RE to match crc header format cpio archives.")
(defconst *cpio-crc-magic-re-idx* *cpio-newc-magic-re-idx*)
(defconst *cpio-crc-ino-re-idx* *cpio-newc-ino-re-idx*)
diff --git a/cpio-dired.el b/cpio-dired.el
index 253fb64..5dc8416 100644
--- a/cpio-dired.el
+++ b/cpio-dired.el
@@ -1,8 +1,8 @@
-;;; cpio-dired.el --- UI definition à la dired. -*- coding: utf-8 -*-
+;;; cpio-dired.el --- UI definition à la dired. -*- lexical-binding:t; coding: utf-8 -*-
;; COPYRIGHT
-;; Copyright © 2019-2020 Free Software Foundation, Inc.
+;; Copyright © 2019-2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -39,6 +39,8 @@
;;; Code:
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
+
;;
;; Hacks
@@ -80,7 +82,7 @@ Keep any preceding comments."
defuns))
(setq sorted-list (sort sortable-list (lambda (l r)
(string-lessp (car l) (car r)))))
- (mapcar 'cdr sorted-list)))
+ (mapcar #'cdr sorted-list)))
(defun sort-defuns-in-buffer () ;FIXME: Namespace!
"Replace the visible portion of the current buffer with its defuns, but sorted."
@@ -562,7 +564,6 @@ Important: the match ends just after the marker.")
(defconst *cpio-dirline-re* "^..d"
"Regular expression to match an entry for a directory.")
-(setq *cpio-dirline-re* "^..d")
(defvar *cpio-dired-copy-history* ()
@@ -773,7 +774,7 @@ Important: the match ends just after the marker.")
(if *cab-parent*
(with-current-buffer *cab-parent*
(cpio-internal-do-deletions l))
- (mapc 'cpio-internal-do-deletion l))))
+ (mapc #'cpio-internal-do-deletion l))))
(defun cpio-internal-do-deletion (entry-name)
"Remove the entry with name ENTRY-NAME from a cpio-archive.
@@ -1179,7 +1180,7 @@ You can then feed the entry name(s) to other commands with C-y."
(unless (eq major-mode 'cpio-dired-mode)
(error "%s(): You're not in a cpio dired buffer." fname))
(if names
- (mapc 'kill-new names)
+ (mapc #'kill-new names)
(save-excursion
(while (and (> arg 0)
(< (point) (point-max)))
diff --git a/cpio-entry-contents-mode.el b/cpio-entry-contents-mode.el
index 7116508..e98016c 100644
--- a/cpio-entry-contents-mode.el
+++ b/cpio-entry-contents-mode.el
@@ -1,8 +1,8 @@
-;;; cpio-entry-contents-mode.el --- minor mode for editing a cpio-entry's contents. -*- coding: utf-8 -*-
+;;; cpio-entry-contents-mode.el --- minor mode for editing a cpio-entry's contents. -*- lexical-binding:t; coding: utf-8 -*-
;; COPYRIGHT
;;
-;; Copyright © 2019 Free Software Foundation, Inc.
+;; Copyright © 2019, 2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -32,6 +32,8 @@
;;; Documentation:
;;; Code:
+
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
;;
;; Hacks
diff --git a/cpio-entry-header.el b/cpio-entry-header.el
index 26dffc9..3f77946 100644
--- a/cpio-entry-header.el
+++ b/cpio-entry-header.el
@@ -1,8 +1,8 @@
-;;; cpio-entry-header.el --- handle cpio entry headers. -*- coding: utf-8 -*-
+;;; cpio-entry-header.el --- handle cpio entry headers -*- coding: utf-8; lexical-binding: t -*-
;; COPYRIGHT
;;
-;; Copyright © 2019 Free Software Foundation, Inc.
+;; Copyright © 2019, 2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
diff --git a/cpio-generic.el b/cpio-generic.el
index 7af3d44..c11be85 100644
--- a/cpio-generic.el
+++ b/cpio-generic.el
@@ -1,8 +1,8 @@
-;;; cpio-generic.el --- generically useful functions created in support of CPIO mode. -*- coding: utf-8 -*-
+;;; cpio-generic.el --- generically useful functions created in support of CPIO mode. -*- lexical-binding:t; coding: utf-8 -*-
;; COPYRIGHT
;;
-;; Copyright © 2019-2020 Free Software Foundation, Inc.
+;; Copyright © 2019-2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -43,58 +43,41 @@
;;
;; Dependencies
;;
-(eval-and-compile
- (require 'cl))
-
-(declare-function signum "cl")
+(require 'cl-lib)
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
;;
;; Vars
;;
-(defvar *cg-integer-hex-digits* nil)
+(defconst *cg-integer-hex-digits*
+ (let ((fixnum-bits (1+ (ceiling (/ (log most-positive-fixnum) (log 2))))))
+ (/ (+ fixnum-bits 3) 4)))
(defvar *cg-insert-after* nil
- "Value used to define that a marker has type 'insert after'.")
+ "Value used to define that a marker has type \"insert after\".")
(defvar *cg-insert-before* t
- "Value used to define that a marker has type 'insert before'.")
+ "Value used to define that a marker has type \"insert before\".")
;;
;; Library
;;
-(defun cg-integer-hex-digits ()
- "Calculate the number of hex digits that are required to represent any integer."
- (let ((fname "cg-integer-hex-digits")
- (an-integer most-negative-fixnum)
- (hex-digit-ct 0))
- (unless *cg-integer-hex-digits*
- (while (/= 0 an-integer)
- (setq an-integer (lsh an-integer -4))
- (setq hex-digit-ct (1+ hex-digit-ct)))
- (setq *cg-integer-hex-digits* hex-digit-ct)))
- *cg-integer-hex-digits*)
-
(defun OBS-cg-hex-format-pair (pair)
"Return a hex formatted representation of PAIR."
(let ((fname "cg-hex-format-pair")
- (hex-digit-count (cg-integer-hex-digits))
- (formatter))
- (setq formatter (format "%%0%dx" hex-digit-count))
- (setq formatter (concat formatter formatter))
- (format formatter (car pair) (cdr pair))))
+ (formatter (format "%%0%dx" *cg-integer-hex-digits*)))
+ (format (concat formatter formatter) (car pair) (cdr pair))))
(defun OBS-cg-hex-format-triple (triple)
"Return a hex formatted representation of TRIPLE."
(let ((fname "cg-hex-format-triple")
- (hex-digit-count (cg-integer-hex-digits))
- (formatter))
- (setq formatter (format "%%0%dx" hex-digit-count))
- (setq formatter (concat formatter formatter formatter))
- (format formatter (car triple) (cadr triple) (cddr triple))))
+ (formatter (format "%%0%dx" *cg-integer-hex-digits*)))
+ (format (concat formatter formatter formatter)
+ (car triple) (cadr triple) (cddr triple))))
(defun cg-round-up (number modulus)
"Round NUMBER up to the next multiple of MODULUS.
@@ -106,16 +89,17 @@ CAVEAT: If NUMBER is negative, then the result may be surprising."
(error "%s() takes integer arguments." fname))
(cond ((= 0 (mod number modulus))
number)
- ((= (signum number) 1)
+ ((= (cl-signum number) 1)
(* modulus (/ (+ number modulus -1) modulus)))
- ((= (signum number) -1)
+ ((= (cl-signum number) -1)
(* modulus (/ number modulus)))
(t
(error "%s(): Impossible condition." fname)))))
(defun cg-pad-right (string width char)
"Pad STRING on the right with CHAR until it is at least WIDTH characters wide.
-CHAR is typically a character or a single character string, but may be any string."
+CHAR is typically a character or a single character string,
+but may be any string."
(let ((fname "cg-pad-right"))
(if (characterp char) (setq char (char-to-string char)))
(while (< (length string) width)
@@ -155,12 +139,12 @@ then match as many copies of RE as are there."
"Remove the given RE from both ends of STRING.
If the optional argument MULTIPLES is not NIL,
then match as many copies of RE as are there."
- (let ((fname "strip")
- (result))
+ (let ((fname "strip"))
(cg-strip-left re (cg-strip-right re string multiples) multiples)))
(defun cpio-pad (string modulus pad-char)
- "Pad the given STRING with PAD-CHAR so that the resulting string has at least length MODULUS."
+ "Pad the given STRINGso the resulting string has at least length MODULUS.
+Padding is done with PAD-CHAR "
(let* ((fname "cpio-padded")
(string-length (length string))
(desired-length (cg-round-up string-length modulus)))
@@ -529,7 +513,6 @@ Other languages are not yet implemented."
(time-in)
(emacs-time)
(time-out)
- (format "")
(test-dates (list
"2018 Nov 9"
"2018 Nov 9 9:53"
diff --git a/cpio-hpbin.el b/cpio-hpbin.el
index 76f1d46..9b1706d 100644
--- a/cpio-hpbin.el
+++ b/cpio-hpbin.el
@@ -1,8 +1,8 @@
-;;; cpio-hpbin.el --- handle hpbin cpio entry header formats. -*- coding: utf-8 -*-
+;;; cpio-hpbin.el --- handle hpbin cpio entry header formats -*- coding: utf-8; lexical-binding: t -*-
;; COPYRIGHT
;;
-;; Copyright © 2019 Free Software Foundation, Inc.
+;; Copyright © 2019, 2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
diff --git a/cpio-hpodc.el b/cpio-hpodc.el
index 41576b8..874029a 100644
--- a/cpio-hpodc.el
+++ b/cpio-hpodc.el
@@ -1,8 +1,8 @@
-;;; cpio-hpodc.el --- handle hpodc cpio entry header formats. -*- coding: utf-8 -*-
+;;; cpio-hpodc.el --- handle hpodc cpio entry header formats -*- coding: utf-8; lexical-binding: t -*-
;; COPYRIGHT
;;
-;; Copyright © 2019 Free Software Foundation, Inc.
+;; Copyright © 2019, 2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
diff --git a/cpio-mode.el b/cpio-mode.el
index 2793486..5d079a7 100644
--- a/cpio-mode.el
+++ b/cpio-mode.el
@@ -1,4 +1,4 @@
-;;; cpio-mode.el --- Handle cpio archives in the style of dired. -*- coding: utf-8 -*-
+;;; cpio-mode.el --- Handle cpio archives in the style of dired -*- lexical-binding:t; coding: utf-8 -*-
;; Author: Douglas Lewan <d.lewan2000@gmail.com>
;; Maintainer: Douglas Lewan <d.lewan2000@gmail.com>
@@ -9,7 +9,7 @@
;; Package-Type: multi
;; Keywords: files
-;; Copyright © 2019-2020 Free Software Foundation, Inc.
+;; Copyright © 2019-2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -248,6 +248,8 @@
(require 'cpio-dired)
;; (require 'cpio-entry-contents-mode) ;;FIXME: missing file?
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
+
;; Formats not supported:
;; (require 'cpio-tar)
;; (require 'cpio-ustar)
diff --git a/cpio-modes.el b/cpio-modes.el
index 98c408b..557d283 100644
--- a/cpio-modes.el
+++ b/cpio-modes.el
@@ -1,8 +1,8 @@
-;;; cpio-modes.el --- handle file modes/permissions. -*- coding: utf-8 -*-
+;;; cpio-modes.el --- handle file modes/permissions -*- coding: utf-8; lexical-binding: t -*-
;; COPYRIGHT
;;
-;; Copyright © 2019-2020 Free Software Foundation, Inc.
+;; Copyright © 2019-2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -35,12 +35,11 @@
;;
;; Dependencies
;;
-(eval-when-compile
- (require 'cl-lib)
- (require 'cl-extra))
+(require 'cl-lib)
;;;;;;;;;;;;;;;;
;; Things to make the byte compiler happy.
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
(declare-function cpio-mode-value "cpio-mode.el")
;; EO things for the byte compiler.
;;;;;;;;;;;;;;;;
diff --git a/cpio-newc.el b/cpio-newc.el
index ac070da..b40548b 100644
--- a/cpio-newc.el
+++ b/cpio-newc.el
@@ -1,8 +1,8 @@
-;;; cpio-newc.el --- handle portable newc cpio archives. -*- coding: utf-8 -*-
+;;; cpio-newc.el --- handle portable newc cpio archives -*- coding: utf-8; lexical-binding: t -*-
;; COPYRIGHT
;;
-;; Copyright © 2019-2020 Free Software Foundation, Inc.
+;; Copyright © 2019-2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -63,6 +63,7 @@
;;;;;;;;;;;;;;;;
;; Things to make the byte compiler happy.
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
(defvar *cpio-catalog*)
(defvar *cpio-padding-modulus*)
(declare-function cpio-entry-name "cpio-mode.el")
@@ -96,71 +97,50 @@
;; MAINTENANCE The following must remain in synch with *cpio-newc-header-re*.
(defconst *cpio-newc-magic-re* "070701"
"RE to match the magic number of a newc archive.")
-(setq *cpio-newc-magic-re* "070701")
(defconst *cpio-newc-ino-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_ino field in a newc header.")
-(setq *cpio-newc-ino-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-mode-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_mode field in a newc header.")
-(setq *cpio-newc-mode-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-uid-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_uid field in a newc header.")
-(setq *cpio-newc-uid-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-gid-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_gid field in a newc header.")
-(setq *cpio-newc-gid-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-nlink-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_nlink field in a newc header.")
-(setq *cpio-newc-nlink-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-mtime-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_mtime field in a newc header.")
-(setq *cpio-newc-mtime-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-filesize-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_filesize field in a newc header.")
-(setq *cpio-newc-filesize-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-dev-maj-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_dev field in a newc header.")
-(setq *cpio-newc-dev-maj-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-dev-min-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_dev field in a newc header.")
-(setq *cpio-newc-dev-min-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-rdev-maj-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_rdev field in a newc header.")
-(setq *cpio-newc-rdev-maj-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-rdev-min-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_rdev field in a newc header.")
-(setq *cpio-newc-rdev-min-re* "[[:xdigit:]]\\{8\\}")
-
-(defconst *cpio-newc-rdev-min-re* "[[:xdigit:]]\\{8\\}"
- "RE to match the c_rdev field in a newc header.")
-(setq *cpio-newc-rdev-min-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-namesize-re* "[[:xdigit:]]\\{8\\}"
"RE to match the c_namesize field in a newc header.")
-(setq *cpio-newc-namesize-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-chksum-re* "[[:xdigit:]]\\{8\\}"
"RE to match the CRC checksum in a newc header.")
-(setq *cpio-newc-chksum-re* "[[:xdigit:]]\\{8\\}")
(defconst *cpio-newc-filename-re* "[[:print:]]+"
"RE to match the c_filename field in a newc header.")
-(setq *cpio-newc-filename-re* "[[:print:]]+")
-(defconst *cpio-newc-header-re* ()
- "RE to match newc header format cpio archives.")
-(setq *cpio-newc-header-re* (concat "\\(" *cpio-newc-magic-re* "\\)"
+(defconst *cpio-newc-header-re* (concat "\\(" *cpio-newc-magic-re* "\\)"
"\\(" *cpio-newc-ino-re* "\\)"
"\\(" *cpio-newc-mode-re* "\\)"
"\\(" *cpio-newc-uid-re* "\\)"
@@ -177,68 +157,54 @@
"\\(" *cpio-newc-namesize-re* "\\)"
"\\(" *cpio-newc-chksum-re* "\\)"
"\\(" *cpio-newc-filename-re* "\\)"
- "\0"))
+ "\0")
+ "RE to match newc header format cpio archives.")
(let ((i 0))
- (defconst *cpio-newc-magic-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-magic-re-idx* (setq i (1+ i))
"RE to match the magic number in a newc header.")
- (setq *cpio-newc-magic-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-ino-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-ino-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the inode.")
- (setq *cpio-newc-ino-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-mode-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-mode-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the mode.")
- (setq *cpio-newc-mode-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-uid-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-uid-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the UID.")
- (setq *cpio-newc-uid-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-gid-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-gid-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the GID.")
- (setq *cpio-newc-gid-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-nlink-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-nlink-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the nlink.")
- (setq *cpio-newc-nlink-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-mtime-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-mtime-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the mtime.")
- (setq *cpio-newc-mtime-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-filesize-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-filesize-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the filesize.")
- (setq *cpio-newc-filesize-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-dev-maj-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-dev-maj-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the dev.")
- (setq *cpio-newc-dev-maj-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-dev-min-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-dev-min-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the dev.")
- (setq *cpio-newc-dev-min-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-rdev-maj-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-rdev-maj-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the rdev.")
- (setq *cpio-newc-rdev-maj-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-rdev-min-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-rdev-min-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the rdev.")
- (setq *cpio-newc-rdev-min-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-namesize-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-namesize-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the namesize.")
- (setq *cpio-newc-namesize-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-chksum-re-idx* 0 ; (setq i (1+ i))
+ (defconst *cpio-newc-chksum-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-newc-header-re* to parse the chksum.")
- (setq *cpio-newc-chksum-re-idx* (setq i (1+ i)))
- (defconst *cpio-newc-filename-re-idx* 0 ; (setq i (1+ i))
- "Index of the sub RE from *cpio-newc-header-re* to parse the namesize.")
- (setq *cpio-newc-filename-re-idx* (setq i (1+ i))))
+ (defconst *cpio-newc-filename-re-idx* (setq i (1+ i))
+ "Index of the sub RE from *cpio-newc-header-re* to parse the namesize."))
;;
;; EO newc header variables.
;;
@@ -247,73 +213,53 @@
;; *cpio-newc-magic-re*
(defconst *cpio-newc-magic* *cpio-newc-magic-re*
"The string that identifies an entry as a NEWC style cpio(1) entry.")
-(setq *cpio-newc-magic* *cpio-newc-magic-re*)
(defconst *cpio-newc-field-width* 8
"The width of all of the fields in a newc header.")
-(setq *cpio-newc-field-width* 8)
(defconst *cpio-newc-padding-modulus* 4
"The modulus to which some things are padded in a NEWC cpio archive.")
-(setq *cpio-newc-padding-modulus* 4)
(defconst *cpio-newc-padding-char* ?\0
"A character to be used for padding headers and entry contents
in a newc cpio archive.")
-(setq *cpio-newc-padding-char* ?\0)
(defconst *cpio-newc-padding-str* "\0"
"A single character string of the character
to be used for padding headers and entry contents
in a newc cpio archive.")
-(setq *cpio-newc-padding-str* "\0")
(let ((i 0)
(l (length *cpio-newc-magic-re*)))
(defconst *cpio-newc-magic-field-offset* i)
- (setq *cpio-newc-magic-field-offset* i)
(setq i (1+ i))
- (defconst *cpio-newc-ino-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-ino-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-ino-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-mode-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-mode-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-mode-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-uid-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-uid-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-uid-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-gid-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-gid-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-gid-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-nlink-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-nlink-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-nlink-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-mtime-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-mtime-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-mtime-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-filesize-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-filesize-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-filesize-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-dev-maj-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-dev-maj-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-dev-maj-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-dev-min-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-dev-min-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-dev-min-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-rdev-maj-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-rdev-maj-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-rdev-maj-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-rdev-min-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-rdev-min-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-rdev-min-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-namesize-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-namesize-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-namesize-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-chksum-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-chksum-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
+ (defconst *cpio-newc-chksum-field-offset* (+ l (* *cpio-newc-field-width* (1- i))))
(setq i (1+ i))
- (defconst *cpio-newc-name-field-offset* (+ l (* *cpio-newc-field-width* i)))
- (setq *cpio-newc-name-field-offset* (+ l (* *cpio-newc-field-width* (1- i)))))
+ (defconst *cpio-newc-name-field-offset* (+ l (* *cpio-newc-field-width* (1- i)))))
(defconst *cpio-newc-trailer* "07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!\0\0\0\0"
"The TRAILER string for a newc archive.")
diff --git a/cpio-odc.el b/cpio-odc.el
index 69b5011..7ce822b 100644
--- a/cpio-odc.el
+++ b/cpio-odc.el
@@ -1,8 +1,8 @@
-;;; cpio-odc.el --- handle old portable cpio entry header format. -*- coding: utf-8 -*-
+;;; cpio-odc.el --- handle old portable cpio entry header format. -*- lexical-binding:t; coding: utf-8 -*-
;; COPYRIGHT
;;
-;; Copyright © 2019-2020 Free Software Foundation, Inc.
+;; Copyright © 2019-2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
@@ -40,6 +40,8 @@
(eval-when-compile (require 'cpio-generic)) ;For `with-writable-buffer'!
+(with-suppressed-warnings ((lexical fname)) (defvar fname))
+
;;;;;;;;;;;;;;;;
;; Things to make the byte compiler happy.
(defvar *cpio-catalog*)
@@ -95,59 +97,44 @@
(defconst *cpio-odc-magic-re* "070707"
"RE to match the magic number of a odc archive.")
-(setq *cpio-odc-magic-re* "070707")
(defconst *cpio-odc-field-width* 6
"The width of all of the fields in a odc header.")
-(setq *cpio-odc-field-width* 6)
(defconst *cpio-odc-ino-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*)
"RE to match the c_ino field in a odc header.")
-(setq *cpio-odc-ino-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*))
(defconst *cpio-odc-dev-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*)
"RE to match the c_dev field in a odc header.")
-(setq *cpio-odc-dev-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*))
(defconst *cpio-odc-mode-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*)
"RE to match the c_mode field in a odc header.")
-(setq *cpio-odc-mode-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*))
(defconst *cpio-odc-uid-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*)
"RE to match the c_uid field in a odc header.")
-(setq *cpio-odc-uid-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*))
(defconst *cpio-odc-gid-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*)
"RE to match the c_gid field in a odc header.")
-(setq *cpio-odc-gid-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*))
(defconst *cpio-odc-nlink-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*)
"RE to match the c_nlink field in a odc header.")
-(setq *cpio-odc-nlink-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*))
(defconst *cpio-odc-rdev-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*)
"RE to match the c_rdev field in a odc header.")
-(setq *cpio-odc-rdev-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*))
(defconst *cpio-odc-mtime-re* "[0-7]\\{11\\}"
"RE to match the c_mtime field in a odc header.")
-(setq *cpio-odc-mtime-re* "[0-7]\\{11\\}")
(defconst *cpio-odc-namesize-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*)
"RE to match the c_namesize field in a odc header.")
-(setq *cpio-odc-namesize-re* (format "[0-7]\\{%d\\}" *cpio-odc-field-width*))
(defconst *cpio-odc-filesize-re* "[0-7]\\{11\\}"
"RE to match the c_filesize field in a odc header.")
-(setq *cpio-odc-filesize-re* "[0-7]\\{11\\}")
(defconst *cpio-odc-filename-re* "[[:print:]]+"
"RE to match the c_filename field in a odc header.")
-(setq *cpio-odc-filename-re* "[[:print:]]+")
-(defconst *cpio-odc-header-re* ()
- "RE to match odc header format cpio archives.")
-(setq *cpio-odc-header-re* (concat "\\(" *cpio-odc-magic-re* "\\)"
+(defconst *cpio-odc-header-re* (concat "\\(" *cpio-odc-magic-re* "\\)"
"\\(" *cpio-odc-dev-re* "\\)"
"\\(" *cpio-odc-ino-re* "\\)"
"\\(" *cpio-odc-mode-re* "\\)"
@@ -161,56 +148,45 @@
"\\(" *cpio-odc-namesize-re* "\\)"
"\\(" *cpio-odc-filesize-re* "\\)"
"\\(" *cpio-odc-filename-re* "\\)"
- "\0"))
+ "\0")
+ "RE to match odc header format cpio archives.")
(let ((i 0))
- (defconst *cpio-odc-magic-re-idx* 0
+ (defconst *cpio-odc-magic-re-idx* (setq i (1+ i))
"RE to match the magic number in a odc header.")
- (setq *cpio-odc-magic-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-dev-re-idx* 0
+ (defconst *cpio-odc-dev-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the dev.")
- (setq *cpio-odc-dev-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-ino-re-idx* 0
+ (defconst *cpio-odc-ino-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the inode.")
- (setq *cpio-odc-ino-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-mode-re-idx* 0
+ (defconst *cpio-odc-mode-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the mode.")
- (setq *cpio-odc-mode-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-uid-re-idx* 0
+ (defconst *cpio-odc-uid-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the UID.")
- (setq *cpio-odc-uid-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-gid-re-idx* 0
+ (defconst *cpio-odc-gid-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the GID.")
- (setq *cpio-odc-gid-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-nlink-re-idx* 0
+ (defconst *cpio-odc-nlink-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the nlink.")
- (setq *cpio-odc-nlink-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-rdev-re-idx* 0
+ (defconst *cpio-odc-rdev-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the rdev.")
- (setq *cpio-odc-rdev-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-mtime-re-idx* 0
+ (defconst *cpio-odc-mtime-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the mtime.")
- (setq *cpio-odc-mtime-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-namesize-re-idx* 0
+ (defconst *cpio-odc-namesize-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the namesize.")
- (setq *cpio-odc-namesize-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-filesize-re-idx* 0
+ (defconst *cpio-odc-filesize-re-idx* (setq i (1+ i))
"Index of the sub RE from *cpio-odc-header-re* to parse the filesize.")
- (setq *cpio-odc-filesize-re-idx* (setq i (1+ i)))
- (defconst *cpio-odc-filename-re-idx* 0
- "Index of the sub RE from *cpio-odc-header-re* to parse the filename.")
- (setq *cpio-odc-filename-re-idx* (setq i (1+ i))))
+ (defconst *cpio-odc-filename-re-idx* (setq i (1+ i))
+ "Index of the sub RE from *cpio-odc-header-re* to parse the filename."))
;;
;; EO odc header variables.
;;
@@ -220,67 +196,49 @@
;; *cpio-odc-magic-re*
(defconst *cpio-odc-magic* *cpio-odc-magic-re*
"The string that identifies an entry as a ODC style cpio(1) entry.")
-(setq *cpio-odc-magic* *cpio-odc-magic-re*)
(defconst *cpio-odc-field-width* 6
"The width of all of the fields in a odc header.")
-(setq *cpio-odc-field-width* 6)
(defconst *cpio-odc-padding-modulus* 2
"The modulus to which some things are padded in a ODC cpio archive.")
-(setq *cpio-odc-padding-modulus* 2)
(defconst *cpio-odc-padding-char* ?\0
"A character to be used for padding headers and entry contents
in a odc cpio archive.")
-(setq *cpio-odc-padding-char* ?\0)
(defconst *cpio-odc-padding-str* "\0"
"A single character string of the character
to be used for padding headers and entry contents
in a odc cpio archive.")
-(setq *cpio-odc-padding-str* "\0")
(let ((offset-so-far 0))
(defconst *cpio-odc-magic-field-offset* offset-so-far)
- (setq *cpio-odc-magic-field-offset* offset-so-far)
- (defconst *cpio-odc-dev-field-offset* ())
- (setq *cpio-odc-dev-field-offset* (setq offset-so-far (+ offset-so-far (length *cpio-odc-magic*))))
+ (defconst *cpio-odc-dev-field-offset* (setq offset-so-far (+ offset-so-far (length *cpio-odc-magic*))))
- (defconst *cpio-odc-ino-field-offset* ())
- (setq *cpio-odc-ino-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
+ (defconst *cpio-odc-ino-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
- (defconst *cpio-odc-mode-field-offset* ())
- (setq *cpio-odc-mode-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
+ (defconst *cpio-odc-mode-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
- (defconst *cpio-odc-uid-field-offset* ())
- (setq *cpio-odc-uid-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
+ (defconst *cpio-odc-uid-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
- (defconst *cpio-odc-gid-field-offset* ())
- (setq *cpio-odc-gid-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
+ (defconst *cpio-odc-gid-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
- (defconst *cpio-odc-nlink-field-offset* ())
- (setq *cpio-odc-nlink-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
+ (defconst *cpio-odc-nlink-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
- (defconst *cpio-odc-rdev-field-offset* ())
- (setq *cpio-odc-rdev-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
+ (defconst *cpio-odc-rdev-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
- (defconst *cpio-odc-mtime-field-offset* ())
- (setq *cpio-odc-mtime-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
+ (defconst *cpio-odc-mtime-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
- (defconst *cpio-odc-namesize-field-offset* ())
- (setq *cpio-odc-namesize-field-offset* (setq offset-so-far (+ offset-so-far 11)))
+ (defconst *cpio-odc-namesize-field-offset* (setq offset-so-far (+ offset-so-far 11)))
- (defconst *cpio-odc-filesize-field-offset* ())
- (setq *cpio-odc-filesize-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
+ (defconst *cpio-odc-filesize-field-offset* (setq offset-so-far (+ offset-so-far *cpio-odc-field-width*)))
- (defconst *cpio-odc-name-field-offset* ())
- (setq *cpio-odc-name-field-offset* (setq offset-so-far (+ offset-so-far 11))))
+ (defconst *cpio-odc-name-field-offset* (setq offset-so-far (+ offset-so-far 11))))
(defconst *cpio-odc-trailer* "0707070000000000000000000000000000000000010000000000000000000001300000000000TRAILER!!!\0"
"The TRAILER string for a odc archive.")
-(setq *cpio-odc-trailer* "0707070000000000000000000000000000000000010000000000000000000001300000000000TRAILER!!!\0")
(defcustom *cpio-odc-blocksize* 512
@@ -414,9 +372,8 @@ This function does NOT get the contents."
(let* ((fname "cpio-odc-parse-mtime")
(this-offset *cpio-odc-mtime-field-offset*)
(end-offset (+ this-offset 11))
- (time-value ()))
- (setq time-value (string-to-number (substring header-string this-offset end-offset) 8))
- (setq time-value (list (lsh (logand #xFFFF0000 time-value) -16) (logand #xFFFF)))))
+ (time-value (string-to-number (substring header-string this-offset end-offset) 8)))
+ (list (ash (logand #xFFFF0000 time-value) -16) (logand #xFFFF))))
(defun cpio-odc-parse-filesize (header-string)
"Get the filesize from the HEADER-STRING."
@@ -448,7 +405,7 @@ This function does NOT get the contents."
(defun cpio-odc-parse-name (header-string namesize)
"Get the name field from HEADER-STRING.
-N.B. When called with the correct namesize, this includes the terminating \0."
+N.B. When called with the correct namesize, this includes the terminating \\0."
(let* ((fname "cpio-odc-parse-name")
(this-offset *cpio-odc-name-field-offset*)
(tmp-string (substring header-string this-offset (+ this-offset namesize -1))))
diff --git a/cpio-tar.el b/cpio-tar.el
index 1d3fa92..8e60984 100644
--- a/cpio-tar.el
+++ b/cpio-tar.el
@@ -1,8 +1,8 @@
-;; cpio-tar.el --- Let tar-mode handle tar archives. -*- coding: utf-8 -*-
+;; cpio-tar.el --- Let tar-mode handle tar archives -*- coding: utf-8; lexical-binding: t -*-
;; COPYRIGHT
;;
-;; Copyright © 2019 Free Software Foundation, Inc.
+;; Copyright © 2019, 2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify
diff --git a/cpio-ustar.el b/cpio-ustar.el
index 3e89c98..9adce50 100644
--- a/cpio-ustar.el
+++ b/cpio-ustar.el
@@ -1,8 +1,8 @@
-;; cpio-ustar.el --- Let tar-mode handle tar archives. -*- coding: utf-8 -*-
+;; cpio-ustar.el --- Let tar-mode handle tar archives -*- coding: utf-8; lexical-binding: t -*-
;; COPYRIGHT
;;
-;; Copyright © 2019 Free Software Foundation, Inc.
+;; Copyright © 2019, 2024 Free Software Foundation, Inc.
;; All rights reserved.
;;
;; This program is free software: you can redistribute it and/or modify