svn rev #23082: trunk/src/ util/

tlyu@MIT.EDU tlyu at MIT.EDU
Wed Oct 28 15:56:19 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=23082
Commit By: tlyu
Log Message:
New elisp file to mark C styles in files.  New top-level Makefile
target "make mark-cstyle".  The exception list is not final; it's just
a starting point for discussion.


Changed Files:
U   trunk/src/Makefile.in
A   trunk/src/util/krb5-mark-cstyle.el
Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in	2009-10-28 19:17:35 UTC (rev 23081)
+++ trunk/src/Makefile.in	2009-10-28 19:56:19 UTC (rev 23082)
@@ -665,3 +665,20 @@
 	-print0 | $(XARGS) -0 $(EMACS) -q -batch \
 	-l $(SRCTOP)/util/krb5-c-style.el \
 	-l $(SRCTOP)/util/krb5-batch-reindent.el
+
+mark-cstyle::
+	$(FIND) $(SRCTOP) \( \
+	-path $(SRCTOP)/appl/bsd -o \
+	-path $(SRCTOP)/appl/gssftp -o \
+	-path $(SRCTOP)/appl/telnet -o \
+	-path $(SRCTOP)/include/gssrpc -o \
+	-path $(SRCTOP)/lib/crypto/krb/yarrow -o \
+	-path $(SRCTOP)/lib/rpc -o \
+	-path $(SRCTOP)/plugins/kdb/db2/libdb2 -o \
+	-path $(SRCTOP)/lib/krb5/unicode -o \
+	-path $(SRCTOP)/windows/wintel \
+	\) -prune -o \
+	-name '*.[ch]' \
+	-print0 | $(XARGS) -0 $(EMACS) -q -batch \
+	-l $(SRCTOP)/util/krb5-c-style.el \
+	-l $(SRCTOP)/util/krb5-mark-cstyle.el -cstyle-krb5

Added: trunk/src/util/krb5-mark-cstyle.el
===================================================================
--- trunk/src/util/krb5-mark-cstyle.el	2009-10-28 19:17:35 UTC (rev 23081)
+++ trunk/src/util/krb5-mark-cstyle.el	2009-10-28 19:56:19 UTC (rev 23082)
@@ -0,0 +1,28 @@
+;;; -*- mode: emacs-lisp; indent-tabs-mode: nil -*-
+(if (not noninteractive)
+    (error "to be used only with -batch"))
+
+(defvar bsd-style nil)
+(defvar krb5-style nil)
+
+(push '("-cstyle-bsd" . (lambda (ignored) (setq bsd-style t))) command-switch-alist)
+(push '("-cstyle-krb5" . (lambda (ignored) (setq krb5-style t))) command-switch-alist)
+
+;; Avoid vc-mode interference.
+(setq vc-handled-backends nil)
+(while command-line-args-left
+  (let ((filename (car command-line-args-left))
+        (error nil)
+        ;; No backup files?
+        (make-backup-files nil))
+    (find-file filename)
+
+    (goto-char (point-min))
+    (if (looking-at "\\s-*/\\*\\s-*-\\*-.*-\\*-\\s-*\\*/\\s-*\n")
+     (delete-region (match-beginning 0) (match-end 0)))
+    (if bsd-style
+        (insert "/* -*- mode: c; c-file-style: \"bsd\"; indent-tabs-mode: t -*- */\n")
+      (insert "/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */\n"))
+    (save-buffer)
+    (kill-buffer)
+    (setq command-line-args-left (cdr command-line-args-left))))




More information about the cvs-krb5 mailing list