summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2009-10-28 19:56:19 +0000
committerTom Yu <tlyu@mit.edu>2009-10-28 19:56:19 +0000
commit6cb857e034830a2c17bcb9af881217dd8d7d93bc (patch)
tree85bb216a51eec4716132f8085937f26ece6c3c6b /src
parent83c40776396c2c79a1f3a582cb1be6872b871be5 (diff)
downloadkrb5-6cb857e034830a2c17bcb9af881217dd8d7d93bc.tar.gz
krb5-6cb857e034830a2c17bcb9af881217dd8d7d93bc.tar.xz
krb5-6cb857e034830a2c17bcb9af881217dd8d7d93bc.zip
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. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23082 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in17
-rw-r--r--src/util/krb5-mark-cstyle.el28
2 files changed, 45 insertions, 0 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 758f55eca..f528472d5 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -665,3 +665,20 @@ reindent::
-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
diff --git a/src/util/krb5-mark-cstyle.el b/src/util/krb5-mark-cstyle.el
new file mode 100644
index 000000000..444b18981
--- /dev/null
+++ b/src/util/krb5-mark-cstyle.el
@@ -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))))