Added scripts to rename DOS 8.3 names to their proper longer names
authorKeith Vetter <keithv@fusion.com>
Thu, 27 Apr 1995 18:20:16 +0000 (18:20 +0000)
committerKeith Vetter <keithv@fusion.com>
Thu, 27 Apr 1995 18:20:16 +0000 (18:20 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5550 dc483132-0cff-0310-8789-dd5450dbe970

src/config/ChangeLog
src/config/post.in
src/config/ren2long [new file with mode: 0644]
src/config/ren2long.awk [new file with mode: 0644]

index de36fddf72433cb56ebb18c63f3069ffe99f8e8c..ca8b45997272cf82e9243690a06425b1368eab03 100644 (file)
@@ -1,3 +1,9 @@
+Wed Apr 26 14:27:03 1995 Keith Vetter (keithv@fusion.com)
+
+       * post.in: added target check-windows.
+       * ren2long, ren2long.awk: scripts to rename DOS 8.3 names back
+          to their proper longer names.
+
 Thu Apr 20 20:00:42 1995  Theodore Y. Ts'o  (tytso@dcl)
 
        * post.in: The .depend production rule now does even more
index 1425f5604509ffb1a927ee259dbba5ae862bad8b..ae1e2a2405965f14d8fa2c73332404b8858d6c67 100644 (file)
@@ -4,6 +4,7 @@
 all::
 
 check::
+check-windows::
 
 .depend: $(SRCS) $(SRCTOP)/util/depfix.sed
        if test -n "$(SRCS)" ; then \
diff --git a/src/config/ren2long b/src/config/ren2long
new file mode 100644 (file)
index 0000000..e44dc8d
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Shell script that changes names that have been truncated to 8.3 format
+# back to their original longer name. The awk script produces a script with
+# lines of the following format:
+#     if [ -f <short> ]; then echo ::mv <short> <long> ; mv <short> <long> ; fi
+# These lines then get executed in bin/sh.
+#
+find . -type f -print | gawk -f $0.awk | sh -x 2> /dev/null
diff --git a/src/config/ren2long.awk b/src/config/ren2long.awk
new file mode 100644 (file)
index 0000000..fcf0177
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Awk script to convert filenames shortened down to 8.3 
+# back to their larger size. 
+#
+# Works by looking at every filename and seeing if it's shortened
+# 8.3 version exists, and if so then mv the short name to the long
+# name.
+#
+# Usage: find . -type f -print | gawk -f ren2long.awk | sh -x [ 2> /dev/null ]
+#
+
+
+# Parse_path
+#
+# Takes the whole path and converts the basename part to 8.3. If it
+# changed in the process we emit a sh command to mv it if the shortened
+# name exists.
+# 
+function parse_path(p,P2,N,NEW) {
+
+     P2 = tolower(p)
+
+     NEW = ""
+     while(1) {
+         N = index(P2,"/")                     # Go until all / are parsed
+         if (N == 0) break
+
+         NEW = NEW name83(substr(P2,1,N-1)) "/"; # More of the path
+         P2 = substr(P2,N+1)
+     }
+
+     if (bad[P2] == 1) {
+         print "echo skipping " p
+         return
+     }
+     NEW = NEW name83(P2)                      # Append path and 8.3 name
+
+     if (bad[P2] == 2) {
+         print "if [ -f " NEW " ]; then echo ::rm " NEW " ; rm " NEW " ; fi"
+         return
+     }
+     if (NEW != p) 
+         print "if [ -f " NEW " ]; then echo ::mv " NEW " " p " ; mv " NEW " " p " ; fi"
+}
+#
+# Name83
+# 
+# Converts the a single component part of a file name into 8.3 format
+#
+function name83(fname,P,B,E) {
+     P = index(fname,".");                     # Find the extension
+
+     if (P == 0) {                             # No extension
+         B = substr(fname,1,8);                # Just truncate at 8 chars
+         return B;
+    }
+
+    B = substr(fname, 1, P <= 8 ? P-1 : 8);    # At most 8 chars in name
+    E = substr(fname, P+1, 3)                  # And 3 in extension
+    P = index(E, ".")                          # 2 dot problem
+    if (P)
+        E = substr(E, 1, P-1)
+
+     B = B "." E                               # Put name together
+     return B
+}
+BEGIN {
+     bad["krb5-types-aux.h"] = 1
+     bad["autoconf.h.in"] = 1
+     bad["conv_tkt_skey.c"] = 1
+     ##bad["makefile"] = 2 -- windows have legitimate files with this name
+}
+{
+     parse_path($1)                            # Do it
+}