What version of the complier are you using?

You can also apply the following patches, since the external references you
mentioned aren't being used:

diff -NurEB --exclude-from=exclude bas/src/config/util_cr.c
upd/src/config/util_cr.c
--- bas/src/config/util_cr.c    2002-12-10 18:44:40.000000000 -0800
+++ upd/src/config/util_cr.c    2003-01-17 17:00:32.000000000 -0800
@@ -18,7 +18,10 @@
 #include "malloc.h"
 #include "time.h"
 #include "stdlib.h"
-#include <Winver.h>
+
+#ifndef  intptr_t
+#define intptr_t long
+#endif

 void usuage()
 {
@@ -33,6 +36,7 @@
        OR util_cr @ file.ini \"[SectionKey]variable=value\" ; update ini-ipr-pwf
file\n\
        OR util_cr @ file.ini \"[SectionKey]variable=value*DatE*\" ; update
ini-ipr-pwf file, insert date\n\
        OR util_cr ~  ;force error\n\
+       OR util_cr _del  [/q=quiet /s=recurese] [*. *. *.] ;delete \n\
        OR util_cr _ [nt xp 98 9x w2] ;test for OS, return 1 if match else 0\n\
        OR unil_cr __ return compiler version\n" );
        exit(0xc000);
@@ -43,103 +47,6 @@
                WORD charset;        // character set (code page)
 };

-int CheckVersion(int argc,char *argv[])
-{
-       OSVERSIONINFO VersionInfo;
-       int i;
-       memset(&VersionInfo,0,sizeof(VersionInfo));
-       VersionInfo.dwOSVersionInfoSize =sizeof(OSVERSIONINFO);
-       if (!GetVersionEx(&VersionInfo))
-       {
-               return 0XC000;
-       }
-       for (i=1;i<argc;i++)
-       {
-               if (stricmp(argv[i],"nt")==0)
-               {
-                       if ((VersionInfo.dwPlatformId==VER_PLATFORM_WIN32_NT)
-                               && (VersionInfo.dwMajorVersion==4)
-                               && (VersionInfo.dwMinorVersion==0))
-                               return 1;
-               }
-               if (stricmp(argv[i],"xp")==0)
-               {
-                       if ((VersionInfo.dwPlatformId==VER_PLATFORM_WIN32_NT)
-                               && (VersionInfo.dwMajorVersion==5)
-                               && (VersionInfo.dwMinorVersion==1))
-                               return 1;
-               }
-               if (stricmp(argv[i],"w2")==0)
-               {
-                       if ((VersionInfo.dwPlatformId==VER_PLATFORM_WIN32_NT)
-                               && (VersionInfo.dwMajorVersion==5)
-                               && (VersionInfo.dwMinorVersion==0))
-                               return 1;
-               }
-               if (stricmp(argv[i],"98")==0)
-               {
-                       if ((VersionInfo.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS) &&
(VersionInfo.dwMinorVersion==10))
-                               return 1;
-               }
-               if (stricmp(argv[i],"95")==0)
-               {
-                       if ((VersionInfo.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS) &&
(VersionInfo.dwMinorVersion==0))
-
-                               return 1;
-               }
-               if (stricmp(argv[i],"9x")==0)
-               {
-                       if (VersionInfo.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)
-                               return 1;
-               }
-               if (stricmp(argv[i],"_")==0)
-                       return 0;
-       }
-       return 0;
-}
-
-int DoCheckVersion(int argc,char *argv[])
-{
-       //arg 1 nth versions
-       //arg nth _
-       //arg n+1 command
-       //arg n+2 option true
-       //arg n+3 option false
-       //arg n+4 ... command arguments
-       int x,i;
-       int ret;
-       char command[1024];
-       for (x=1;((x<argc) && (strcmp(argv[x],"_")!=0));x++);
-       if (strcmp(argv[x],"_")!=0)
-               return 0xc000;
-       ret=CheckVersion(argc-x,&argv[x]);
-       if (x+6>=argc)
-       {
-               return ret;
-       }
-       for (++x;((x<argc) && (strcmp(argv[x],"_")!=0));x++);
-       if (strcmp(argv[x],"_")!=0)
-               return 0xc000;
-       i=0;
-       GetSystemDirectory(command,sizeof(command));
-       sprintf(command,"%s\\cmd.exe",command);
-       argv[i++]=command;
-       argv[i++]="/c";
-       argv[i++]=argv[x+1];
-       if (ret)
-               argv[i++]=argv[x+2];
-       else
-               argv[i++]=argv[x+3];
-       for (x+=4;x<argc;x++)
-               argv[i++]=argv[x];
-       argv[i]=NULL;
-/*     for (i=0;argv[i];i++)
-               command=argv[i];
-*/
-       ret=_spawnv(_P_WAIT,argv[0],argv);
-       return 0;
-}
-
 void Addkey (const char *hkey,const char *subkey,const char *stag,const
char *sval)
 {
        DWORD disposition,result;
@@ -202,26 +109,107 @@
        }
 }

+void doremove(BOOL bRecurse,BOOL bQuiet,char* argv)
+{
+       char *pParm;
+       char parm[MAX_PATH+1];
+       char basdir[MAX_PATH+1];
+       strcpy(parm,argv);
+       pParm=parm;
+       GetCurrentDirectory(sizeof(basdir),basdir);
+       if (strrchr(parm,'\\')!=NULL)
+       {/*jump to base directory*/
+               pParm=strrchr(parm,'\\');
+               *pParm=0;
+               if (!SetCurrentDirectory(parm))
+                       return;
+               pParm++;
+       }
+       if (!bRecurse)
+       {
+               struct _finddata_t fileinfo;
+               intptr_t hfile;
+               BOOL bmore;
+               char basdir[MAX_PATH+1];
+               GetCurrentDirectory(sizeof(basdir),basdir);
+               hfile=_findfirst(pParm,&fileinfo);
+               bmore=(hfile!=-1);
+               while (bmore)
+               {
+                       if ((DeleteFile(fileinfo.name)==1) && (!bQuiet))
+                               printf("Remove %s\\%s\n",basdir,fileinfo.name);
+                       bmore=(_findnext(hfile,&fileinfo)==0);
+               }
+               _findclose(hfile);
+       } else {
+       /*RECURSIVE LOOP - SCAN directories*/
+               struct _finddata_t fileinfo;
+               intptr_t hfile;
+               BOOL bmore;
+               doremove(FALSE,bQuiet,pParm);
+               hfile=_findfirst("*.*",&fileinfo);
+               bmore=(hfile!=-1);
+               while (bmore)
+               {
+                       if (fileinfo.attrib & _A_SUBDIR)
+                       {
+                               if ((strcmp(fileinfo.name,".")!=0) && 
+(strcmp(fileinfo.name,"..")!=0))
+                               {
+                                       if (SetCurrentDirectory(fileinfo.name))
+                                               doremove(TRUE,bQuiet,pParm);
+                                       SetCurrentDirectory(basdir);
+                               }
+                       }
+                       bmore=(_findnext(hfile,&fileinfo)==0);
+               }
+               _findclose(hfile);
+       }
+       SetCurrentDirectory(basdir);
+}
+
 int main(int argc, char* argv[])
 {
+/*     typedef char * CHARP;*/
        char fname[128];
        FILE *file;
        int l,i;
        char **pvar,*ch;
        long len;
-       typedef char * CHARP;
+       BOOL bRecurse=FALSE;
+       BOOL bQuiet=FALSE;
        if (argc<2)
                usuage();
+       if (stricmp(argv[1],"_del")==0) /*DELETE routine*/
+       {
+               int iargc=2;
+               if ((argc>iargc) && (stricmp(argv[iargc],"/s")==0))
+               {
+                       iargc++;
+                       bRecurse=TRUE;
+               }
+               if ((argc>iargc) && (stricmp(argv[iargc],"/q")==0))
+               {
+                       iargc++;
+                       bQuiet=TRUE;
+               }
+               if ((argc>iargc) && (stricmp(argv[iargc],"/s")==0))
+               {
+                       iargc++;
+                       bRecurse=TRUE;
+               }
+               while (iargc<argc)
+               {
+                       doremove(bRecurse,bQuiet,argv[iargc]);
+                       iargc++;
+               }
+               return 0;
+       }
        if (strcmp(argv[1],"__")==0)
        {
                return _MSC_VER;
        }
         if (argc<3)
                usuage();
-       if (strcmp(argv[1],"_")==0)
-       {
-               return DoCheckVersion(argc,argv);
-       }
        if (strcmp(argv[1],"}")==0)
        {
                char v1[4],v2[4],v3[4],v4[4];
@@ -542,7 +530,7 @@
                ch++;
        }
        fclose(file);
-       pvar=(CHARP *)malloc(argc*sizeof(CHARP));
+       pvar=(char **)malloc(argc*sizeof(char *));
        for (i=1;i<argc-1;i++)
                pvar[i]=argv[i+1];
        pvar[argc-1]=NULL;

James
"Integrity is the Base of Excellence"

_______________________________________________
OpenAFS-devel mailing list
[EMAIL PROTECTED]
https://lists.openafs.org/mailman/listinfo/openafs-devel

Reply via email to