//                exc.cpp

 

//  C++言語の為の学習用番号付きDIR表示のサンプルプログラムです。未完成でコンパイルしても正しく作動する保証は有りません。

//  このプログラムを使用して問題が発生しても責任は持てません、補償には応じ兼ねます、悪しからず。プログラムの学習専用です。

 

 

 

// これは、アプリケーション ウィザードを使って生成された、VC++ アプリケーション プロジェクトの

// メイン プロジェクト ファイルです。

 

#include "stdafx.h"

 

//#using <mscorlib.dll>

#include <tchar.h>

 

//using namespace System;

 

 

 

// exc.cpp : コンソール アプリケーション用のエントリ ポイントの定義

//

 

//#include     "stdafx.h"

#include     <stdio.h>

#include     <stdlib.h>

#include     <direct.h>

#include     <string.h>

#include     <ctype.h>

#include     <process.h>

#include     <locale.h>

#include     <conio.h>

#include     <sys\\stat.h>

#include     <time.h>

#include     <sys\\stat.h>

#include     <math.h>

#include     <io.h>

#include     <wchar.h>

#include     <direct.h>

#include     <errno.h>

 

 

 

 

 

 

#define      WXP        L"Microsoft Windows XP"

#define      W20        L"Microsoft Windows 20"

#define      WNT        L"Microsoft Windows NT"

#define      WMe        L"Microsoft Windows Me"

#define      WME        L"Microsoft Windows ME"

#define      W98        L"Microsoft Windows 98"

#define      W95        L"Microsoft Windows 95"

#define      IE         L"\\Program Files\\Internet Explorer\\iexplore.exe"

#define      MWORD      L"\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE"

#define      EXCEL      L"\\Program Files\\Microsoft Office\\Office\\EXCEL.EXE"

#define      XPMWORD    L"\\Program Files\\Microsoft Office\\Office10\\WINWORD.EXE"

#define      XPEXCEL    L"\\Program Files\\Microsoft Office\\Office10\\EXCEL.EXE"

#define      OUTLOOK    L"\\Program Files\\Microsoft Office\\Office10\\OUTLOOK.EXE"

#define      OUTLOOKEX  L"\\Program Files\\Outlook Express\\msimn.exe"

#define      EX         L"explorer.exe"

#define      NOTE       L"system32\\NOTEPAD.exe"

#define      _UNICOD

#define      OASYS      L"\\Program Files\\OASYS2002\\PBIN\\oasys.exe"

 

 

 

extern int   excmain(int,wchar_t **,wchar_t **);

extern int   extcmdf(wchar_t *);

extern int       cdf(wchar_t *);

extern int      setf(wchar_t *);

extern int     helplistf(void);

extern int     envf(int);

wchar_t    prgdrive[10];

 

 

 

 

 

int         aaaa(void);

int        assocf(wchar_t   *);

wchar_t    *enn(wchar_t   *);

int         osf(void);

int    cmdfmain(int , wchar_t **,wchar_t **);

int        cmdf(wchar_t *);

int        inif(void);

 

int    nospacef(wchar_t *);

 

int      dirunc(wchar_t *,wchar_t *);

int      uncdir(wchar_t *,wchar_t *);

int     chdrive(wchar_t *);

int        dirf(wchar_t *);

int       xdirf(int,wchar_t *);

int       _dirf(wchar_t *);

int        excf(wchar_t *);

int     systemf(int,wchar_t *);

int  excsystemf(wchar_t *);

int modesystemf(wchar_t *);

int        test(void);

int         dor(wchar_t *);

int      exccmd(wchar_t *);

int         ief(wchar_t *);

int         exf(wchar_t *);

int      cdtest(wchar_t *);

int        pwdf(void);

int      kannji(wchar_t *);

int    fnamechf(wchar_t *);

int      pcname(wchar_t * ,wchar_t *);

int     norootf(wchar_t *);

int        keyf(void);

int       notef(wchar_t *);

int       wordf(wchar_t *);

int    outlookf(wchar_t *);

int      excelf(wchar_t *);

int       statf(wchar_t *);

int     attribf(int ,wchar_t *);

int     cdhistf(void);

int    cmdhistf(wchar_t *);

int      atimef(void);

int       cmdf3(wchar_t  *);

int       cmdf2(wchar_t  *);

int       cmdf4(wchar_t  *);

int       cmdf5(wchar_t  *);

int       cmdf6(wchar_t  *);

int      findf(wchar_t  *);

int   findsubf(wchar_t  *);

int    finddirf(int  ,wchar_t  *);

int      ctimef(void);

int     modedir(int ,wchar_t  *);

int       treef(int  ,wchar_t  *);

int    saigennf(int ,wchar_t *);

int       helpf(wchar_t *);

int    kennsaku(wchar_t *);

int       execf(int,wchar_t *);

int      spawnf(int,wchar_t *);

int       linef(wchar_t *);

int      linedf(wchar_t *);

int        urlf(void);

int      zenngo(wchar_t *,wchar_t *,wchar_t *);

int       pathdirf(wchar_t *,wchar_t *);

int       pathrootf(wchar_t *);

int       pathsubf(wchar_t *);

int      findfilef(wchar_t *);

int         ftypef(wchar_t *);

int         ftypef2(wchar_t *,wchar_t *);

int       errnof(void);

int    doserrnof(void);

int       errlistf(int);

int       envsetf(void);

int         batcmdf(void);

int          batrunf(wchar_t *);

int          holderf(wchar_t *);

int          endf(void);

int       sysexcf(void);

int        filenullf(wchar_t *);

int       avef(void);

 

 

int      zzzz(void);

 

wchar_t     osb[30];

wchar_t     *os=osb;

wchar_t     homeb[1024];

wchar_t     *home=homeb;

wchar_t     tempb[1024];

wchar_t     *temp=tempb;

wchar_t     noteb[1024];

wchar_t     *note=noteb;

wchar_t     wordb[1024];

wchar_t     *word=wordb;

wchar_t     wordsb[1024];

wchar_t     *words=wordsb;

wchar_t     outlookb[1024];

wchar_t     *outlook=outlookb;

wchar_t     outlook2b[1024];

wchar_t     *outlook2=outlook2b;

wchar_t     outlook2sb[1024];

wchar_t     *outlook2s=outlook2sb;

wchar_t     outlooksb[1024];

wchar_t     *outlooks=outlooksb;

wchar_t     excelb[1024];

wchar_t     *excel=excelb;

wchar_t     excelsb[1024];

wchar_t     *excels=excelsb;

wchar_t     oasysb[256];

wchar_t     *oasys=oasysb;

wchar_t     oasyssb[256];

wchar_t     *oasyss=oasyssb;

wchar_t     exb[1024];

wchar_t     *ex=exb;

wchar_t     ieb[1024];

wchar_t     *ie=ieb;

wchar_t     iesb[1024];

wchar_t     *ies=iesb;

wchar_t     pgb[1024];

wchar_t     *pg=pgb;

wchar_t     excpathb[1024];

wchar_t     excpath2b[1024];

wchar_t     excpath3b[1024];

wchar_t     excpath4b[1024];

wchar_t     excpath5b[1024];

wchar_t     excpath6b[1024];

wchar_t     excpath7b[1024];

wchar_t     excpath8b[1024];

wchar_t     excpath9b[1024];

wchar_t     excpath1b[1024];

wchar_t     *excpath=excpathb;

wchar_t     *excpath2=excpath2b;

wchar_t     *excpath3=excpath3b;

wchar_t     *excpath4=excpath4b;

wchar_t     *excpath5=excpath5b;

wchar_t     *excpath6=excpath6b;

wchar_t     *excpath7=excpath7b;

wchar_t     *excpath8=excpath8b;

wchar_t     *excpath9=excpath9b;

wchar_t     *excpath1=excpath1b;

wchar_t     pushdb[1024];

wchar_t     cdhist[50][1024];

wchar_t    cmdhist[50][1024];

wchar_t    xcopysb[2][1024];

wchar_t         usrpcb[30];

wchar_t         dirb[5000][1024];

wchar_t        cdirb[5000];

wchar_t      tmcdirb[5000];

wchar_t         uncb[5000];

wchar_t        guncb[5000];

wchar_t         prgdir[1024];

wchar_t     trdirb[5000][245];

wchar_t     pathb[300][1024];  

wchar_t     *path=excpathb;

wchar_t     temb[1024];

wchar_t     *tem=temb;

wchar_t     urlb[300][256];

wchar_t     urlname[300][50];

wchar_t     urlhttp[300][260];

wchar_t     path0b[1024];

wchar_t     *path0bp=path0b;

 

wchar_t     extenvb[100][1024];

wchar_t    *extenvp[100];

wchar_t    arg[20][5000];

wchar_t    *argp[20];

wchar_t     bkcdirb[5000];

 

 

wchar_t      systemrootb[1024];

wchar_t     *systemroot=systemrootb;

wchar_t      systemdriveb[1024];

wchar_t     *systemdrive=systemdriveb;

wchar_t      homepathb[256];   

wchar_t     *homepath=homepathb;       

wchar_t      homedriveb[10];

wchar_t     *homedrive=homedriveb;

wchar_t      userdomainb[30];

wchar_t     *userdomain=userdomainb;

wchar_t      usernameb[30];

wchar_t     *username=usernameb;

wchar_t      logonserverb[30];

wchar_t     *logonserver=logonserverb;

wchar_t      userprofileb[256];

wchar_t     *userprofile=userprofileb;

wchar_t      programfilesb[256];

wchar_t     *programfiles=programfilesb;

wchar_t      mydocumentsb[256];

wchar_t     *mydocumentos=mydocumentsb;

wchar_t      favoritesb[256];

wchar_t     *favorites=favoritesb;

 

int        debug=1;      //  DEBUG 1 / NO DEBUG 0

 

int          osno=0;

int        dirtop=0;

int       filetop=0;

int         inino=0;

int      _unicode=0;

int        _cdirf=0;

int       _usrpcf=0;

int      _kannjif=0;

int        cdrive=0;

int       _fnamef=0;

int     _cmdmodef=0;

int      cdhistno=0;

int     cmdhistno=0;

int     _dirfilef=0;

int     _treef_endf=0;

int     _xcopyf[3];

int      _lineno;

int     _cmdendf=0;

int      _findsubno=1;

int      _exitf=0;

 

 

 

 

 

//int   tcps(char *,char *,char *);

//int   tcpc(char *,char *,char *);

//int   udps(char *,char *,char *);

//int   udpc(char *,char *,char *);

 

//int   tcpsx(char *,char *,char *);

//int   tcpcx(char *,char *,char *);

//int   udpsx(char *,char *,char *);

//int   udpcx(char *,char *,char *);

 

//int  remsystem(char  *);

//int   tcpcmdf(char *);

//int    nodot(char  *);

//int    oyadirf(char *);

//int    prgexit(int);

//int    prgclose(int);

//int     buf0(char *,int);

//int     dots(char  *);

//int    tcpmain(void);

 

 

 

 

char      cdir[256];

char    remdir[256];

char    prgname[256];

char    uncdirb[256];

 

 

wchar_t    *env[]={

                  L"envhelp=help",

          L"envset=set",

                  L"",

                  NULL

          };

 

wchar_t   pathdirb[50][256];

 

 

 

 

void     calprn(char *,short);               ///cale

int      dotwll(short);

void      calset(short,short,char *,short);

void     cal12(char  *,short);

void     cal(char  *,short,short);

void     calef(void);

char   syuu[]={" Su Mo Tu We Th Fr Sa"};

char   *tukimei[]={"","January","February","March","April","May","June",

           "July","August","September","October","November","December","err"};

 

int       calcf(wchar_t *);                     ///  calc

long     double     mathf(char  *);

long     double     nextf(char  *);

long double  r[40];

 

 

 

 

 

int       aaaa(void)

{

 

        wprintf(L"aaaa() ");

                return(1);

}

 

extern int excmain(int argc, wchar_t **argv,wchar_t **envp)

{

       

       

        cdrive= _getdrive(); _wgetdcwd(cdrive,prgdir,1000);

       

        wprintf(L"prgdir=%s\n",prgdir);

        if(prgdir[1]==L':')

        {

        prgdrive[0]=prgdir[0];prgdrive[1]=L':';prgdrive[2]=L'\0';

        }

        if(cmdfmain(argc,argv,envp)==1)  return(1);

        return 0;

}

 

int   osf(void)

{

         wchar_t    tm[256];

         wchar_t    bf[2][256];

         int     i;

     FILE    *kakikomi,*yomidasi;

    

     for(i=0;i<256;++i) bf[0][i]=L'\0';

 

         

         swprintf(tm,L"ver > %s\\excdir\\ver.txt",temp);_wsystem(tm);

 

     swprintf(tm,L"%s\\excdir\\null.txt",temp);

     if((kakikomi=_wfopen(tm,L"w"))==NULL)

         {wprintf(L"Err! osf() _wfopen() ----->> Err file %s!\n",tm);}

         else

         {

                 bf[0][0]=L' ';bf[0][1]=L' ';bf[0][2]=L'\0';

                 if(fputws(bf[0],kakikomi)==NULL)

                                 ;

             else

                                 fclose(kakikomi);

                 

         }

    

         

         

         

         swprintf(tm,L"%s\\excdir\\ver.txt",temp);

         if((yomidasi=_wfopen(tm,L"r"))==NULL)

         {wprintf(L"Err! osf() _wfopen() ----->> No file %s!\n",tm);goto ESTA;}

         else

         {

                 for(i=0;i<2;++i)

                 {

                         if(fgetws(bf[i],256,yomidasi)==NULL)

                                 break;

                         else

                                 wprintf(L"%s",bf[i]);

                 }

         }

     fclose(yomidasi);

     

         wcscpy(tm,&bf[1][0]);

         for(i=0;i<256;++i)

         {

         if(tm[i]==L'[') {osb[i]=L'\0';break;}

                 else osb[i]=tm[i];

                 if(tm[i]<L' ')  {osb[i]=L'\0';break;}

         }

              if(wcsncmp(osb,WXP,20)==0)     {osno=1;dirtop=21;filetop=36;}

     else if(wcsncmp(osb,W20,20)==0)     {osno=2;dirtop=24;filetop=39;}

         else if(wcsncmp(osb,WNT,20)==0)     {osno=3;dirtop=21;filetop=36;}

         else if(wcsncmp(osb,WMe,20)==0)     {osno=4;dirtop=21;filetop=36;}

     else if(wcsncmp(osb,WME,20)==0)     {osno=4;dirtop=21;filetop=36;}

     else if(wcsncmp(osb,W98,20)==0)     {osno=5;dirtop=21;filetop=36;}

     else if(wcsncmp(osb,W95,20)==0)     {osno=6;dirtop=21;filetop=36;}

     else                                {osno=1;dirtop=21;filetop=36;}

 

 

 

         wprintf(L"os=%s  osno=%d dirtop=%d filetop=%d\n",os,osno,dirtop,filetop);

 

 

     return(0);

 

ESTA:     osno=1;dirtop=21;filetop=36; 

         return(0);

}

 

int  inif(void)

{

        wchar_t    tm[1024];

   

 

 

 

 

          osno=0;

        dirtop=0;

       filetop=0;

      _unicode=0;

        _cdirf=0;

       _usrpcf=0;

      _kannjif=0;

        cdrive=0;

       _fnamef=0;

     _cmdmodef=0;

   _treef_endf=0;

 

 

    setlocale(LC_ALL,"Japanese");

        logonserver=_wgetenv(L"LOGONSERVER");_wcslwr(logonserver);

    if((temp=_wgetenv(L"TEMP"))==NULL)

                if((temp=_wgetenv(L"TMP"))==NULL)

                        swprintf(temp,L"%s\\temp",homepath);

 

       

        if((systemroot=_wgetenv(L"SystemRoot"))==NULL)

                systemroot=_wgetenv(L"windir");

   

        wcscpy(cdhist[40],systemroot);

    pg=_wgetenv(L"ProgramFiles");

        if((systemdrive=_wgetenv(L"SystemDrive"))==NULL)

                if((systemdrive=_wgetenv(L"HOMEDRIVE"))==NULL)

                        wcscpy(systemdrive,L"C:");

    if((homedrive=_wgetenv(L"HOMEDRIVE"))==NULL)

                        wcscpy(homedrive,L"C:");

    if((homepath=_wgetenv(L"HOMEPATH"))==NULL)

                        wcscpy(homepath,L"C:\\");

      

 

        userdomain=_wgetenv(L"USERDOMAIN");

        username=_wgetenv(L"USERNAME");

        userprofile=_wgetenv(L"USERPROFILE");

        logonserver=_wgetenv(L"LOGONSERVER");

    if((programfiles=_wgetenv(L"ProgramFiles"))==NULL)

                swprintf(programfilesb,L"%s\\Program Files",systemdrive);

 

    swprintf(mydocumentsb,L"%s\\My Documents",userprofile);

        //swprintf(temp,L"%s\\temp",prgdrive);  // debg 

   

        wcscpy(cdhist[41],temp);

    wcscpy(cdhist[42],pg);

    swprintf(cdhist[43],L"%s\\Documents and Settings",systemdrive);

 

 

        wcscpy(cdhist[44],home);

        wcscpy(cdhist[45],systemroot);

        swprintf(cdhist[46],L"%s\\system32",systemroot);

 

 

        path=_wgetenv(L"PATH");

    path0bp=_wgetenv(L"PATH");

 

    if((excpath=_wgetenv(L"excpath"))==NULL)

        {

                swprintf(excpathb,L"excpath=\\;%s;%s\\system32;%s;%s\\excdir;%s\\excdir\\batcmd;c:\\;%s\\;",systemroot,systemroot,temp,temp,temp,systemdrive);

                _wputenv(excpathb);

        }

 

    if((excpath2=_wgetenv(L"excpath2"))==NULL)

        {

                swprintf(excpath2b,L"excpath2=%s;%s;%s\\My Music;%s\\My Pictures;%s\\My Videos",userprofile,mydocumentsb,mydocumentsb,mydocumentsb,mydocumentsb);

                _wputenv(excpath2b);

        }

 

        if((excpath3=_wgetenv(L"excpath3"))==NULL)

        {

                swprintf(excpath3b,L"excpath3=c:\\;d:\\;e:\\;f:\\;%s\\r\\u\\jpg;%s;%s\\system32;%s\\temp;%s\\b;%s\\temp\\excdir;c:\\;%s\\;",systemdrive,systemroot,systemroot,systemdrive,systemdrive,systemdrive,systemdrive);

                _wputenv(excpath3b);

        }

    if((excpath1=_wgetenv(L"excpath1"))==NULL)

        {

                swprintf(excpath1b,L"excpath1=%s\\r\\u\\jpg;%s;%s\\system32;%s\\temp;%s\\b;%s\\temp\\excdir;c:\\;%s\\;",systemdrive,systemroot,systemroot,systemdrive,systemdrive,systemdrive,systemdrive);

                _wputenv(excpath1b);

        }

    if((excpath4=_wgetenv(L"excpath4"))==NULL)

        {

                swprintf(excpath4b,L"excpath4=%s\\r\\u\\jpg;%s;%s\\system32;%s\\temp;%s\\b;%s\\temp\\excdir;c:\\;%s\\;",systemdrive,systemroot,systemroot,systemdrive,systemdrive,systemdrive,systemdrive);

                _wputenv(excpath4b);

        }

    if((excpath5=_wgetenv(L"excpath5"))==NULL)

        {

                swprintf(excpath5b,L"excpath5=%s\\r\\u\\jpg;%s;%s\\system32;%s\\temp;%s\\b;%s\\temp\\excdir;c:\\;%s\\;",systemdrive,systemroot,systemroot,systemdrive,systemdrive,systemdrive,systemdrive);

                _wputenv(excpath5b);

        }

    if((excpath6=_wgetenv(L"excpath6"))==NULL)

        {

                swprintf(excpath6b,L"excpath6=%s\\r\\u\\jpg;%s;%s\\system32;%s\\temp;%s\\b;%s\\temp\\excdir;c:\\;%s\\;",systemdrive,systemroot,systemroot,systemdrive,systemdrive,systemdrive,systemdrive);

                _wputenv(excpath6b);

        }

    if((excpath7=_wgetenv(L"excpath7"))==NULL)

        {

                swprintf(excpath7b,L"excpath7=%s\\r\\u\\jpg;%s;%s\\system32;%s\\temp;%s\\b;%s\\temp\\excdir;c:\\;%s\\;",systemdrive,systemroot,systemroot,systemdrive,systemdrive,systemdrive,systemdrive);

                _wputenv(excpath7b);

        }

    if((excpath8=_wgetenv(L"excpath8"))==NULL)

        {

                swprintf(excpath8b,L"excpath8=%s\\r\\u\\jpg;%s;%s\\system32;%s\\temp;%s\\b;%s\\temp\\excdir;c:\\;%s\\;",systemdrive,systemroot,systemroot,systemdrive,systemdrive,systemdrive,systemdrive);

                _wputenv(excpath8b);

        }

    if((excpath9=_wgetenv(L"excpath9"))==NULL)

        {

                swprintf(excpath9b,L"excpath9=%s\\r\\u\\jpg;%s;%s\\system32;%s\\temp;%s\\b;%s\\temp\\excdir;c:\\;%s\\;",systemdrive,systemroot,systemroot,systemdrive,systemdrive,systemdrive,systemdrive);

                _wputenv(excpath9b);

        }

 

 

 

 

        _unicode=1;     wprintf(L"_UNICODE");

 

        _wchdir(systemroot);

    cdrive=_getdrive();

 

    if(_wgetdcwd(cdrive,cdirb,_MAX_DIR)==NULL) {wprintf(L"Err! init() _wgetcwd() cdir==NULL");}

       

        if((cdirb[0]==L'\\') && (cdirb[1]==L'\\') && (cdirb[2]>L' '))

             {wcscpy(uncb,cdirb);uncdir(uncb,cdirb);}

        else   dirunc(cdirb,uncb);

        pcname(cdirb,usrpcb);

    if(_usrpcf==1) wcscpy(guncb,uncb);

 

        if(inino==0)

        {

                wcscpy(pushdb,cdirb);wcscpy(cdhist[cdhistno++],cdirb);

                swprintf(note, L"%s\\%s",systemroot,NOTE);

        swprintf(ex  , L"%s\\%s",systemroot,EX);

        swprintf(word, L"%s%s",systemdrive,XPMWORD);

        swprintf(words, L"\"%s%s\"",systemdrive,XPMWORD);

        swprintf(excel,L"%s%s",systemdrive,XPEXCEL);

                swprintf(excels,L"\"%s%s\"",systemdrive,XPEXCEL);

        swprintf(oasys,L"%s%s",systemdrive,OASYS);

                swprintf(oasyss,L"\"%s%s\"",systemdrive,OASYS);

                swprintf(outlook,L"%s%s",systemdrive,OUTLOOK);

        swprintf(outlook2,L"%s%s",systemdrive,OUTLOOKEX);

        swprintf(outlooks,L"\"%s\"",outlook);

                swprintf(outlook2s,L"\"%s\"",outlook2);

                swprintf(ie,   L"%s%s",systemdrive,IE);  /////////////////////////////////////////

        swprintf(ies,   L"\"%s\"",ie);

 

 

 

 

 

 

    //    _wmkdir(temp);         

                swprintf(tm,L"%s\\excdir",temp);

            _wmkdir(tm);

                if(_doserrno==2) {wprintf(L"Err! osf() _wmkdir() ----->> No path %s!\n",tm);}

       

       swprintf(tm,L"%s\\excdir\\batcmd",temp);

            _wmkdir(tm);

                if(_doserrno==2) {wprintf(L"Err! osf() _wmkdir() ----->> No path %s!\n",tm);}

          

        swprintf(tm,L"%s\\excdir\\sysexc",temp);

            _wmkdir(tm);

                if(_doserrno==2) {wprintf(L"Err! osf() _wmkdir() ----->> No path %s!\n",tm);}

       

   //           swprintf(tm,L"%s\\excdir\\null.txt",temp);

   //     if((kakikomi=_wfopen(tm,L"w"))==NULL)

   //         wprintf(L"Err! inif() _wfopen() No file! %s \n",tm);

//          else fputws(nullc,kakikomi);

//          fclose(kakikomi);

 

 

 

        

        }

        else

        {wcscpy(cdirb,home);cdf(systemroot);

        }

    ++inino;if(inino>30000) inino=9;

   

       

    osf();

 

        envf(1);

 

        batcmdf();

 

        sysexcf();

 

 

        return(0);

 

 

}

 

int     sysexcf(void)

{

     wchar_t   tm[1024];

 

         swprintf(tm,L"set  > %s\\excdir\\sysexc\\setexc.exc",temp);

         _wsystem(tm);

 

     swprintf(tm,L"help > %s\\excdir\\sysexc\\helpexc.exc",temp);

         _wsystem(tm);

 

      swprintf(tm,L"assoc  > %s\\excdir\\sysexc\\assocexc.exc",temp);

         _wsystem(tm);

 

          swprintf(tm,L"ftype  > %s\\excdir\\sysexc\\ftypeexc.exc",temp);

         _wsystem(tm);

 

     return(0);

}

 

int    batrunf(wchar_t  *cmdb)

{

    wchar_t  tm[1024];

  //  wchar_t  tm2[1024];

//      wchar_t  tm3[1024];

 

 

    if(wcscmp(cmdb,L"$dir")==0)

        {

          swprintf(tm,L"dir  %s\\excdir\\batcmd",temp);

                  _wsystem(tm); return(0);

        }

    if(wcscmp(cmdb,L"$DIR")==0)

        {

          swprintf(tm,L"dir  %s\\excdir\\batcmd",temp);

                  _wsystem(tm); return(0);

        }

   

        if(wcsncmp(cmdb,L"$type ",6)==0)

        {

          swprintf(tm,L"type  %s\\excdir\\batcmd\\%s",temp,&cmdb[6]);

                  _wsystem(tm); return(0);

        }

    if(wcsncmp(cmdb,L"$TYPE ",6)==0)

        {

          swprintf(tm,L"type  %s\\excdir\\batcmd\\%s",temp,&cmdb[6]);

                  _wsystem(tm); return(0);

        }

 

       

        swprintf(tm,L"%s\\excdir\\batcmd\\%s",temp,cmdb);

        _wsystem(tm);

 

        return(0);

}

 

int    holderf(wchar_t *cmdb)

{

     wchar_t   tm[1024];

       wchar_t   *tmp=tm;

 

 

       cdrive= _getdrive(); _wgetdcwd(cdrive,cdirb,1000);

           if(wcscmp(cmdb,L"&pwd")==0 || wcscmp(cmdb,L"&PWD")==0)  

           {

                   swprintf(tm,L"%s",tm);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&cwd")==0 || wcscmp(cmdb,L"&CWD")==0)  

           {

                   swprintf(tm,L"%s",tm);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&home")==0 || wcscmp(cmdb,L"&HOME")==0)  

           {

                   swprintf(tm,L"%s\\excdir",temp);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&batcmd")==0 || wcscmp(cmdb,L"&BATCMD")==0)  

           {

                   swprintf(tm,L"%s\\excdir\\batcmd",temp);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&temp")==0 || wcscmp(cmdb,L"&TEMP")==0)  

           {

                   swprintf(tm,L"%s",temp);

           dirf(tm); return(0);

           }

           else if(wcscmp(cmdb,L"&excdir")==0 || wcscmp(cmdb,L"&EXCDIR")==0)  

           {

                   swprintf(tm,L"%s\\excdir",temp);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&systemroot")==0 || wcscmp(cmdb,L"&SYSTEMROOT")==0)  

           {

                   swprintf(tm,L"%s",systemroot);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&system32")==0 || wcscmp(cmdb,L"&SYSTEM32")==0)  

           {

                   swprintf(tm,L"%s\\system32",systemroot);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&exc")==0 || wcscmp(cmdb,L"&EXC")==0)  

           {

                   swprintf(tm,L"%s",prgdir);

           dirf(tm); return(0);

           }  

       else if(wcscmp(cmdb,L"&usr")==0 || wcscmp(cmdb,L"&USR")==0)  

           {

                   swprintf(tm,L"%s",userprofile);

           dirf(tm); return(0);

           }

           else if(wcscmp(cmdb,L"&user")==0 || wcscmp(cmdb,L"&USER")==0)  

           {

                   swprintf(tm,L"%s",userprofile);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&myd")==0 || wcscmp(cmdb,L"&MYD")==0)  

           {

                   swprintf(tm,L"%s\\My Documents",userprofile);

           dirf(tm); return(0);

           }

           else if(wcscmp(cmdb,L"&music")==0 || wcscmp(cmdb,L"&MUSIC")==0)  

           {

                   swprintf(tm,L"%s\\My Documents\\My Music",userprofile);

           dirf(tm); return(0);

           }

                 else if(wcscmp(cmdb,L"&pictures")==0 || wcscmp(cmdb,L"&PICTURES")==0)  

           {

                   swprintf(tm,L"%s\\My Documents\\My Pictures",userprofile);

           dirf(tm); return(0);

           }

            else if(wcscmp(cmdb,L"&videos")==0 || wcscmp(cmdb,L"&VIDEOS")==0)  

           {

                   swprintf(tm,L"%s\\My Documents\\My Videos",userprofile);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&fav")==0 || wcscmp(cmdb,L"&FAB")==0)  

           {

                   swprintf(tm,L"%s\\Favorites",userprofile);

           dirf(tm); return(0);

           }

           else if(wcscmp(cmdb,L"&pgf")==0 || wcscmp(cmdb,L"&PGF")==0)  

           {

                   swprintf(tm,L"%s",programfiles);

           dirf(tm); return(0);

           }

       else if(wcscmp(cmdb,L"&dtop")==0 || wcscmp(cmdb,L"&DTOP")==0)  

           {

                   swprintf(tm,L"%s\\デスクトップ",userprofile);

           xdirf(0,tm); return(0);

           }

       else if(wcscmp(cmdb,L"&smenu")==0 || wcscmp(cmdb,L"&SMENU")==0)  

           {

                   swprintf(tm,L"%s\\スタート メニュー",userprofile);

           xdirf(0,tm); return(0);

           }

       else if(wcscmp(cmdb,L"&sprg")==0 || wcscmp(cmdb,L"&SPRG")==0)  

           {

                   swprintf(tm,L"%s\\スタート メニュー\\プログラム",userprofile);

                   xdirf(0,tm); return(0);

           }

           else if(wcscmp(cmdb,L"&akusesari")==0 || wcscmp(cmdb,L"&AKUSESARI")==0)  

           {

                   swprintf(tm,L"%s\\スタート メニュー\\プログラム\\アクセサリ",userprofile);

                   xdirf(0,tm); return(0);}

           else if(wcscmp(cmdb,L"&startup")==0 || wcscmp(cmdb,L"&STARTUP")==0)  

           {

                   swprintf(tm,L"%s\\スタート メニュー\\プログラム\\スタートアップ",userprofile);

           xdirf(0,tm); return(0);

           }

 

        return(0);

}

 

int    batcmdf(void)

{

    

     

      assocf(L".htm");

          assocf(L".txt");

          assocf(L".jpg");

          assocf(L".oas");

      assocf(L".xls");

          assocf(L".doc");

          assocf(L".msg");

          assocf(L".nws");

//        assocf(L".cpp");

      assocf(L".eml");

      assocf(L".gif");

          assocf(L".wmv");

          assocf(L".wma");

      assocf(L".url");

      assocf(L".wsf");

          assocf(L".wsh");

      assocf(L".vbs");

 

      return(0);

}

 

int   assocf(wchar_t  *cmdb)

{

     wchar_t temb[1024];

     wchar_t temb2[1024];

     int    i;

 

         FILE    *yomikomi;

 

 

         if(cmdb[0]!=L'.') return(0);

 

         swprintf(temb,L"assoc %s > %s\\excdir\\assoctxt.txt",cmdb,temp);

     _wsystem(temb);

         swprintf(temb,L"%s\\excdir\\assoctxt.txt",temp);

     if((yomikomi=_wfopen(temb,L"r"))==NULL)

         {wprintf(L"Err! acossf() _wfopen() assoctxt.txt No file!  \n");return(0);}

         else {fgetws(temb,1000,yomikomi); fclose(yomikomi);}

      

          for(i=0;i<1000;i++)

          {

                  if(temb[i]<L' ') {temb[i]=L'\0';break;}

                  if(temb[i]==L'=')

                  {

                          wcscpy(temb2,&temb[i+1]);break;

                  }

          }

          if(wcscmp(temb2,L"")==0) return(0);

          wprintf(L"%s=%s\n",cmdb,temb2);

 

        if((temb2[0]>'0') && (temb2[1]>'0'))

        ftypef2(cmdb,temb2);

       

 

        return(0);

}

 

int   ftypef2(wchar_t *cmdb,wchar_t *ftype)

{

     wchar_t temb[1024];

     wchar_t temb2[1024];

         wchar_t temb3[1024];

 

 

     int    i;

 

         FILE    *yomikomi,*kakikomi;

 

 

 

 

 

          if(cmdb[0]!=L'.') return(0);

 

      if((ftype[0]<'0') && (ftype[1]<'0')) return(0);

         enn(ftype);

 

 

         swprintf(temb,L"ftype %s > %s\\excdir\\ftype2.txt",ftype,temp);

     _wsystem(temb);

         swprintf(temb,L"%s\\excdir\\ftype2.txt",temp);

     if((yomikomi=_wfopen(temb,L"r"))==NULL)

         { wprintf(L"Err! ftypef2() _wfopen() %s No file!  \n",temb);return(0);}

           else

           {

                   fgetws(temb,1000,yomikomi);

               fclose(yomikomi);

           }

 

          for(i=0;i<1000;i++)

          {

                  if(temb[i]<L' ') {temb[i]=L'\0';temb2[i]=L'\0';break;}

                  if(temb[i]==L'=')

                  {

                          wcscpy(temb2,&temb[i+1]);break;

                  }

          }

          wprintf(L"%s=%s\n",ftype,temb2);

 

          if((temb2[0]<L'0') && (temb2[0]<L'0')) return(0);

      swprintf(temb3,L"%s\\excdir\\batcmd\\$%s.cmd",temp,&cmdb[1]);

      if((kakikomi=_wfopen(temb3,L"w"))==NULL)

          {wprintf(L"Err! ftypef2() _wfopen() %s Err file!  \n",temb3);return(0);}

           else

           {

                   fputws(temb2,kakikomi);

               fclose(kakikomi);

           }

 

 

 

        return(0);

}

 

 

int    saigennf(int   cmdf,wchar_t *cmdb)

{

       wchar_t   tm0[5000],tm1[5000],tm2[5000],tm3[5000];

 

           FILE     *kakikomi,*yomikomi;

      

           swprintf(tm0,L"%s\\excdir\\batcmd\\$saigenn.cmd",temp);

           swprintf(tm1,L"type %s",tm0);

       swprintf(tm2,L"%s\\excdir\\$saigenn.exc",temp);

       swprintf(tm3,L"type %s",tm0);

 

 

 

       if(cmdf==0)

           {

       if((kakikomi=_wfopen(tm0,L"w"))==NULL)

            wprintf(L"Err! saigenn() _wfopen() No file! %s \n",tm0);

           else fputws(cmdb,kakikomi);

           fclose(kakikomi);

           _wsystem(cmdb);

           }

           if(cmdf==1)

           {

       if((kakikomi=_wfopen(tm0,L"w"))==NULL)

            wprintf(L"Err! saigenn() _wfopen() No file! %s \n",tm2);

           else fputws(&cmdb[4],kakikomi);

           fclose(kakikomi);

           }  

           else if(cmdf==2)

           {

                   if((yomikomi=_wfopen(tm0,L"r"))==NULL)

            wprintf(L"Err! saigenn() _wfopen() No file! %s \n",tm0);

           else fgetws(cmdb,5000,yomikomi);

           fclose(yomikomi);

            _wsystem(tm0);

           }

       else if(cmdf==3)

           {

                   if((yomikomi=_wfopen(tm0,L"r"))==NULL)

            wprintf(L"Err! saigenn() _wfopen() No file! %s \n",tm2);

           else fgetws(cmdb,5000,yomikomi);

           fclose(yomikomi);

         

           }

       else if(cmdf==4)

           {

                    _wsystem(tm0);

           }

           else if(cmdf==5)

           {

            _wsystem(tm1);

           }

       else if(cmdf==6)

           {

            _wsystem(tm2);

           }

       else if(cmdf>=7)

           {

            _wsystem(tm3);

           }

      

 

      return(0);

}

 

 

int    nospacef(wchar_t    *cmdb)

{

       int    s,d;

       wchar_t   tmpb[5000];

 

 

           if(cmdb[0]<L' ') return(0);

 

           while(1)

           {

                   if(cmdb[0]<L' ') break;

                   if(cmdb[0]==L' ') {wcscpy(cmdb,&cmdb[1]);continue;}

                   else  break;

           }

 

           for(d=0,s=0;s<5000;)

           {

                   if(cmdb[s]<L' ')  {tmpb[d]=cmdb[s];break;}

                   else if((cmdb[s]==L' ') && (cmdb[s+1]==L' ')) {++s;continue;}

           else  {tmpb[d]=cmdb[s];++d;++s;}

 

           }

           if(tmpb[0]==L' ') wcscpy(cmdb,&tmpb[1]);else wcscpy(cmdb,tmpb);

 

           return(0);

}

 

int   chdrive(wchar_t *cmdb)

{

       int   drive;

       wchar_t   a;

 

           if(_usrpcf==1) return(0);

           if(cmdb[0]<L' ') return(0);

 

       a=towlower(cmdb[0]);drive=a-L'a'+1;

           _chdrive(drive);

       _wgetdcwd(drive,cdirb,_MAX_DIR);

           if((cdirb[0]==L'\\') && (cdirb[1]==L'\\') && (cmdb[2]>L' '))

                {wcscpy(uncb,cdirb);uncdir(uncb,cdirb);}

           else dirunc(cdirb,uncb);

 

 

       return(0);

}

 

int   pcname(wchar_t *cmdb,wchar_t *usrpcb)

{

     int    i,j;

     wchar_t  tm[5000];

 

         if((cmdb[0]!=L'\\') || (cmdb[1]!=L'\\')  || (cmdb[2]<L' '))

         {

                 wcscpy(usrpcb,logonserver);_usrpcf=0;

         return(0);

         }

         tm[0]=L'\\';tm[1]=L'\\';

         for(i=2,j=2;i<5000;++i)

         {

          if( cmdb[i]==L'\\' || cmdb[i]<L' ')

                  {

                          tm[j]=L'\0';break;

                  }

                  else tm[j++]=cmdb[i];

         }

     _wcslwr(tm);wcscpy(usrpcb,tm);

         if(wcsicmp(usrpcb,logonserver)==0) _usrpcf=0; else  _usrpcf=1;

 

     return(0);

}

 

int   cdtest(wchar_t *cmdb)

{

 

      if(_wchdir(cmdb)==(-1)) wprintf(L"cdtest() cdir _wchdir err!  cdirb=%s\r\n\0",cmdb);

          cdrive=_getdrive();

      if(_wgetdcwd(cdrive,cdirb,_MAX_DIR)==NULL)

                  {wprintf(L"Err! cdf() _wgetcwd()----->> cdirb=%s\n",cdirb );return(1);}

          else wprintf(L"cdir=%s\n",cdirb);

          if((cdirb[0]==L'\\') && (cdirb[1]==L'\\') && (cdirb[2]>L' '))

          { wcscpy(uncb,cdirb);uncdir(uncb,cdirb);}

          else

                  dirunc(cdirb,uncb);

      return(0);

 

}

 

wchar_t    *cwdf(void)

{

     cdrive=_getdrive();

        if(_wgetdcwd(cdrive,cdirb,_MAX_DIR)==NULL)

             {wprintf(L"Err! cwdf()  _getdcwd() cdirb=%s err!",cdirb);}

        return(cdirb);

}

 

int   pwdf(void)

{

     

    cdrive=_getdrive();

        if(_wgetdcwd(cdrive,cdirb,_MAX_DIR)==NULL)

             {wprintf(L"Err! pwdf()  _getdcwd() cdirb=%s err!",cdirb);}

        wcscpy(tmcdirb,cdirb);

    nospacef(cdirb);

        wprintf(L"pwd=%s uncb=%s  guncb=%s\n",cdirb,uncb,guncb);

 

 

 

 

    return(0);

}

 

extern   int   cdf(wchar_t  *cmdb)

{

 

        int  i;

 

        for(i=0;i<5000;i++)

        {

                if(cmdb[i]<' ') {cmdb[i]=L'\0';break;}

                else if(cmdb[i]==L'\"') wcscpy(&cmdb[i],&cmdb[i+1]);

        }

 

 

 

 

        if(cmdb[0]<L' ')

        {

                cdrive=_getdrive();

            if(_wgetdcwd(cdrive,cdirb,_MAX_DIR)==NULL)

                     {wprintf(L"Err! cdf() _wgetdcwd() -----> cdirb=%s\r\n",cdirb);}

        dirunc(cdirb,uncb);

            pcname(uncb,usrpcb);

                         

                if(_usrpcf==0)

        {

                 if((cdirb[0]==L'\\') && (cdirb[1]==L'\\') && (cdirb[2]>L' '))

                 {   

                                  wcscpy(uncb,cdirb);

                      uncdir(uncb,cdirb) ;

                 }

                 else   

                 {

                          dirunc(cdirb,uncb)  ;

                 }

 

             }

             if(_usrpcf==1)

                 wcscpy(guncb,cmdb);

         wprintf(L"\ncdirb=%s\ncuncb=%s\nguncb=%s\n",cdirb,uncb,guncb);return(0);

        }

 

    nospacef(cmdb);

    enn(cmdb);

 

 

        if((cmdb[0]==L'\\') && (cmdb[1]==L'\\') && (cmdb[2]>L' '))

        {

                wcscpy(uncb,cmdb);

                pcname(cmdb,usrpcb);

                if(_usrpcf==0)

                {

                        uncdir(uncb,cdirb);

                        if(_wchdir(cdirb)==(-1))

                        {

                                wprintf(L"Err! cdf() _wchdir err!  cdirb=%s\r\n\0",cdirb);

                        }

                }

                else if(_usrpcf==1)

                {

             wcscpy(guncb,cmdb);

                }

        }

    else

        {

                if(_wchdir(cmdb)==(-1))

                {

                        wprintf(L" Err! cdf() _wchdir() err! cmdb=%s \r\n\0",cmdb);

                        wcscpy(cdirb,cmdb);return(0);

                }

                else

                {

                         cdrive=_getdrive();

                 if(_wgetdcwd(cdrive,cdirb,_MAX_DIR)==NULL)

                           {wprintf(L"Err! cdf() _wgetdcwd() -----> cdirb=%s\r\n",cdirb);}

                     dirunc(cdirb,uncb);

 

                       

                        if(cdhistno>=39) cdhistno=1;

                         wcscpy(cdhist[cdhistno++],cdirb);

        }

    }

 

        return(0);

}

 

int   cdhistf(void)

{

        int    i;

        wchar_t  line[1024];

 

                for(i=0;i<50;++i)

                {

             wprintf(L"\n%02d %s",i,cdhist[i]);

                }

                wprintf(L"\nCD Dir No.= ? # "); _getws(line);    

        i=_wtoi(line);

                if(i<0) i=0;

                if(i>49) i=49;

                cdf(cdhist[i]);

 

                return(0);

}

 

int   cmdhistf(wchar_t *cmdb)

{

        int    i;

        wchar_t  line[1024];

 

                for(i=0;i<50;++i)

                {

             wprintf(L"\n%02d %s",i,cmdhist[i]);

                }

                wprintf(L"\nCMDHist No.= ? # "); _getws(line);    

        i=_wtoi(line);

                if(i<0) i=0;

                if(i>49) i=49;

                wcscpy(cmdb,cmdhist[i]);

                if(cmdb[0]<L' ') return(1);

 

                return(0);

}

 

int   uncdir(wchar_t *uncb,wchar_t *cdirb)

{

     int    i,j;

 

          if(uncb[0]<L' ') return(0);

          if((uncb[0]!=L'\\') && (uncb[1]!=L'\\') && (uncb[2]<L' ' ))

          {

                  return(0);

          }

 

          for(i=2,j=0;i<_MAX_DIR;++i)

          {

                  if(uncb[i]<L' ') break;

          else if(uncb[i]==L'$')

                  {

                          uncb[i]=L':';

                          wcscpy(cdirb,&uncb[i-1]);

              uncb[i]=L'$';

                         

                          break;

                  }

          else if(uncb[i]==L'\\')

                  {

                          ++j;

                          if(j>=2){

                                  cdirb[0]=uncb[i-1];

                                  cdirb[1]=L':';

                                  wcscpy(&cdirb[2],&uncb[i]);                    

                          break;

                          }

                  }

 

          }

     return(0);

}

 

int   dirunc(wchar_t *cdirb, wchar_t *uncb)

{

    wchar_t  tmcdirb[1024];

 

    cdrive=_getdrive();

        if(_wgetdcwd(cdrive,cdirb,_MAX_DIR)==NULL) {wprintf(L"dirrun() _getdcwd() cdir=%s\r\n",cdirb);}

       

    nospacef(cdirb);

    wcscpy(tmcdirb,cdirb);

    pcname(cdirb,usrpcb);

        if((cdirb[0]==L'\\') && (cdirb[1]==L'\\') && (cdirb[2]>L' '))

        {

                if(_usrpcf==1)          wcscpy(uncb,cdirb);

                else wcscpy(uncb,cdirb);

                return(0);

        }

 

        if(cdirb[0]<L' ')   {wprintf(L"Err! cdir=NULL  \r\n");}

    if(cdirb[0]<L'A' || cdirb[0]>L'z')  {wprintf(L"Err! dirunc() NO Drive \r\n");}

        if(cdirb[1]==L':')

              tmcdirb[1]=L'$';     

        else {wprintf(L"Err! No : \r\n");}

 

 

 

    wcscpy(uncb,usrpcb);wcscat(uncb,L"\\");wcscat(uncb,tmcdirb);

 

     return(0);

}

 

extern int    setf(wchar_t   *cmdb)

{

 

        int    i,wa=0;

 

        wchar_t    tmb0[5000];

       

    wcscpy(tmb0,cmdb);

 

        for(i=0,wa=0;i<5000;++i)

        {

          if(tmb0[i]==L'=') ++wa;

                  else if(tmb0[i]==L'\0') break;

                  else if(tmb0[i]<L' ') {tmb0[i]=L'\0';break;}

        }

 

        if(wa>=1) _wputenv(cmdb);

    if(wa==0) 

        {

                if(_wgetenv(tmb0)==NULL) wprintf(L"\n環境変数%sは存在登録されていません。",tmb0);

                else  wprintf(L"\n%s",_wgetenv(tmb0));

        }

    return(0);

}

 

int  cmdfmain(int argc, wchar_t **argv,wchar_t **envp)

{

           wchar_t    cmdb[5000];

    

    cdrive=_getdrive();

        if(_wgetdcwd(cdrive,home,_MAX_DIR)==NULL)

            {wprintf(L"Err! cmdfmain() _getcwd() home=%s \n",home);

                wcscpy(home,L"No Home!\n");}

    wprintf(L"home=%s\n",home);

 

    if((home[0]==L'\\') && (home[1]==L'\\') && (home[2]>L' '))

        wcscpy(uncb,home);

        else

                wcscpy(cdirb,home);

       

 

    if(inif()==1)  return(1);

 

        if(cmdf(cmdb)==1)  return(1);

       

        return 0;

}

 

wchar_t   *enn(wchar_t  *cmdb)

{

       int   i;

 

        // if(cmdb[0]<L' ') return(1);

 

     for(i=1;i<1020;++i)

         {

                 if(cmdb[i]<L' ')

                 {cmdb[i]=L'\0';cmdb[i+1]=L'\0';cmdb[i+2]=L'\0';break;}

         }

 

        return(cmdb);

}

 

int    dor(wchar_t  *cmdb)

{

       int   i;

 

         if(cmdb[0]<L' ') return(0);

         if((cmdb[0]==L'\\') && (cmdb[1]<L' ')) return(1);

     for(i=1;i<5000;++i)

         {

                 if(cmdb[i]<L' ') {cmdb[i]=L'\0';break;}

        

                 if((cmdb[i]==L'$') && (cmdb[i+1]==L'\\') && (cmdb[i+2]<L' ')) return(1);

         if((cmdb[i]==L':') && (cmdb[i+1]==L'\\') && (cmdb[i+2]<L' ')) return(1);

 

         }

 

        return(0);

}

 

int    norootf(wchar_t  *cmdb)

{

       int   i;

 

         if(cmdb[0]<L' ') return(0);

         if((cmdb[0]==L'\\') && (cmdb[1]<L' ')) {cmdb[0]=L'\0';return(0);}

     for(i=1;i<5000;++i)

         {

                 if(cmdb[i]<L' ') {cmdb[i]=L'\0';break;}

                 if((cmdb[i]==L'\\') && (cmdb[i+1]<L' ')) {cmdb[i]=L'\0';break;}

                 

         }

 

        return(0);

}

 

 

int   attribf(int    mode,wchar_t  *cmdb)

{

          int            i=0;

          int      fileend=0;

          int         bkno=7;

 

          int     afiletop=11;

 

          wchar_t     line[1024];

//        wchar_t     line2[1024];

      wchar_t     line3[1024];

      wchar_t     tmb[1024];

//        wchar_t     tmb1[1024];

      wchar_t     tmb2[1024];

         

          FILE     *yomikomi,*kakikomi;

 

       wcscpy(tmb,cmdb);

           if(wcscmp(cmdb,L"")==0)  wcscpy(cmdb,cdirb);

           if((cmdb[0]!=L'\\') &&  (cmdb[1]!=L':'))

                   swprintf(cmdb,L"%s\\%s",cdirb,tmb);

 

      enn(cmdb);

          cdf(cmdb);

        // _wchdir(cmdb);

 

    

      fnamechf(cmdb);enn(cmdb);

        swprintf(tmb,L"%s\\excdir\\attribtx.txt",temp);

         //pcname(cdirb,usrpcb);

    if(_kannjif==0)

        {

        wprintf(L"_kannji==0\n");

           if(_usrpcf==0)

           {

                  if(_fnamef==0)

                        if(mode==0)

                              swprintf(tmb2,L"attrib %s\\*.* > %s\\excdir\\attribtx.txt",cmdb,temp);

                        else if(mode==1)

                              swprintf(tmb2,L"attrib /s %s\\*.* > %s\\excdir\\attribtx.txt",cmdb,temp);

                   else if(_fnamef==1)

                if(mode==0)

                              swprintf(tmb2,L"attrib \"%s\\*.*\" > %s\\excdir\\attribtx.txt",cmdb,temp);

                        else if(mode==1)

                              swprintf(tmb2,L"attrib /s \"%s\\*.*\" > %s\\excdir\\attribtx.txt",cmdb,temp);

                 

           }

           else  if(_usrpcf==1)

           {

                  if(_fnamef==0)

                        swprintf(tmb2,L"dir /A: %s > %s\\excdir\\dir.txt",guncb,temp);

                  else if(_fnamef==1)

              swprintf(tmb2,L"dir /A: \"%s\" > %s\\excdir\\dir.txt",guncb,temp);

           }   

 

         _wsystem(tmb2);

        }

        if(_kannjif==11)

        {

          wprintf(L"_kannji==11\n");

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\attribtx.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\attribtx.txt",temp,temp);

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\attribkj.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\attribkj.txt",temp,temp);

       

          _wsystem(tmb2);

       swprintf(tmb2,L"type %s\\excdir\\attribtx.txt",temp);

      _wsystem(tmb2);

       swprintf(tmb2,L"type %s\\excdir\\attribkj.txt",temp);

      _wsystem(tmb2);

 

        }

 

         

         

      swprintf(tmb2,L"%s\\excdir\\attribno.txt",temp);

 

         

      if((yomikomi=_wfopen(tmb,L"r"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb);

         

      if((kakikomi=_wfopen(tmb2,L"w"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb2);

         

          for(i=1;i<5000;++i)

          {

                  if(fgetws(dirb[i],1024,yomikomi)==NULL) {fileend=i-1; break;}

          else

                  {

               swprintf(line,L"%04d %s",i,dirb[i]);

                           wprintf(L"%s",line);

                       fputws(line,kakikomi);

                  }

          }

 

          fclose(yomikomi);

          fclose(kakikomi);

 

          if(fileend>300)

          {

          swprintf(tmb,L"%s  \"%s\\excdir\\attribno.txt\"",note,temp);_wsystem(tmb);

 

          }

 

    while(1)

          {

          i=bkno;

                  pcname(cmdb,usrpcb);

      wprintf(L"\ncdir=%s\n",cdirb);

      if(_usrpcf==0)

              wprintf(L"cunc=%s\n",uncb);

      if(_usrpcf==1)

              wprintf(L"GUNC=%s\n",guncb);

      wprintf(L"DIR=%s\n",cmdb);

      wprintf(L"\n@ATTRIB/RUN Line No.= ? ");_getws(tmb);

 

          if(tmb[0]==L'@') return(0);

          if(tmb[0]<L' ')  return(0);

          if(tmb[0]==L'&') {_kannjif=11;wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'#') {_kannjif=0; wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'0') {attribf(0,cmdb);return(0);}

          if(tmb[0]==L'<'){--i;  goto ESTA;}

          if(tmb[0]==L'>'){++i;  goto ESTA;}

 

          if(tmb[0]<L'0' || tmb[0]>L'9')

          {

                 //swprintf(tmb1,L"%s\\%s",cmdb,tmb);

                  _wsystem(tmb);continue;

          }

          else

          {  i=_wtoi(tmb);bkno=i;_kannjif=0;}

 

 

ESTA:

         

          if(i<=0) return(0);

      wprintf(L"%s\n",dirb[i]);

 

        //  if(i<6) dirf(cmdb);

 

        //  if(i>(fileend-2)) return(0);

     

    

                //  wprintf(L"%s",&dirb[i][dirtop]);

                  wprintf(L"%s\n",&dirb[i][afiletop]);

          wcscpy(line,&dirb[i][afiletop]);//fnamechf(line2);

 

       

        if(_usrpcf==0)

                {

                 // if(dor(cmdb)==0)

           //    swprintf(line2,L"%s\\%s",cmdb,&dirb[i][filetop]);

        //  if(dor(cmdb)==1)

                          swprintf(line,L"%s",&dirb[i][afiletop]);

                }

        if(_usrpcf==1)

                {

                 // if(dor(guncb)==0)

          //     swprintf(line2,L"%s\\%s",guncb,&dirb[i][filetop]);

        //  if(dor(guncb)==1)

                          swprintf(line,L"%s",&dirb[i][afiletop]);

                }

 

//              if(_cdirf==0)

//              {

//                      wcscpy(line2,&dirb[i][filetop]);

//              }

           fnamechf(line);enn(line);

                if(_fnamef==1)

                swprintf(line3,L"\"%s\"",line);

                else if(_fnamef==0)

                        wcscpy(line3,line);

        //      if(dirb[i][afiletop]<L' ') return(0);

                if(_kannjif==11) 

                  {

                          kannji(line);

                  }

                else if(_kannjif==0)

                  {_wsystem(line);}           // line2);

       

 

          }

      return(0);

}

 

int   linedf(wchar_t  *tmb)

{

 

       if(wcsncmp(tmb,L"@ex ",4)==0)   {_lineno=_wtoi(&tmb[4]);_cmdmodef=10;return(1);}

 

 

 

 

 

       return(0);

}

 

int   linef(wchar_t   *tmb)

{

          //int   i;

 

              _lineno=0;_cmdmodef=0;

 

          if(wcsncmp(tmb,L"@type ",6)==0)         {_lineno=_wtoi(&tmb[6]);_cmdmodef=1 ;return(1);}

                  else if(wcsncmp(tmb,L"@TYPE ",6)==0)    {_lineno=_wtoi(&tmb[6]);_cmdmodef=1 ;return(1);}

                  else if(wcsncmp(tmb,L"@print ",7)==0)   {_lineno=_wtoi(&tmb[7]);_cmdmodef=2 ;return(1);}

                  else if(wcsncmp(tmb,L"@PRINT ",7)==0)   {_lineno=_wtoi(&tmb[7]);_cmdmodef=2 ;return(1);}

                  else if(wcsncmp(tmb,L"@attrib ",8)==0)  {_lineno=_wtoi(&tmb[8]);_cmdmodef=4 ;return(1);}

                  else if(wcsncmp(tmb,L"@ATTRIB ",8)==0)  {_lineno=_wtoi(&tmb[8]);_cmdmodef=4 ;return(1);}

                  else if(wcsncmp(tmb,L"@note ",6)==0)    {_lineno=_wtoi(&tmb[6]);_cmdmodef=8 ;return(1);}

                  else if(wcsncmp(tmb,L"@NOTE ",6)==0)    {_lineno=_wtoi(&tmb[6]);_cmdmodef=9 ;return(1);}

                  else if(wcsncmp(tmb,L"@ie ",4)==0)      {_lineno=_wtoi(&tmb[4]);_cmdmodef=16;return(1);}

                  else if(wcsncmp(tmb,L"@IE ",4)==0)      {_lineno=_wtoi(&tmb[4]);_cmdmodef=16;return(1);}

                  else if(wcsncmp(tmb,L"@spawn ",7)==0)   {_lineno=_wtoi(&tmb[7]);_cmdmodef=20;return(1);}

                        

 

 

    

       return(0);

}

 

int   dirf(wchar_t  *cmdb)

{

          int            i=0;

          int      fileend=0;

          int         bkno=7;

          wchar_t     line[1024];

          wchar_t     line2[1024];

      wchar_t     line3[1024];

      wchar_t     tmb[1024];

          wchar_t     tmb1[1024];

      wchar_t     tmb2[1024];

         

          FILE     *yomikomi,*kakikomi;

 

 

      if(_cmdendf!=0)  return(0);

      _cmdmodef=0;

 

       wcscpy(tmb,cmdb);

           if(wcscmp(cmdb,L"")==0)  wcscpy(cmdb,cdirb);

           if((cmdb[0]!=L'\\') &&  (cmdb[1]!=L':'))

                   swprintf(cmdb,L"%s\\%s",cdirb,tmb);

 

 

 

      enn(cmdb);cdf(cmdb);

        // _wchdir(cmdb);

   //   enn(cdirb);

    

      fnamechf(cmdb);enn(cmdb);

        swprintf(tmb,L"%s\\excdir\\dir.txt",temp);

         //pcname(cdirb,usrpcb);

    if(_kannjif==0)

        {

        wprintf(L"_kannji==0\n");

           if(_usrpcf==0)

           {

                  if(_fnamef==0)

                   //   swprintf(tmb2,L"dir /A: %s > \\excdir\\dir.txt",cmdb,systemdrive);

                   swprintf(tmb2,L"cmd.exe /C \"dir /A: %s\" > %s\\excdir\\dir.txt",cmdb,temp);

                  else if(_fnamef==1)

              swprintf(tmb2,L"dir /A: \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

           }

           else  if(_usrpcf==1)

           {

                  if(_fnamef==0)

                        swprintf(tmb2,L"dir /A: %s > %s\\excdir\\dir.txt",guncb,temp);

                  else if(_fnamef==1)

              swprintf(tmb2,L"dir /A: \"%s\" > %s\\excdir\\dir.txt",guncb,temp);

           }   

 

         _wsystem(tmb2);

        }

        if(_kannjif==11)

        {

          wprintf(L"_kannji==11\n");

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

       

          _wsystem(tmb2);

     //  swprintf(tmb2,L"type %s\\excdir\\dir.txt",temp);

     // _wsystem(tmb2);

     //  swprintf(tmb2,L"type %s\\excdir\\dirkj.txt",temp);

     // _wsystem(tmb2);

 

        }

 

         

         

      swprintf(tmb2,L"%s\\excdir\\dirno.txt",temp);

 

         

      if((yomikomi=_wfopen(tmb,L"r"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb);

         

      if((kakikomi=_wfopen(tmb2,L"w"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb2);

         

          for(i=1;i<5000;++i)

          {

                  if(fgetws(dirb[i],1024,yomikomi)==NULL) {fileend=i-1; break;}

          else

                  {

               swprintf(line,L"%04d %s",i,dirb[i]);

                           wprintf(L"%s",line);

                       fputws(line,kakikomi);

                  }

          }

 

          fclose(yomikomi);

          fclose(kakikomi);

 

          if(fileend>300)

          {

          swprintf(tmb,L"%s  %s\\excdir\\dirno.txt",note,temp);_wsystem(tmb);

 

          }

 

      while(1)

          {

                  if(_cmdendf!=0) return(0);

                  _cmdmodef=0;

          i=bkno;

                  pcname(cmdb,usrpcb);

      wprintf(L"\ncdir=%s\n",cdirb);

      if(_usrpcf==0)

              wprintf(L"cunc=%s\n",uncb);

      if(_usrpcf==1)

              wprintf(L"GUNC=%s\n",guncb);

      wprintf(L"DIR=%s\n",cmdb);

      wprintf(L"\n@DIR/RUN Line No.= ? ");_getws(tmb);

 

          if(tmb[0]==L'?') {dirf(cmdb);return(0);}

          if(tmb[0]==L' ') {dirf(cmdb);return(0);}

          if(tmb[0]<L' ')  return(0);

          if(tmb[0]==L'&') {_kannjif=11;wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'#') {_kannjif=0; wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'0') {dirf(cmdb);return(0);}

          if(tmb[0]==L'<'){--i;  goto ESTA;}

          if(tmb[0]==L'>'){++i;  goto ESTA;}

 

          if(tmb[0]==L'@')

          {

                       if(wcsncmp(tmb,L"@attrib /s ",11)==0)   {attribf(1,&tmb[11]);continue;}

                  else if( wcscmp(tmb,L"@attrib")==0)          {attribf(0,cmdb);continue;}

                  else if(wcsncmp(tmb,L"@ATTRIB /S ",11)==0)   {attribf(1,&tmb[11]);continue;}

        //        else if(wcsncmp(tmb,L"@attrib ",8)==0)       {attribf(0,&tmb[8]);continue;}

        //        else if(wcsncmp(tmb,L"@ATTRIB ",8)==0)       {attribf(0,&tmb[8]);continue;}

                  else if( wcscmp(tmb,L"@ATRRIB")==0)          {attribf(0,cmdb);continue;}

        //        else if(wcsncmp(tmb,L"@type ",6)==0)   {i=_wtoi(&tmb[6]);_cmdmodef=1;goto ESTA2;}

        //        else if(wcsncmp(tmb,L"@print ",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=2;goto ESTA2;}

        //        else if(wcsncmp(tmb,L"@attrib ",8)==0) {i=_wtoi(&tmb[8]);_cmdmodef=4;goto ESTA2;}

        //        else if(wcsncmp(tmb,L"@note ",6)==0)   {i=_wtoi(&tmb[6]);_cmdmodef=8;goto ESTA2;}

                  else if(wcsncmp(tmb,L"@xcopy$",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=1001;goto ESTA;}

                  else if(wcsncmp(tmb,L"@xcopy#",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=1002;goto ESTA;}

                  else if(wcsncmp(tmb,L"@dir ",5)==0)    {i=_wtoi(&tmb[5]);goto ESTA;}

                  else if(wcsicmp(tmb,L"@end")==0)       {_cmdendf=1;break;}

          else if(wcsicmp(tmb,L"@exit")==0)     

                  {   _cmdendf=1;_exitf=1;

                  wcscpy(bkcdirb,cdirb);          

                      break;

                  }

 

          if(linedf(tmb)>=1) {i=_lineno;printf("i=%d",i);goto ESTA2 ;}

                  if(linef(tmb)>=1)  {i=_lineno;printf("i=%d",i);goto ESTA2;}

 

                 

 

                  swprintf(tmb1,L"%s\\%s",cmdb,tmb);

                  _wsystem(tmb);continue;

          }

          else

          {  i=_wtoi(tmb);bkno=i;_kannjif=0;}

 

 

ESTA:

          wprintf(L"%s",dirb[i]);

          if(i<=0) return(0);

          if(i<6) dirf(cmdb);

 

          if(i>(fileend-2)) return(0);

     

      if(wcsncmp(&dirb[i][dirtop],L"<DIR>",5)==0)    // DIR

          {

                  _dirfilef=1;

                  if(_cmdmodef==1001) {_xcopyf[0]=1,_xcopyf[1]=1;}

          if(_cmdmodef==1002) _xcopyf[2]=1;

 

                  wprintf(&dirb[i][dirtop]);

               

                  wcscpy(line,&dirb[i][filetop]);

                       

                  fnamechf(line);

                  enn(line);

        //  norootf(cmdb);

                  if(_usrpcf==0)

                  {

                  if(dor(cmdb)==0)

                               swprintf(line2,L"%s\\%s",cmdb,line);

                      else if(dor(cmdb)==1)

                  swprintf(line2,L"%s%s",cmdb,line);

                  }

                  else if(_usrpcf==1)

                  {

              if(dor(guncb)==0)

                           swprintf(line2,L"%s\\%s",guncb,line);

                       else if(dor(guncb)==1)

                    swprintf(line2,L"%s%s",guncb,line);

                  }

 

 

          enn(line2);

                  wprintf(L"dirf() line2=%s\r\n",line2);

         fnamechf(line2);

         if(_kannjif==11)

                 {

                       swprintf(line3,L"dir \"%s\" > %s\\excdir\\dir.txt && type %s\\excdir\\dir.txt",line2,temp,temp);

                         //  swprintf(line3,L"dir %s > %s\\excdir\\dirkj.txt",line2,temp);

                           wprintf(L"dirf() kannji %s",line3);

                       kannji(line3);

                 }

                 else  if(_kannjif==0)

                 {

                         

                        ;// dirf(line2);

                 }     

 

 

                 if(_cmdmodef==1001) {wcscpy(xcopysb[0],line2);continue;}

                 if(_cmdmodef==1002) {wcscpy(xcopysb[1],line2);systemf(_cmdmodef,cmdb);continue;}

                 dirf(line2); cdf(cmdb);

                 

          }

          else // NO DIR

      {

                  _dirfilef=0;

                  if(_cmdmodef==1001) {_xcopyf[0]=1;_xcopyf[1]=0;}

          if(_cmdmodef==1002) _xcopyf[2]=0;

                  wprintf(L"%s",&dirb[i][dirtop]);

                  wprintf(L"%s",&dirb[i][filetop]);

ESTA2:    wcscpy(line,&dirb[i][filetop]);//fnamechf(line2);

 

       

        if(_usrpcf==0)

                {

                  if(dor(cmdb)==0)

               swprintf(line2,L"%s\\%s",cmdb,&dirb[i][filetop]);

          if(dor(cmdb)==1)

                          swprintf(line2,L"%s%s",cmdb,&dirb[i][filetop]);

                }

        if(_usrpcf==1)

                {

                  if(dor(guncb)==0)

               swprintf(line2,L"%s\\%s",guncb,&dirb[i][filetop]);

          if(dor(guncb)==1)

                          swprintf(line2,L"%s%s",guncb,&dirb[i][filetop]);

                }

 

       

        fnamechf(line2);enn(line2);

                if(_fnamef==1)

                swprintf(line3,L"\"%s\"",line2);

                else if(_fnamef==0)

                        wcscpy(line3,line2);

                if(line3[0]<L' ') return(0);

        enn(line3);

                if(_cmdmodef==1001) {wcscpy(xcopysb[0],line3);continue;}

        if(_cmdmodef==1002) {wcscpy(xcopysb[1],line3);}

 

 

                if(_kannjif==11) 

                  {

                          kannji(line3);

                  }

                else if(_kannjif==0)

                  {systemf(_cmdmodef,line3);}           // line2);

        }

          }//while  end

 

      return(0);

}

 

int   xdirf(int  xmode,wchar_t  *cmdb)

{

          int            i=0,j;

          int      fileend=0;

          int         bkno=7;

          int         purasu=0;

      int          xdirbf=0;

 

 

 

          wchar_t     line[1024];

          wchar_t     line2[1024];

      wchar_t     line3[1024];

      wchar_t     tmb[1024];

          wchar_t     tmb1[1024];

      wchar_t     tmb2[1024];

      wchar_t     xchar[10];

         

          FILE     *yomikomi,*kakikomi;

 

 

      if(_cmdendf!=0)  return(0);

 

 

       _cmdmodef=0;xdirbf=0;

 

       if(xmode==0) {wcscpy(xchar,L"C");purasu=0;}

       else if(xmode==1) {wcscpy(xchar,L"Q");purasu=23;}

       else if(xmode==2) {wcscpy(xchar,L"S");purasu=0; }

           else if(xmode==3) {wcscpy(xchar,L"X");purasu=13;}

       else if(xmode==4) {wcscpy(xchar,L"T:C");purasu=0;}

       else if(xmode==5) {wcscpy(xchar,L"T:A");purasu=0;}

       else if(xmode==6) {wcscpy(xchar,L"T:W");purasu=0;}

       else if(xmode==7) {wcscpy(xchar,L"B");purasu=-36;}    //filetop=36

 

 

            wcscpy(tmb,cmdb);

           if(wcscmp(cmdb,L"")==0)  wcscpy(cmdb,cdirb);

           if((cmdb[0]!=L'\\') &&  (cmdb[1]!=L':'))

                   swprintf(cmdb,L"%s\\%s",cdirb,tmb);

 

      enn(cmdb);cdf(cmdb);

        // _wchdir(cmdb);

   //   enn(cdirb);

    

      fnamechf(cmdb);enn(cmdb);

        swprintf(tmb,L"%s\\excdir\\dir.txt",temp);

         //pcname(cdirb,usrpcb);

    if(_kannjif==0)

        {

        wprintf(L"_kannji==0\n");

           if(_usrpcf==0)

           {

                  if(_fnamef==0)

                  {

                //        if(xmode==0)

                //        {

                //                purasu=0;

                           swprintf(tmb2,L"dir /A /%s %s > %s\\excdir\\dir.txt",xchar,cmdb,temp);

                   //       swprintf(tmb2,L"cmd.exe /C \"dir /A: %s\" > %s\\excdir\\dir.txt",cmdb,temp);

                ///       }

                //        else if(xmode==1)

                //        {

                //                purasu=23;

         //         swprintf(tmb2,L"dir /A /Q %s > %s\\excdir\\dir.txt",cmdb,temp);

                //        }

                //        else if(xmode==2)

                //        {

                //                 purasu=0;

                 //          swprintf(tmb2,L"dir /A /S %s > %s\\excdir\\dir.txt",cmdb,temp);

                //        }    

                //        else if(xmode==3)

                //        {

                //                 purasu=13;

                 //          swprintf(tmb2,L"dir /A /X %s > %s\\excdir\\dir.txt",cmdb,temp);

                //        }    

                  }

                  else if(_fnamef==1)

          {

        //      if(xmode==0)

                //        {

                //                purasu=0;

                           swprintf(tmb2,L"dir /A /%s \"%s\" > %s\\excdir\\dir.txt",xchar,cmdb,temp);

                   //       swprintf(tmb2,L"cmd.exe /C \"dir /A: %s\" > %s\\excdir\\dir.txt",cmdb,temp);

                //        }

                //        else if(xmode==1)

                //        {

                //                purasu=23;

         //         swprintf(tmb2,L"dir /A /Q \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

                //        }

                //        else if(xmode==2)

                //        {

                //                 purasu=0;

                 //          swprintf(tmb2,L"dir /A /S \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

                //        }    

                //        else if(xmode==3)

                //        {

                //                 purasu=13;

                //           swprintf(tmb2,L"dir /A /X \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

                //        }    

           

             // swprintf(tmb2,L"dir /A \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

          

                  }

           }

           else  if(_usrpcf==1)

           {

                  if(_fnamef==0)

                  {

                        //  if(xmode==0)

                        //  {

                         //       purasu=0;

                           swprintf(tmb2,L"dir /A /%s %s > %s\\excdir\\dir.txt",xchar,cmdb,temp);

                   //       swprintf(tmb2,L"cmd.exe /C \"dir /A: %s\" > %s\\excdir\\dir.txt",cmdb,temp);

                //        }

                //        else if(xmode==1)

                //        {

                //                purasu=23;

          //        swprintf(tmb2,L"dir /A /Q %s > %s\\excdir\\dir.txt",cmdb,temp);

                //        }

                //        else if(xmode==2)

                //        {

                //                 purasu=0;

                 //          swprintf(tmb2,L"dir /A /S %s > %s\\excdir\\dir.txt",cmdb,temp);

                //        }    

                //        else if(xmode==3)

                //        {

                //                 purasu=13;

                 //          swprintf(tmb2,L"dir /A /X %s > %s\\excdir\\dir.txt",cmdb,temp);

        //                }    

                      //  swprintf(tmb2,L"dir /A %s > %s\\excdir\\dir.txt",guncb,temp);

                  }

                  else if(_fnamef==1)

                  {

                //        if(xmode==0)

                //        {

                //                purasu=0;

                           swprintf(tmb2,L"dir /A /%s \"%s\" > %s\\excdir\\dir.txt",xchar,cmdb,temp);

                   //       swprintf(tmb2,L"cmd.exe /C \"dir /A: %s\" > %s\\excdir\\dir.txt",cmdb,temp);

        //                }

        //                else if(xmode==1)

        //                {

        //                        purasu=23;

     //             swprintf(tmb2,L"dir /A /Q \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

        //                }

        //                else if(xmode==2)

        //                {

        //                         purasu=0;

        //                 swprintf(tmb2,L"dir /A /S \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

        //                }    

        //                else if(xmode==3)

        //                {

        //                         purasu=13;

        //                 swprintf(tmb2,L"dir /A /X \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

        //                }    

              //swprintf(tmb2,L"dir /A \"%s\" > %s\\excdir\\dir.txt",guncb,temp);

                  }    

       }

         _wsystem(tmb2);

        }

        if(_kannjif==11)

        {

      

       if(xmode==0) {wcscpy(xchar,L"C");purasu=0;}

       else if(xmode==1) {wcscpy(xchar,L"Q");purasu=23;}

       else if(xmode==2) {wcscpy(xchar,L"S");purasu=0; }

           else if(xmode==3) {wcscpy(xchar,L"X");purasu=13;}

       else if(xmode==4) {wcscpy(xchar,L"T:C");purasu=0;}

       else if(xmode==5) {wcscpy(xchar,L"T:A");purasu=0;}

       else if(xmode==6) {wcscpy(xchar,L"T:W");purasu=0;}

       else if(xmode==7) {wcscpy(xchar,L"B");purasu=-36;}    //filetop=36

 

 

       swprintf(tmb2,L"dir /A /%s \"%s\" > %s\\excdir\\dir.txt",xchar,cmdb,temp);

       kannji(tmb2);

 

          wprintf(L"_kannji==11\n");

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

       

          _wsystem(tmb2);

          swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd",temp);filenullf(tmb2);

 

 

     //  swprintf(tmb2,L"type %s\\excdir\\dir.txt",temp);

     // _wsystem(tmb2);

     //  swprintf(tmb2,L"type %s\\excdir\\dirkj.txt",temp);

     // _wsystem(tmb2);

 

        }

 

         

         

      swprintf(tmb2,L"%s\\excdir\\dirno.txt",temp);

 

         

      if((yomikomi=_wfopen(tmb,L"r"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb);

         

      if((kakikomi=_wfopen(tmb2,L"w"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb2);

         

          for(i=1;i<5000;++i)

          {

                  if(fgetws(dirb[i],1024,yomikomi)==NULL) {fileend=i-1; break;}

          else

                  {

               swprintf(line,L"%04d %s",i,dirb[i]);

                           wprintf(L"%s",line);

                       fputws(line,kakikomi);

                  }

          }

 

          fclose(yomikomi);

          fclose(kakikomi);

 

          if(fileend>300)

          {

          swprintf(tmb,L"%s  %s\\excdir\\dirno.txt",note,temp);_wsystem(tmb);

 

          }

 

      while(1)

          {

                  if(_cmdendf!=0) return(0);

                  _cmdmodef=0;

          i=bkno;

                  pcname(cmdb,usrpcb);

      wprintf(L"\ncdir=%s\n",cdirb);

      if(_usrpcf==0)

              wprintf(L"cunc=%s\n",uncb);

      if(_usrpcf==1)

              wprintf(L"GUNC=%s\n",guncb);

      wprintf(L"DIR=%s\n",cmdb);

      wprintf(L"\n@DIR/A/%s@RUN Line No.= ? ",xchar);_getws(tmb);

 

          if(tmb[0]==L'?') {dirf(cmdb);return(0);}

          if(tmb[0]==L' ') {dirf(cmdb);return(0);}

          if(tmb[0]<L' ')  return(0);

          if(tmb[0]==L'&') {_kannjif=11;wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'#') {_kannjif=0; wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'0') {dirf(cmdb);return(0);}

          if(tmb[0]==L'<'){--i;  goto ESTA;}

          if(tmb[0]==L'>'){++i;  goto ESTA;}

 

          if(tmb[0]==L'@')

          {

                       if(wcsncmp(tmb,L"@attrib /s ",11)==0)   {attribf(1,&tmb[11]);continue;}

                  else if( wcscmp(tmb,L"@attrib")==0)          {attribf(0,cmdb);continue;}

                  else if(wcsncmp(tmb,L"@ATTRIB /S ",11)==0)   {attribf(1,&tmb[11]);continue;}

        //        else if(wcsncmp(tmb,L"@attrib ",8)==0)       {attribf(0,&tmb[8]);continue;}

        //        else if(wcsncmp(tmb,L"@ATTRIB ",8)==0)       {attribf(0,&tmb[8]);continue;}

                  else if( wcscmp(tmb,L"@ATRRIB")==0)          {attribf(0,cmdb);continue;}

        //        else if(wcsncmp(tmb,L"@type ",6)==0)   {i=_wtoi(&tmb[6]);_cmdmodef=1;goto ESTA2;}

        //        else if(wcsncmp(tmb,L"@print ",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=2;goto ESTA2;}

        //        else if(wcsncmp(tmb,L"@attrib ",8)==0) {i=_wtoi(&tmb[8]);_cmdmodef=4;goto ESTA2;}

        //        else if(wcsncmp(tmb,L"@note ",6)==0)   {i=_wtoi(&tmb[6]);_cmdmodef=8;goto ESTA2;}

                  else if(wcsncmp(tmb,L"@xcopy$",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=1001;goto ESTA;}

                  else if(wcsncmp(tmb,L"@xcopy#",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=1002;goto ESTA;}

                  else if(wcsncmp(tmb,L"@dir ",5)==0)    {i=_wtoi(&tmb[5]);goto ESTA;}

                  else if(wcsicmp(tmb,L"@end")==0)       {_cmdendf=1;break;}

          else if(wcsicmp(tmb,L"@exit")==0)     

                  {   _cmdendf=1;_exitf=1;

                  wcscpy(bkcdirb,cdirb);          

                      break;

                  }

          if(linedf(tmb)>=1) {i=_lineno;printf("i=%d",i);goto ESTA2 ;}

                  if(linef(tmb)>=1)  {i=_lineno;printf("i=%d",i);goto ESTA2;}

 

                 

 

                  swprintf(tmb1,L"%s\\%s",cmdb,tmb);

                  _wsystem(tmb);continue;

          }

          else

          {  i=_wtoi(tmb);bkno=i;_kannjif=0;}

 

 

ESTA:

          wprintf(L"%s",dirb[i]);

          if(i<=0) return(0);

          if(i<6) dirf(cmdb);

 

          if(i>(fileend-2)) return(0);

     

          if(xmode==7)

          {

                  xdirbf=0;

                  for(j=0;j<230;++j)

                  {

                          if(dirb[i][j]<L' ') break;

                          else if(dirb[i][j]==L'.') {xdirbf=1;break;}

                  }

          }

      if((wcsncmp(&dirb[i][dirtop],L"<DIR>",5)==0) || ((xmode==7) && (xdirbf==0)))    // DIR

          {

                  _dirfilef=1;

                  if(_cmdmodef==1001) {_xcopyf[0]=1,_xcopyf[1]=1;}

          if(_cmdmodef==1002) _xcopyf[2]=1;

 

                  wprintf(&dirb[i][dirtop]);

 

               

                  wcscpy(line,&dirb[i][filetop+purasu]);

        

                //  wcscpy(line,&dirb[i][filetop]);

                 fnamechf(line);

                  enn(line);

        //  norootf(cmdb);

                  if(_usrpcf==0)

                  {

                  if(dor(cmdb)==0)

                               swprintf(line2,L"%s\\%s",cmdb,line);

                      else if(dor(cmdb)==1)

                  swprintf(line2,L"%s%s",cmdb,line);

                  }

                  else if(_usrpcf==1)

                  {

              if(dor(guncb)==0)

                           swprintf(line2,L"%s\\%s",guncb,line);

                       else if(dor(guncb)==1)

                    swprintf(line2,L"%s%s",guncb,line);

                  }

 

 

          enn(line2);

                  wprintf(L"dirf() line2=%s\r\n",line2);

         fnamechf(line2);

         if(_kannjif==11)

                 {

                        // if(xmode==0)

                         // {

                          //      purasu=0;

                           swprintf(line3,L"dir /A /%s \"%s\" > %s\\excdir\\dir.txt",xchar,line2,temp);

                   //       swprintf(tmb2,L"cmd.exe /C \"dir /A: %s\" > %s\\excdir\\dir.txt",cmdb,temp);

                //        }

                //        else if(xmode==1)

                //        {

                        //        purasu=23;

          //        swprintf(line3,L"dir /A /Q \"%s\" > %s\\excdir\\dir.txt",line2,temp);

                //        }

        //                else if(xmode==2)

        //                {

        //                //       purasu=0;

        //                 swprintf(line3,L"dir /A /S \"%s\" > %s\\excdir\\dir.txt",line2,temp);

        //                }    

        //                else if(xmode==3)

        //                {

                         //        purasu=13;

        //                 swprintf(line3,L"dir /A /X \"%s\" > %s\\excdir\\dir.txt",line2,temp);

        //                }    

                     //  swprintf(line3,L"dir \"%s\" > %s\\excdir\\dir.txt && type %s\\excdir\\dir.txt",line2,temp,temp);

                         //  swprintf(line3,L"dir %s > %s\\excdir\\dirkj.txt",line2,temp);

                           wprintf(L"dirf() kannji %s",line3);

                       kannji(line3);

                 }

                 else  if(_kannjif==0)

                 {

                         

                        ;// dirf(line2);             ///////// DIR ////////////////////////////////////////////////////

                 }     

 

 

                 if(_cmdmodef==1001) {wcscpy(xcopysb[0],line2);continue;}

                 if(_cmdmodef==1002) {wcscpy(xcopysb[1],line2);systemf(_cmdmodef,cmdb);continue;}

                 xdirf(xmode,line2); cdf(cmdb);

                 

          }

          else // NO DIR

      {

                  _dirfilef=0;

                  if(_cmdmodef==1001) {_xcopyf[0]=1;_xcopyf[1]=0;}

          if(_cmdmodef==1002) _xcopyf[2]=0;

                  wprintf(L"%s",&dirb[i][dirtop]);

                  wprintf(L"%s",&dirb[i][filetop+purasu]);

ESTA2:    wcscpy(line,&dirb[i][filetop+purasu]);//fnamechf(line2);

 

       

        if(_usrpcf==0)

                {

                  if(dor(cmdb)==0)

               swprintf(line2,L"%s\\%s",cmdb,&dirb[i][filetop+purasu]);

          if(dor(cmdb)==1)

                          swprintf(line2,L"%s%s",cmdb,&dirb[i][filetop+purasu]);

                }

        if(_usrpcf==1)

                {

                  if(dor(guncb)==0)

               swprintf(line2,L"%s\\%s",guncb,&dirb[i][filetop+purasu]);

          if(dor(guncb)==1)

                          swprintf(line2,L"%s%s",guncb,&dirb[i][filetop+purasu]);

                }

 

       

        fnamechf(line2);enn(line2);

                if(_fnamef==1)

                swprintf(line3,L"\"%s\"",line2);

                else if(_fnamef==0)

                        wcscpy(line3,line2);

                if(line3[0]<L' ') return(0);

        enn(line3);

                if(_cmdmodef==1001) {wcscpy(xcopysb[0],line3);continue;}

        if(_cmdmodef==1002) {wcscpy(xcopysb[1],line3);}

 

 

                if(_kannjif==11) 

                  {

                          kannji(line3);

                      swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd",temp);filenullf(tmb2);

 

                  }

                else if(_kannjif==0)

                  {systemf(_cmdmodef,line3);}           // line2);

        }

          }//while  end

 

      return(0);

}

 

int    filenullf(wchar_t *fname)

{

      FILE   *kakikomi;

 

       if((kakikomi=_wfopen(fname,L"w"))==NULL)

            wprintf(L"Err! filenullf() _wfopen() No file! %s \n",fname);

        

            fputws(L" ",kakikomi);

            fclose(kakikomi);

        return(0);

}

 

int   treef(int   treeflg,wchar_t  *cmdb)

{

          int            i=0,t=0;

          int      fileend=0;

          int         bkno=7;

          int        trdirf[5000];

          int        pathsu=0;

          int       cpathsu=0;

          int          endf=0;

          wchar_t     line[1024];

          wchar_t     line2[1024];

      wchar_t     line3[1024];

      wchar_t     tmb[1024];

//        wchar_t     tmb1[1024];

      wchar_t     tmb2[1024];

          wchar_t     tmpb[1024];

     

      div_t       div_syo;

 

          FILE     *yomikomi,*kakikomi;

 

    

      if(_treef_endf==1) return(1);

 

 

    //  enn(cmdb);

          cdf(cmdb);

        //  _wchdir(cmdb);

   //   enn(cdirb);

    

      fnamechf(cmdb);enn(cmdb);

        swprintf(tmb,L"%s\\excdir\\dir.txt",temp);

         pcname(cdirb,usrpcb);

    if(_kannjif==0)

        {

        wprintf(L"_kannji==0\n");

           if(_usrpcf==0)

           {

                  if(_fnamef==0)

                  {

                          if(treeflg==0)

                           swprintf(tmb2,L"tree /A  %s > %s\\excdir\\dir.txt",cmdb,temp);

                          else  if(treeflg>=1)

                           swprintf(tmb2,L"tree /A /F %s > %s\\excdir\\dir.txt",cmdb,temp);

                  }

                  else if(_fnamef==1)

                  {

              if(treeflg==0)

                   swprintf(tmb2,L"tree /A  \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

               else  if(treeflg>=1)

                           swprintf(tmb2,L"tree /A /F %s > %s\\excdir\\dir.txt",cmdb,temp);

                  

                  }

           }

           else  if(_usrpcf==1)

           {

                  if(_fnamef==0)

                  {

                if(treeflg==0)

                     swprintf(tmb2,L"tree /A  \"%s\" > %s\\excdir\\dir.txt",guncb,temp);

                                else if(treeflg>=1)

                             swprintf(tmb2,L"tree /A /F %s > %s\\excdir\\dir.txt",guncb,temp);

                  }

                  else if(_fnamef==1)

                  {

                 if(treeflg==0)

                     swprintf(tmb2,L"tree /A  \"%s\" > %s\\excdir\\dir.txt",guncb,temp);

                                 else if(treeflg>=1)                   

                      swprintf(tmb2,L"tree /A /F \"%s\" > %s\\excdir\\dir.txt",guncb,temp);

                  }

          }    

 

    _wsystem(tmb2);

        }

        else if(_kannjif==11)

        {

          wprintf(L"_kannji==11\n");

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

       

          _wsystem(tmb2);

       swprintf(tmb2,L"type %s\\excdir\\dir.txt",temp);

      _wsystem(tmb2);

       swprintf(tmb2,L"type %s\\excdir\\dirkj.txt",temp);

      _wsystem(tmb2);

 

        }

 

         

         

      swprintf(tmb2,L"%s\\excdir\\dirno.txt",temp);

 

         

      if((yomikomi=_wfopen(tmb,L"r"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb);

         

      if((kakikomi=_wfopen(tmb2,L"w"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb2);

         

 

         

          for(i=1;i<5000;i++)

          {

                  if(fgetws(dirb[i],1024,yomikomi)==NULL) {fileend=i-1; break;}

          else

                  {

               swprintf(line,L"%04d %s",i,dirb[i]);

                           wprintf(L"%s",line);

                       fputws(line,kakikomi);

                          

              

                  }

 

          }

 

          fclose(yomikomi);

          fclose(kakikomi);

 

 

 

    //  _wchdir(cmdb);

           cpathsu=0;endf=0;

 

 

           for(i=1;i<5000;i++)

           {

             if(i>=fileend) break;

             trdirf[i]=0;wcscpy(trdirb[i],L"");

           }

       for(i=0;i<150;++i)

           {

                   wcscpy(pathb[i],L"");

           }

 

 

 

       wcscpy(pathb[0],dirb[3]);

           for(i=1;i<5000;i++)

           {

             if(i>=fileend) break;

              trdirf[i]=0;

                     wcscpy(tmpb,dirb[i]);//wcscpy(dirb[i],L"");

                        // _wgetcwd(trdirb[i],245);

             for(t=0,pathsu=0;t<1024;t++)

                           {

                //           if(tmpb[t]==L'|') pathsu++;

                 if((tmpb[t-4]==L'+') && (tmpb[t-3]==L'-') && (tmpb[t-2]==L'-') && (tmpb[t-1]==L'-') && (tmpb[t]!=L'-'))

                         {

          //           pathsu++;

                     div_syo=div(t,4);

 

                                        //(endf>0) {cpathsu=cpathsu-endf;endf=0;}

                                         swprintf(pathb[div_syo.quot],L"%s\\%s\n",enn(pathb[div_syo.quot-1]),&tmpb[t]);

                     trdirf[i]=1;//_wchdir(pathb[cpathsu]);//_wgetcwd(trdirb[i],245);

                     wcscpy(trdirb[i],pathb[div_syo.quot]);

                   //  wcscpy(dirb[i],pathb[div_syo.quot]);

 

 

 

                                         //_wgetcwd(dirb[i],245);

 

                                         //_wgetcwd(pathb[++cpathsu],245);

                         }

                                 else if((tmpb[t-4]==L'\\') && (tmpb[t-3]==L'-') && (tmpb[t-2]==L'-') && (tmpb[t-1]==L'-') && (tmpb[t]!=L'-'))

                         {

                     pathsu++;++endf;

                     div_syo=div(t,4);

                     swprintf(pathb[div_syo.quot],L"%s\\%s",enn(pathb[div_syo.quot-1]),&tmpb[t]);

                     trdirf[i]=1;_wchdir(pathb[div_syo.quot]);//_wgetcwd(trdirb[i],245);

                     wcscpy(trdirb[i],pathb[div_syo.quot]);

                    // wcscpy(dirb[i],pathb[div_syo.quot]);

 

                                         //swprintf(line,L"%s\\%s",pathb[cpathsu],&tmpb[t]);

                     //trdirf[i]=1;_wchdir(line);_wgetcwd(trdirb[i],245);

                                         //_wgetcwd(dirb[i],245);_wgetcwd(pathb[++cpathsu],245);

                         }

                 else if((tmpb[t-3]==L' ') && (tmpb[t-2]==L' ') && (tmpb[t-1]==L' ') && (tmpb[t]!=L' ') && (tmpb[t]!=L'+') && (tmpb[t]!=L'\\') && (tmpb[t]!=L'|') )

                         {

                             if(t>250) break;

                 div_syo=div(t,4);

                 swprintf(trdirb[i],L"%s\\%s",enn(pathb[div_syo.quot-1]),&tmpb[t]);

                 trdirf[i]=0;

                             }

                                 

                                //else   wcscpy(dirb[i],pathb[0]);//swprintf(dirb[i],L"%s\n",enn(pathb[div_syo.quot-1]));

           }

            wcscpy(dirb[i],trdirb[i]);

           if(debug==1) wprintf(L"flag=%d dirb[%d]=%s",trdirf[i],i,trdirb[i]);        

           }

      for(i=0;i<10;++i)

          {

                  wprintf(L"\npathb[%d]=%s",i,pathb[i]);

          }

 

          if(fileend>300)

          {

          swprintf(tmb,L"%s  %s\\excdir\\dirno.txt",note,temp);_wsystem(tmb);

 

          }

 

      while(1)

          {

        //  i=bkno;

                  pcname(cmdb,usrpcb);

      wprintf(L"\ncdir=%s\n",cdirb);

      if(_usrpcf==0)

              wprintf(L"cunc=%s\n",uncb);

      if(_usrpcf==1)

              wprintf(L"GUNC=%s\n",guncb);

      wprintf(L"DIR=%s\n",cmdb);

      wprintf(L"\n@TREE/RUN Line No.= ? ");_getws(tmb);

 

          if(tmb[0]==L'?') {dirf(cmdb);return(0);}

          if((tmb[0]==L'@') && (tmb[1]< L' ')){treef(1,cmdb);return(0);}

          if(tmb[0]==L' ') {treef(1,cmdb);return(0);}

          if(tmb[0]<L' ')  return(0);

          if(tmb[0]==L'&') {_kannjif=11;wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'#') {_kannjif=0; wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'0') {treef(1,cmdb);return(0);}

          if(tmb[0]==L'<'){--i;  goto ESTA;}

          if(tmb[0]==L'>'){++i;  goto ESTA;}

 

          if(tmb[0]<L'0' || tmb[0]>L'9')

          {

                       if(wcsncmp(tmb,L"@attrib /s ",11)==0)   {attribf(1,&tmb[11]);continue;}

                  else if( wcscmp(tmb,L"@attrib")==0)          {attribf(0,cmdb);continue;}

                  else if(wcsncmp(tmb,L"@ATTRIB /S ",11)==0)   {attribf(1,&tmb[11]);continue;}

                  else if(wcsncmp(tmb,L"@attrib ",8)==0)       {attribf(0,&tmb[8]);continue;}

                  else if(wcsncmp(tmb,L"@ATTRIB ",8)==0)       {attribf(0,&tmb[8]);continue;}

                  else if( wcscmp(tmb,L"@ATRRIB")==0)          {attribf(0,cmdb);continue;}

                  else if(wcsncmp(tmb,L"@type#",6)==0)   {i=_wtoi(&tmb[6]);_cmdmodef=1;goto ESTA2;}

                  else if(wcsncmp(tmb,L"@print#",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=2;goto ESTA2;}

                  else if(wcsncmp(tmb,L"@attrib#",8)==0) {i=_wtoi(&tmb[8]);_cmdmodef=4;goto ESTA2;}

                  else if(wcsncmp(tmb,L"@xcopy$",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=1001;goto ESTA;}

                  else if(wcsncmp(tmb,L"@xcopy#",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=1002;goto ESTA;}

                  else if( wcscmp(tmb,L"@end")==0) { _treef_endf=1;return(1);}

                  else if(wcsicmp(tmb,L"@exit")==0)     

                  {   _cmdendf=1;_exitf=1;

                  wcscpy(bkcdirb,cdirb);          

                      break;

                  }

                  else    {_cmdmodef=0;}

 

 

 

 

 

                 

 

//                swprintf(tmb1,L"%s\\%s",cmdb,tmb);

                  _wsystem(tmb);continue;

          }

          else

          {  i=_wtoi(tmb);bkno=i;_kannjif=0;}

 

 

ESTA:

          wprintf(L"%s",dirb[i]);

          if(i<=3) return(0);

         

 

          if(i>fileend) return(0);

 

 

 

 

      wcscpy(tmpb,trdirb[i]);

 

         

     

      if(trdirf[i]==1)    // DIR

          {

                  if(debug==1) wprintf(L"DIR dirb[%d]=%s",i,trdirb[i]);

                  _dirfilef=1;

                  if(_cmdmodef==1001) {_xcopyf[0]=1,_xcopyf[1]=1;}

          if(_cmdmodef==1002) _xcopyf[2]=1;

 

        //        wprintf(&dirb[i][0]);

        //        wcscpy(line,&dirb[i][0]);

        //      fnamechf(line);

        ///       enn(line);

        //  norootf(cmdb);

        //        if(_usrpcf==0)

        //        {

//                if(dor(cmdb)==0)

//                             swprintf(line2,L"%s\\%s",cmdb,line);

//                    else if(dor(cmdb)==1)

//                  swprintf(line2,L"%s%s",cmdb,line);

//                }

//                else if(_usrpcf==1)

//                {

//              if(dor(guncb)==0)

//                         swprintf(line2,L"%s\\%s",guncb,line);

//                     else if(dor(guncb)==1)

//                    swprintf(line2,L"%s%s",guncb,line);

//                }

 

 

 //         enn(line2);

//                wprintf(L"dirf() line2=%s\r\n",line2);

//         fnamechf(line2);

         if(_kannjif==11)

                 {

                       swprintf(line3,L"tree /A /F  \"%s\" > %s\\excdir\\dir.txt && type %s\\excdir\\dir.txt",line2,temp,temp);

                         //  swprintf(line3,L"dir %s > %s\\excdir\\dirkj.txt",line2,temp);

                           wprintf(L"dirf() kannji %s",line3);

                       kannji(line3);

                 }

                 else  if(_kannjif==0)

                 {

                         

                        ;// dirf(line2);

                 }     

 

 

                 if(_cmdmodef==1001) {wcscpy(xcopysb[0],line2);continue;}

                 if(_cmdmodef==1002) {wcscpy(xcopysb[1],line2);systemf(_cmdmodef,cmdb);continue;}

                 treef(treeflg,trdirb[i]); cdf(cmdb);

                 

          }    // DIR END

          else if(trdirf[i]==0)   // NO DIR

      {

                  if(debug==1) wprintf(L"NO DIR dirb[%d]=%s",i,dirb[i]);

                  _dirfilef=0;

                  if(_cmdmodef==1001) {_xcopyf[0]=1;_xcopyf[1]=0;}

          if(_cmdmodef==1002) _xcopyf[2]=0;

                  wprintf(L"%s\n" ,trdirb[i]);

                  wprintf(L"%s\n",dirb[i]);

ESTA2:    wcscpy(line,dirb[i]);//fnamechf(line2);

 

       

        if(_usrpcf==0)

                {

                  if(dor(cmdb)==0)

               swprintf(line2,L"%s\\%s",tmpb,&dirb[i][0]);

          if(dor(cmdb)==1)

                          swprintf(line2,L"%s%s",tmpb,&dirb[i][0]);

                }

        if(_usrpcf==1)

                {

                  if(dor(guncb)==0)

               swprintf(line2,L"%s\\%s",guncb,&dirb[i][0]);

          if(dor(guncb)==1)

                          swprintf(line2,L"%s%s",guncb,&dirb[i][0]);

                }

 

       

        fnamechf(line2);enn(line2);

                if(_fnamef==1)

                swprintf(line3,L"\"%s\"",line2);

                else if(_fnamef==0)

                        wcscpy(line3,line2);

                if(line3[0]<L' ') return(0);

        enn(line3);

                if(_cmdmodef==1001) {wcscpy(xcopysb[0],line3);continue;}

        if(_cmdmodef==1002) {wcscpy(xcopysb[1],line3);}

 

 

                if(_kannjif==11) 

                  {

                          kannji(dirb[i]);

                  }

                else if(_kannjif==0)

                  {systemf(_cmdmodef,dirb[i]);}           // line2);

        }//No Dir End.

          }//while  end

 

      return(0);

}

 

 

int   modedirf(int  mode,wchar_t  *cmdb)

{

          int            i=0;

          int      fileend=0;

          int         bkno=7;

          wchar_t     line[1024];

          wchar_t     line2[1024];

      wchar_t     line3[1024];

      wchar_t     tmb[1024];

          wchar_t     tmb1[1024];

      wchar_t     tmb2[1024];

         

          FILE     *yomikomi,*kakikomi;

 

 

      enn(cmdb);cdf(cmdb);

        // _wchdir(cmdb);

   //   enn(cdirb);

    

      fnamechf(cmdb);enn(cmdb);

        swprintf(tmb,L"%s\\excdir\\dir.txt",temp);

         //pcname(cdirb,usrpcb);

    if(_kannjif==0)

        {

        wprintf(L"_kannji==0\n");

           if(_usrpcf==0)

           {

                  if(_fnamef==0)

                   //   swprintf(tmb2,L"dir /A: %s > \\excdir\\dir.txt",cmdb,systemdrive);

                   if(mode==0)

                   swprintf(tmb2,L"cmd.exe /C \"dir /A: %s\" > %s\\excdir\\dir.txt",cmdb,temp);

           if(mode==1)

                   {

                           if(dor(cmdb)==0)

                       swprintf(tmb2,L"cmd.exe /C \"attrib /S %s\\*.*\" > %s\\excdir\\dir.txt",cmdb,temp);

               else if(dor(cmdb)==1)

                       swprintf(tmb2,L"cmd.exe /C \"attrib /S %s*.*\" > %s\\excdir\\dir.txt",cmdb,temp);

                  

                  

                  

                  

                   }

                   else if(_fnamef==1)

              swprintf(tmb2,L"dir /A: \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

           }

           else  if(_usrpcf==1)

           {

                  if(_fnamef==0)

                        swprintf(tmb2,L"dir /A: %s > %s\\excdir\\dir.txt",guncb,temp);

                  else if(_fnamef==1)

              swprintf(tmb2,L"dir /A: \"%s\" > %s\\excdir\\dir.txt",guncb,temp);

           }   

 

         _wsystem(tmb2);

        }

        if(_kannjif==11)

        {

          wprintf(L"_kannji==11\n");

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

       

          _wsystem(tmb2);

       swprintf(tmb2,L"type %s\\excdir\\dir.txt",temp);

      _wsystem(tmb2);

       swprintf(tmb2,L"type %s\\excdir\\dirkj.txt",temp);

      _wsystem(tmb2);

 

        }

 

         

         

      swprintf(tmb2,L"%s\\excdir\\dirno.txt",temp);

 

         

      if((yomikomi=_wfopen(tmb,L"r"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb);

         

      if((kakikomi=_wfopen(tmb2,L"w"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb2);

         

          for(i=1;i<5000;++i)

          {

                  if(fgetws(dirb[i],1024,yomikomi)==NULL) {fileend=i-1; break;}

          else

                  {

               swprintf(line,L"%04d %s",i,dirb[i]);

                           wprintf(L"%s",line);

                       fputws(line,kakikomi);

                  }

          }

 

          fclose(yomikomi);

          fclose(kakikomi);

 

          if(fileend>300)

          {

          swprintf(tmb,L"%s  %s\\excdir\\dirno.txt",note,temp);_wsystem(tmb);

 

          }

 

      while(1)

          {

          i=bkno;

                  pcname(cmdb,usrpcb);

      wprintf(L"\ncdir=%s\n",cdirb);

      if(_usrpcf==0)

              wprintf(L"cunc=%s\n",uncb);

      if(_usrpcf==1)

              wprintf(L"GUNC=%s\n",guncb);

      wprintf(L"DIR=%s\n",cmdb);

      wprintf(L"\n@DIR/RUN Line No.= ? ");_getws(tmb);

 

          if(tmb[0]==L'?') {dirf(cmdb);return(0);}

          if((tmb[0]==L'@') && (tmb[1]<L' ')) {dirf(cmdb);return(0);}

          if(tmb[0]==L' ') {dirf(cmdb);return(0);}

          if(tmb[0]<L' ')  return(0);

          if(tmb[0]==L'&') {_kannjif=11;wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'#') {_kannjif=0; wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'0') {dirf(cmdb);return(0);}

          if(tmb[0]==L'<'){--i;  goto ESTA;}

          if(tmb[0]==L'>'){++i;  goto ESTA;}

 

          if(tmb[0]<L'0' || tmb[0]>L'9')

          {

                       if(wcsncmp(tmb,L"@attrib /s ",11)==0)   {attribf(1,&tmb[11]);continue;}

                  else if( wcscmp(tmb,L"@attrib")==0)          {attribf(0,cmdb);continue;}

                  else if(wcsncmp(tmb,L"@ATTRIB /S ",11)==0)   {attribf(1,&tmb[11]);continue;}

                  else if(wcsncmp(tmb,L"@attrib ",8)==0)       {attribf(0,&tmb[8]);continue;}

                  else if(wcsncmp(tmb,L"@ATTRIB ",8)==0)       {attribf(0,&tmb[8]);continue;}

                  else if( wcscmp(tmb,L"@ATRRIB")==0)          {attribf(0,cmdb);continue;}

                  else if(wcsncmp(tmb,L"@type#",6)==0)   {i=_wtoi(&tmb[6]);_cmdmodef=1;goto ESTA2;}

                  else if(wcsncmp(tmb,L"@print#",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=2;goto ESTA2;}

                  else if(wcsncmp(tmb,L"@attrib#",8)==0) {i=_wtoi(&tmb[8]);_cmdmodef=4;goto ESTA2;}

                  else if(wcsncmp(tmb,L"@xcopy$",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=1001;goto ESTA;}

                  else if(wcsncmp(tmb,L"@xcopy#",7)==0)  {i=_wtoi(&tmb[7]);_cmdmodef=1002;goto ESTA;}

         

          else if(wcsicmp(tmb,L"@exit")==0)     

                  {   _cmdendf=1;_exitf=1;

                  wcscpy(bkcdirb,cdirb);          

                      break;

                  }

 

 

 

 

                 

 

                  swprintf(tmb1,L"%s\\%s",cmdb,tmb);

                  _wsystem(tmb);continue;

          }

          else

          {  i=_wtoi(tmb);bkno=i;_kannjif=0;}

 

 

ESTA:

          wprintf(L"%s",dirb[i]);

          if(i<=0) return(0);

          if(i<6) dirf(cmdb);

 

          if(i>(fileend-2)) return(0);

      

      if(wcsncmp(&dirb[i][dirtop],L"<DIR>",5)==0)    // DIR

          {

                  _dirfilef=1;

                  if(_cmdmodef==1001) {_xcopyf[0]=1,_xcopyf[1]=1;}

          if(_cmdmodef==1002) _xcopyf[2]=1;

 

                  wprintf(&dirb[i][dirtop]);

                  wcscpy(line,&dirb[i][filetop]);

                 fnamechf(line);

                  enn(line);

        //  norootf(cmdb);

                  if(_usrpcf==0)

                  {

                  if(dor(cmdb)==0)

                               swprintf(line2,L"%s\\%s",cmdb,line);

                      else if(dor(cmdb)==1)

                  swprintf(line2,L"%s%s",cmdb,line);

                  }

                  else if(_usrpcf==1)

                  {

              if(dor(guncb)==0)

                           swprintf(line2,L"%s\\%s",guncb,line);

                       else if(dor(guncb)==1)

                    swprintf(line2,L"%s%s",guncb,line);

                  }

 

 

          enn(line2);

                  wprintf(L"dirf() line2=%s\r\n",line2);

         fnamechf(line2);

         if(_kannjif==11)

                 {

                       swprintf(line3,L"dir \"%s\" > %s\\excdir\\dir.txt && type %s\\excdir\\dir.txt",line2,temp,temp);

                         //  swprintf(line3,L"dir %s > %s\\excdir\\dirkj.txt",line2,temp);

                           wprintf(L"dirf() kannji %s",line3);

                       kannji(line3);

                 }

                 else  if(_kannjif==0)

                 {

                         

                        ;// dirf(line2);

                 }     

 

 

                 if(_cmdmodef==1001) {wcscpy(xcopysb[0],line2);continue;}

                 if(_cmdmodef==1002) {wcscpy(xcopysb[1],line2);systemf(_cmdmodef,cmdb);continue;}

                 dirf(line2); cdf(cmdb);

                 

          }

          else // NO DIR

      {

                  _dirfilef=0;

                  if(_cmdmodef==1001) {_xcopyf[0]=1;_xcopyf[1]=0;}

          if(_cmdmodef==1002) _xcopyf[2]=0;

                  wprintf(L"%s",&dirb[i][dirtop]);

                  wprintf(L"%s",&dirb[i][filetop]);

ESTA2:    wcscpy(line,&dirb[i][filetop]);//fnamechf(line2);

 

       

        if(_usrpcf==0)

                {

                  if(dor(cmdb)==0)

               swprintf(line2,L"%s\\%s",cmdb,&dirb[i][filetop]);

          if(dor(cmdb)==1)

                          swprintf(line2,L"%s%s",cmdb,&dirb[i][filetop]);

                }

        if(_usrpcf==1)

                {

                  if(dor(guncb)==0)

               swprintf(line2,L"%s\\%s",guncb,&dirb[i][filetop]);

          if(dor(guncb)==1)

                          swprintf(line2,L"%s%s",guncb,&dirb[i][filetop]);

                }

 

       

        fnamechf(line2);enn(line2);

                if(_fnamef==1)

                swprintf(line3,L"\"%s\"",line2);

                else if(_fnamef==0)

                        wcscpy(line3,line2);

                if(line3[0]<L' ') return(0);

        enn(line3);

                if(_cmdmodef==1001) {wcscpy(xcopysb[0],line3);continue;}

        if(_cmdmodef==1002) {wcscpy(xcopysb[1],line3);}

 

 

                if(_kannjif==11) 

                  {

                          kannji(line3);

                  }

                else if(_kannjif==0)

                  {systemf(_cmdmodef,line3);}           // line2);

        }

          }//while  end

 

      return(0);

}

 

int   _dirf(wchar_t  *cmdb)

{

          int            i=0;

          int      fileend=0;

          int         bkno=7;

          wchar_t     line[1024];

          wchar_t     line2[1024];

      wchar_t     line3[1024];

      wchar_t     tmb[1024];

          wchar_t     tmb1[1024];

      wchar_t     tmb2[1024];

         

          FILE     *yomikomi,*kakikomi;

 

 

      enn(cmdb);cdf(cmdb);

        // _wchdir(cmdb);

   //   enn(cdirb);

    

      fnamechf(cmdb);enn(cmdb);

        swprintf(tmb,L"%s\\excdir\\dir.txt",temp);

         //pcname(cdirb,usrpcb);

    if(_kannjif==0)

        {

        wprintf(L"_kannji==0\n");

           if(_usrpcf==0)

           {

                  if(_fnamef==0)

                   //   swprintf(tmb2,L"dir /A: %s > \\excdir\\dir.txt",cmdb,systemdrive);

                   swprintf(tmb2,L"cmd.exe /C \"dir /A: %s\" > %s\\excdir\\dir.txt",cmdb,temp);

                  else if(_fnamef==1)

              swprintf(tmb2,L"dir /A: \"%s\" > %s\\excdir\\dir.txt",cmdb,temp);

           }

           else  if(_usrpcf==1)

           {

                  if(_fnamef==0)

                        swprintf(tmb2,L"dir /A: %s > %s\\excdir\\dir.txt",guncb,temp);

                  else if(_fnamef==1)

              swprintf(tmb2,L"dir /A: \"%s\" > %s\\excdir\\dir.txt",guncb,temp);

           }   

 

         _wsystem(tmb2);

        }

        if(_kannjif==11)

        {

          wprintf(L"_kannji==11\n");

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dir.txt",temp,temp);

          if(_usrpcf==0)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

          else  if(_usrpcf==1)

                  swprintf(tmb2,L"%s\\excdir\\batcmd\\$cmdbat.cmd > %s\\excdir\\dirkj.txt",temp,temp);

       

          _wsystem(tmb2);

       swprintf(tmb2,L"type %s\\excdir\\dir.txt",temp);

      _wsystem(tmb2);

       swprintf(tmb2,L"type %s\\excdir\\dirkj.txt",temp);

      _wsystem(tmb2);

 

        }

 

         

         

      swprintf(tmb2,L"%s\\excdir\\dirno.txt",temp);

 

         

      if((yomikomi=_wfopen(tmb,L"r"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb);

         

      if((kakikomi=_wfopen(tmb2,L"w"))==NULL)

            wprintf(L"Err! diff() _wfopen() No file! %s \n",tmb2);

         

          for(i=1;i<5000;++i)

          {

                  if(fgetws(dirb[i],1024,yomikomi)==NULL) {fileend=i-1; break;}

          else

                  {

               swprintf(line,L"%04d %s",i,dirb[i]);

                           wprintf(L"%s",line);

                       fputws(line,kakikomi);

                  }

          }

 

          fclose(yomikomi);

          fclose(kakikomi);

 

          if(fileend>300)

          {

          swprintf(tmb,L"%s  %s\\excdir\\dirno.txt",note,temp);_wsystem(tmb);

 

          }

 

      while(1)

          {

          i=bkno;

                  pcname(cmdb,usrpcb);

      wprintf(L"\ncdir=%s\n",cdirb);

      if(_usrpcf==0)

              wprintf(L"cunc=%s\n",uncb);

      if(_usrpcf==1)

              wprintf(L"GUNC=%s\n",guncb);

      wprintf(L"DIR=%s\n",cmdb);

      wprintf(L"\n@_DIR/RUN Line No.= ? ");_getws(tmb);

 

          if(tmb[0]==L'?') {dirf(cmdb);return(0);}

          if(tmb[0]<L' ')  return(0);

          if(tmb[0]==L'&') {_kannjif=11;wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'#') {_kannjif=0; wcscpy(tmb,&tmb[1]);i=_wtoi(tmb);goto ESTA;}

          if(tmb[0]==L'0') {dirf(cmdb);return(0);}

          if(tmb[0]==L'<'){--i;  goto ESTA;}

          if(tmb[0]==L'>'){++i;  goto ESTA;}

 

          if(tmb[0]<L'0' || tmb[0]>L'9')

          {

                 

                  if(wcsncmp(tmb,L"@attrib ",8)==0)   {attribf(0,&tmb[8]);continue;}

                  else if(wcscmp(tmb,L"@attrib")==0)  {attribf(0,cmdb);continue;}

                  else if(wcsncmp(tmb,L"@ATTRIB ",8)==0)   {attribf(0,&tmb[8]);continue;}

                  else if(wcscmp(tmb,L"@ATRRIB")==0)  {attribf(0,cmdb);continue;}

                  else if(wcsncmp(tmb,L"@type ",6)==0)

                  {

                          i=_wtoi(&tmb[6]);_cmdmodef=1;goto ESTA2;

             

 

                  }

 

                  swprintf(tmb1,L"%s\\%s",cmdb,tmb);

                  _wsystem(tmb);continue;

          }

          else

          {  i=_wtoi(tmb);bkno=i;_kannjif=0;}

 

 

ESTA:

          wprintf(L"%s",dirb[i]);

          if(i<=0) return(0);

          if(i<6) dirf(cmdb);

 

          if(i>(fileend-2)) return(0);

     

      if(wcsncmp(&dirb[i][dirtop],L"<DIR>",5)==0)    // DIR

          {

                  wprintf(&dirb[i][dirtop]);

                  wcscpy(line,&dirb[i][filetop]);

                 fnamechf(line);

                  enn(line);

        //  norootf(cmdb);

                  if(_usrpcf==0)

                  {

                  if(dor(cmdb)==0)

                               swprintf(line2,L"%s\\%s",cmdb,line);

                      else if(dor(cmdb)==1)

                  swprintf(line2,L"%s%s",cmdb,line);

                  }

                  else if(_usrpcf==1)

                  {

              if(dor(guncb)==0)

                           swprintf(line2,L"%s\\%s",guncb,line);

                       else if(dor(guncb)==1)

                    swprintf(line2,L"%s%s",guncb,line);

                  }