summaryrefslogtreecommitdiffstats
path: root/private/mvdm/softpc.new/rename
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/mvdm/softpc.new/rename
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/mvdm/softpc.new/rename')
-rw-r--r--private/mvdm/softpc.new/rename/rename.c100
-rw-r--r--private/mvdm/softpc.new/rename/sources55
2 files changed, 155 insertions, 0 deletions
diff --git a/private/mvdm/softpc.new/rename/rename.c b/private/mvdm/softpc.new/rename/rename.c
new file mode 100644
index 000000000..e26c43306
--- /dev/null
+++ b/private/mvdm/softpc.new/rename/rename.c
@@ -0,0 +1,100 @@
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Include files */
+
+#include "windows.h"
+
+#include "stdio.h"
+#include "stdlib.h"
+#include "string.h"
+
+#define MAX_NAME_SIZE (8)
+#define MAX_EXT_SIZE (3)
+
+char CharRemoveList[] = "AEIOUaeiou_";
+
+int ConvertFileName(char *NameToConvert);
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::: Main entry point */
+
+_CRTAPI1 main(int argc, char *argv[])
+{
+ int index;
+
+ /*......................................... Validate input parameters */
+
+ if(argc < 2)
+ {
+ printf("Invalid usage : rename <filenames>\n");
+ return(1);
+ }
+
+
+ for(index = 1; index < argc; index++)
+ ConvertFileName(argv[index]);
+
+ return(0);
+}
+
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+int ConvertFileName(char *NameToConvert)
+{
+ char *Name, *Ext, *ExtStart;
+ int NameSize, ExtSize;
+ char NewName[MAX_NAME_SIZE+1], NewFileName[1000];
+ char *NewNamePtr;
+
+ /*....................... Get the size of the file name and extension */
+
+ for(Name = NameToConvert, NameSize = 0;
+ *Name && *Name != '.'; Name++, NameSize++);
+
+ for(ExtStart = Name, Ext = *Name == '.' ? Name+1 : Name, ExtSize = 0;
+ *Ext ; Ext++, ExtSize++);
+
+ /*................................ Validate name and extension sizes */
+
+ if(ExtSize > MAX_EXT_SIZE)
+ {
+ printf("Unable to convert '%s' to 8.3 filename\n", NameToConvert);
+ return(1);
+ }
+
+
+ if(NameSize <= MAX_NAME_SIZE)
+ {
+ /* Name does not need conversion */
+ return(0);
+ }
+
+ /*................................................ Convert file name */
+
+ NewNamePtr = &NewName[MAX_NAME_SIZE];
+ *NewNamePtr-- = 0;
+
+ do
+ {
+ Name--;
+
+ if(NameSize > MAX_NAME_SIZE && strchr(CharRemoveList, *Name))
+ NameSize--; /* Remove character */
+ else
+ *NewNamePtr-- = *Name;
+ }
+ while(NewNamePtr >= NewName && Name != NameToConvert);
+
+ /*............................................. Validate conversion */
+
+ if(NameSize > MAX_NAME_SIZE)
+ {
+ printf("Unable to convert '%s' to 8.3 filename\n", NameToConvert);
+ return(1);
+ }
+
+ sprintf(NewFileName,"%s%s", NewNamePtr+1, ExtStart);
+ printf("REN '%s' to '%s'\n", NameToConvert, NewFileName);
+ rename(NameToConvert, NewFileName);
+
+ return(0);
+}
diff --git a/private/mvdm/softpc.new/rename/sources b/private/mvdm/softpc.new/rename/sources
new file mode 100644
index 000000000..79e7e7095
--- /dev/null
+++ b/private/mvdm/softpc.new/rename/sources
@@ -0,0 +1,55 @@
+!IF 0
+
+!IF $(ALPHA)
+GPSIZE=0
+!ELSE
+GPSIZE=32
+!ENDIF
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ sources.
+
+Abstract:
+
+ This file specifies the target component being built and the list of
+ sources files needed to build that component. Also specifies optional
+ compiler switches and libraries that are unique for the component being
+ built.
+
+
+Author:
+
+ Steve Wood (stevewo) 12-Apr-1990
+
+NOTE: Commented description of this file is in \nt\bak\bin\sources.tpl
+
+!ENDIF
+
+
+MAJORCOMP=spc
+MINORCOMP=rename
+TARGETNAME=rename
+TARGETPATH=$(SOFTPC_ROOT)\rename\obj
+
+
+
+# Pick one of the following and delete the others
+TARGETTYPE=PROGRAM
+
+TARGETLIBS=
+
+SOURCES=rename.c
+
+LINKLIBS= $(BASEDIR)\public\sdk\lib\*\setargv.obj
+
+
+NTTEST=
+
+UMTYPE=console
+UMTEST=
+UMAPPL=
+UMBASE=0x1000000
+UMLIBS=