From f3a45bb3126e61e8ed899af471b55833d27b3597 Mon Sep 17 00:00:00 2001 From: Keith Vetter Date: Thu, 27 Apr 1995 18:20:16 +0000 Subject: [PATCH] Added scripts to rename DOS 8.3 names to their proper longer names git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5550 dc483132-0cff-0310-8789-dd5450dbe970 --- src/config/ChangeLog | 6 ++++ src/config/post.in | 1 + src/config/ren2long | 9 +++++ src/config/ren2long.awk | 75 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 src/config/ren2long create mode 100644 src/config/ren2long.awk diff --git a/src/config/ChangeLog b/src/config/ChangeLog index de36fddf7..ca8b45997 100644 --- a/src/config/ChangeLog +++ b/src/config/ChangeLog @@ -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 diff --git a/src/config/post.in b/src/config/post.in index 1425f5604..ae1e2a240 100644 --- a/src/config/post.in +++ b/src/config/post.in @@ -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 index 000000000..e44dc8d5f --- /dev/null +++ b/src/config/ren2long @@ -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 ]; then echo ::mv ; mv ; 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 index 000000000..fcf0177ea --- /dev/null +++ b/src/config/ren2long.awk @@ -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 +} -- 2.26.2