Created
January 21, 2016 13:59
-
-
Save ceving/011fa52a220612bc0466 to your computer and use it in GitHub Desktop.
Define all parent directories of a path in a prototype file for Sun's pkgmk tool creating Solaris packages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun sunpkg-mkdir () | |
"Define all parent directories of a path in a prototype file | |
for Sun's pkgmk tool creating Solaris packages. When the cursor | |
is in a line containing the following crontab definition | |
e cron var/spool/cron/crontabs/root=src/crontab ? ? ? | |
the function will insert the following directories in front of if | |
d cron var ? ? ? | |
d cron var/spool ? ? ? | |
d cron var/spool/cron ? ? ? | |
d cron var/spool/cron/crontabs ? ? ? | |
" | |
(interactive) | |
(save-excursion | |
(beginning-of-line) | |
(if (looking-at "^[de]\\s-+\\(\\w+\\)\\s-+\\([^ =]+\\)") | |
(let ((path nil) | |
(class (match-string 1))) | |
(dolist (element (butlast (split-string (match-string 2) "/"))) | |
(setq path (if path | |
(concat path "/" element) | |
element)) | |
(insert "d " class " " path " ? ? ?") | |
(newline)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment