os2.cxx (89b56da7) os2.cxx (27ead02a)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 35 unchanged lines hidden (view full) ---

44
45int Sys2SolarError_Impl( int nSysErr );
46
47DECLARE_LIST( DirEntryList, DirEntry* );
48DECLARE_LIST( FSysSortList, FSysSort* );
49DECLARE_LIST( FileStatList, FileStat* );
50
51static char sCaseMap[256];
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 35 unchanged lines hidden (view full) ---

44
45int Sys2SolarError_Impl( int nSysErr );
46
47DECLARE_LIST( DirEntryList, DirEntry* );
48DECLARE_LIST( FSysSortList, FSysSort* );
49DECLARE_LIST( FileStatList, FileStat* );
50
51static char sCaseMap[256];
52static BOOL bCaseMap = FALSE;
53static BOOL bDriveMap = FALSE;
52static sal_Bool bCaseMap = FALSE;
53static sal_Bool bDriveMap = FALSE;
54
55struct DriveMapItem
56{
57 DirEntryKind nKind;
58 char cName;
59 FSysPathStyle nStyle;
60};
61
62void CreateCaseMapImpl();
63void CreateDriveMapImpl();
64
65static DriveMapItem aDriveMap[26];
66
54
55struct DriveMapItem
56{
57 DirEntryKind nKind;
58 char cName;
59 FSysPathStyle nStyle;
60};
61
62void CreateCaseMapImpl();
63void CreateDriveMapImpl();
64
65static DriveMapItem aDriveMap[26];
66
67static BOOL bLastCaseSensitive = FALSE;
67static sal_Bool bLastCaseSensitive = FALSE;
68
69//====================================================================
70
71int ApiRet2ToSolarError_Impl( int nApiRet )
72{
73 switch ( nApiRet )
74 {
75 case NO_ERROR: return ERRCODE_NONE;

--- 65 unchanged lines hidden (view full) ---

141|* DirEntry::ToAbs()
142|*
143|* Beschreibung FSYS.SDW
144|* Ersterstellung MI 26.04.91
145|* Letzte Aenderung MA 02.12.91 13:30
146|*
147*************************************************************************/
148
68
69//====================================================================
70
71int ApiRet2ToSolarError_Impl( int nApiRet )
72{
73 switch ( nApiRet )
74 {
75 case NO_ERROR: return ERRCODE_NONE;

--- 65 unchanged lines hidden (view full) ---

141|* DirEntry::ToAbs()
142|*
143|* Beschreibung FSYS.SDW
144|* Ersterstellung MI 26.04.91
145|* Letzte Aenderung MA 02.12.91 13:30
146|*
147*************************************************************************/
148
149BOOL DirEntry::ToAbs()
149sal_Bool DirEntry::ToAbs()
150{
151 DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
152
153 if ( FSYS_FLAG_VOLUME == eFlag )
154 {
155 eFlag = FSYS_FLAG_ABSROOT;
156 return TRUE;
157 }

--- 44 unchanged lines hidden (view full) ---

202|* DirEntry::SetCWD()
203|*
204|* Beschreibung FSYS.SDW
205|* Ersterstellung MI 26.04.91
206|* Letzte Aenderung MI 21.05.92
207|*
208*************************************************************************/
209
150{
151 DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
152
153 if ( FSYS_FLAG_VOLUME == eFlag )
154 {
155 eFlag = FSYS_FLAG_ABSROOT;
156 return TRUE;
157 }

--- 44 unchanged lines hidden (view full) ---

202|* DirEntry::SetCWD()
203|*
204|* Beschreibung FSYS.SDW
205|* Ersterstellung MI 26.04.91
206|* Letzte Aenderung MI 21.05.92
207|*
208*************************************************************************/
209
210BOOL DirEntry::SetCWD( BOOL bSloppy ) const
210sal_Bool DirEntry::SetCWD( sal_Bool bSloppy ) const
211{
212 DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
213
214 if ( eFlag == FSYS_FLAG_CURRENT && !aName.Len() )
215 return TRUE;
216
217 if ( !chdir(ByteString(GetFull(), osl_getThreadTextEncoding()).GetBuffer()) )
218 {

--- 18 unchanged lines hidden (view full) ---

237|*
238|* Beschreibung FSYS.SDW
239|* Ersterstellung MI 26.04.91
240|* Letzte Aenderung MA 02.12.91 14:07
241|*
242*************************************************************************/
243
244#if 0 // YD see dirent.cxx
211{
212 DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
213
214 if ( eFlag == FSYS_FLAG_CURRENT && !aName.Len() )
215 return TRUE;
216
217 if ( !chdir(ByteString(GetFull(), osl_getThreadTextEncoding()).GetBuffer()) )
218 {

--- 18 unchanged lines hidden (view full) ---

237|*
238|* Beschreibung FSYS.SDW
239|* Ersterstellung MI 26.04.91
240|* Letzte Aenderung MA 02.12.91 14:07
241|*
242*************************************************************************/
243
244#if 0 // YD see dirent.cxx
245BOOL createLongNameEA( const PCSZ pszPath, ULONG ulAttributes, const String& aLongName );
245sal_Bool createLongNameEA( const PCSZ pszPath, ULONG ulAttributes, const String& aLongName );
246
247FSysError DirEntry::MoveTo( const DirEntry& rDest ) const
248{
249 DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
250
251 DirEntry aTmpDest(rDest);
252 FileStat aTmpStat(aTmpDest);
253 if ( aTmpStat.IsKind(FSYS_KIND_DIR) )

--- 191 unchanged lines hidden (view full) ---

445*************************************************************************/
446
447struct _FSYS_FSQBUFFER
448{
449 FSQBUFFER2 aBuf;
450 UCHAR sBuf[256];
451};
452
246
247FSysError DirEntry::MoveTo( const DirEntry& rDest ) const
248{
249 DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
250
251 DirEntry aTmpDest(rDest);
252 FileStat aTmpStat(aTmpDest);
253 if ( aTmpStat.IsKind(FSYS_KIND_DIR) )

--- 191 unchanged lines hidden (view full) ---

445*************************************************************************/
446
447struct _FSYS_FSQBUFFER
448{
449 FSQBUFFER2 aBuf;
450 UCHAR sBuf[256];
451};
452
453BOOL FileStat::Update( const DirEntry& rDirEntry, BOOL bAccessRemovableDevice )
453sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bAccessRemovableDevice )
454{
455 nSize = 0;
456 FSysPathStyle eStyle = FSYS_STYLE_UNKNOWN;
457 aCreator.Erase();
458 aType.Erase();
459 aDateCreated = Date(0);
460 aTimeCreated = Time(0);
461 aDateModified = Date(0);

--- 137 unchanged lines hidden (view full) ---

599 {
600 aDateAccessed = aDateModified;
601 aTimeAccessed = aTimeModified;
602 }
603
604 return TRUE;
605}
606
454{
455 nSize = 0;
456 FSysPathStyle eStyle = FSYS_STYLE_UNKNOWN;
457 aCreator.Erase();
458 aType.Erase();
459 aDateCreated = Date(0);
460 aTimeCreated = Time(0);
461 aDateModified = Date(0);

--- 137 unchanged lines hidden (view full) ---

599 {
600 aDateAccessed = aDateModified;
601 aTimeAccessed = aTimeModified;
602 }
603
604 return TRUE;
605}
606
607BOOL IsRedirectable_Impl( const ByteString &rPath )
607sal_Bool IsRedirectable_Impl( const ByteString &rPath )
608{
609 if ( rPath.Len() >= 3 && ':' == rPath.GetBuffer()[1] )
610 {
611 ByteString aVolume = rPath.Copy( 0, 3 );
612 DriveMapItem &rItem = aDriveMap[toupper(aVolume.GetChar(0)) - 'A'];
613 return FSYS_KIND_FIXED != rItem.nKind;
614 }
615 return FALSE;
616}
617
618#if 0
608{
609 if ( rPath.Len() >= 3 && ':' == rPath.GetBuffer()[1] )
610 {
611 ByteString aVolume = rPath.Copy( 0, 3 );
612 DriveMapItem &rItem = aDriveMap[toupper(aVolume.GetChar(0)) - 'A'];
613 return FSYS_KIND_FIXED != rItem.nKind;
614 }
615 return FALSE;
616}
617
618#if 0
619BOOL IsRedirectable_Impl( const String &rPath )
619sal_Bool IsRedirectable_Impl( const String &rPath )
620{
621 if ( rPath.Len() >= 3 && ':' == rPath.GetStr()[1] )
622 {
623 DriveMapItem &rItem = aDriveMap[toupper(rPath[0]) - 'A'];
624 return FSYS_KIND_FIXED != rItem.nKind;
625 }
626 return FALSE;
627}

--- 10 unchanged lines hidden (view full) ---

638|* Letzte Aenderung MI 16.03.94
639|*
640*************************************************************************/
641
642const char* TempDirImpl( char *pBuf )
643{
644 PSZ pVar;
645 USHORT nRet;
620{
621 if ( rPath.Len() >= 3 && ':' == rPath.GetStr()[1] )
622 {
623 DriveMapItem &rItem = aDriveMap[toupper(rPath[0]) - 'A'];
624 return FSYS_KIND_FIXED != rItem.nKind;
625 }
626 return FALSE;
627}

--- 10 unchanged lines hidden (view full) ---

638|* Letzte Aenderung MI 16.03.94
639|*
640*************************************************************************/
641
642const char* TempDirImpl( char *pBuf )
643{
644 PSZ pVar;
645 USHORT nRet;
646 BOOL bAppendTemp = FALSE; // mu\s noch \\temp angeh"angt werden
646 sal_Bool bAppendTemp = FALSE; // mu\s noch \\temp angeh"angt werden
647
648 // Erstmal sehen, ob TEMP oder TMP gesetzt sind
649 nRet = DosScanEnv( (PSZ)"TEMP", &pVar );
650 if( nRet )
651 nRet = DosScanEnv( (PSZ)"temp", &pVar );
652 if( nRet )
653 nRet = DosScanEnv( (PSZ)"TMP", &pVar );
654 if( nRet )
655 nRet = DosScanEnv( (PSZ)"tmp", &pVar );
656 if( nRet )
657 nRet = DosScanEnv( (PSZ)"TMPDIR", &pVar );
658
659 // falls das geklappt hat, und ein Backslash dranhaengt,
660 // oder falls es bisher nicht geklappt hat,
661 // muessen wir nachher einen Backslash entfernen
647
648 // Erstmal sehen, ob TEMP oder TMP gesetzt sind
649 nRet = DosScanEnv( (PSZ)"TEMP", &pVar );
650 if( nRet )
651 nRet = DosScanEnv( (PSZ)"temp", &pVar );
652 if( nRet )
653 nRet = DosScanEnv( (PSZ)"TMP", &pVar );
654 if( nRet )
655 nRet = DosScanEnv( (PSZ)"tmp", &pVar );
656 if( nRet )
657 nRet = DosScanEnv( (PSZ)"TMPDIR", &pVar );
658
659 // falls das geklappt hat, und ein Backslash dranhaengt,
660 // oder falls es bisher nicht geklappt hat,
661 // muessen wir nachher einen Backslash entfernen
662 BOOL bRemoveBS = nRet || *(pVar+strlen(pVar)-1) == '\\';
662 sal_Bool bRemoveBS = nRet || *(pVar+strlen(pVar)-1) == '\\';
663
664 // Keine temp-Variable gefunden, dann gehen wir mal auf die Suche
665 // nach dem System-Laufwerk
666 if( nRet )
667 {
668 nRet = DosScanEnv( (PSZ)"USER_INI",&pVar );
669 bAppendTemp = (0 == nRet);
670 }

--- 114 unchanged lines hidden (view full) ---

785 ULONG nBufLen;
786 APIRET nRet;
787 USHORT nDrive;
788
789 // disable error-boxes for hard-errors
790 DosError(FERR_DISABLEHARDERR);
791
792 // determine number of floppy-drives
663
664 // Keine temp-Variable gefunden, dann gehen wir mal auf die Suche
665 // nach dem System-Laufwerk
666 if( nRet )
667 {
668 nRet = DosScanEnv( (PSZ)"USER_INI",&pVar );
669 bAppendTemp = (0 == nRet);
670 }

--- 114 unchanged lines hidden (view full) ---

785 ULONG nBufLen;
786 APIRET nRet;
787 USHORT nDrive;
788
789 // disable error-boxes for hard-errors
790 DosError(FERR_DISABLEHARDERR);
791
792 // determine number of floppy-drives
793 BYTE nFloppies;
793 PM_BYTE nFloppies;
794 nRet = DosDevConfig( (void*) &nFloppies, DEVINFO_FLOPPY );
795
796 // reset the map
797 for ( nDrive = 0; nDrive < 26; ++nDrive )
798 {
799 if ( nDrive < nFloppies )
800 {
801 aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE;

--- 5 unchanged lines hidden (view full) ---

807 aDriveMap[nDrive].nStyle = FSYS_STYLE_UNKNOWN;
808 }
809 }
810
811 // determine file-system via DosOpen/DocDevIOCtrl
812 for ( nDrive = 2; nDrive < 26; ++nDrive )
813 {
814 // open drive
794 nRet = DosDevConfig( (void*) &nFloppies, DEVINFO_FLOPPY );
795
796 // reset the map
797 for ( nDrive = 0; nDrive < 26; ++nDrive )
798 {
799 if ( nDrive < nFloppies )
800 {
801 aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE;

--- 5 unchanged lines hidden (view full) ---

807 aDriveMap[nDrive].nStyle = FSYS_STYLE_UNKNOWN;
808 }
809 }
810
811 // determine file-system via DosOpen/DocDevIOCtrl
812 for ( nDrive = 2; nDrive < 26; ++nDrive )
813 {
814 // open drive
815 BOOL bFixed;
815 sal_Bool bFixed;
816 HFILE nDevHandle;
817 char pDriveName[3] = "#:";
818 pDriveName[0] = nDrive+'a';
819 ULONG nAction;
820 nRet = DosOpen( (PSZ) pDriveName, &nDevHandle,
821 &nAction, 0, 0, OPEN_ACTION_OPEN_IF_EXISTS,
822 OPEN_FLAGS_DASD|OPEN_SHARE_DENYNONE|OPEN_ACCESS_READONLY,
823 0 );
824
825 // exists?
826 if ( !nRet )
827 {
828 // removeable?
816 HFILE nDevHandle;
817 char pDriveName[3] = "#:";
818 pDriveName[0] = nDrive+'a';
819 ULONG nAction;
820 nRet = DosOpen( (PSZ) pDriveName, &nDevHandle,
821 &nAction, 0, 0, OPEN_ACTION_OPEN_IF_EXISTS,
822 OPEN_FLAGS_DASD|OPEN_SHARE_DENYNONE|OPEN_ACCESS_READONLY,
823 0 );
824
825 // exists?
826 if ( !nRet )
827 {
828 // removeable?
829 BYTE nDriveId = nDrive;
829 PM_BYTE nDriveId = nDrive;
830 ULONG nParaOutLen, nDataOutLen;
831 nRet = DosDevIOCtl(nDevHandle, 8, 0x20,
832 &nDriveId, sizeof(nDriveId), &nParaOutLen,
833 &bFixed, sizeof(bFixed), &nDataOutLen );
834
835 // prepare the drive-map
836 if ( !nRet && !bFixed )
837 aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE;

--- 89 unchanged lines hidden (view full) ---

927|* DirEntry::IsCaseSensitive() const
928|*
929|* Beschreibung
930|* Ersterstellung TPF 26.02.1999
931|* Letzte Aenderung
932|*
933*************************************************************************/
934
830 ULONG nParaOutLen, nDataOutLen;
831 nRet = DosDevIOCtl(nDevHandle, 8, 0x20,
832 &nDriveId, sizeof(nDriveId), &nParaOutLen,
833 &bFixed, sizeof(bFixed), &nDataOutLen );
834
835 // prepare the drive-map
836 if ( !nRet && !bFixed )
837 aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE;

--- 89 unchanged lines hidden (view full) ---

927|* DirEntry::IsCaseSensitive() const
928|*
929|* Beschreibung
930|* Ersterstellung TPF 26.02.1999
931|* Letzte Aenderung
932|*
933*************************************************************************/
934
935BOOL DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const
935sal_Bool DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const
936{
937 if (eFormatter==FSYS_STYLE_HOST)
938 {
939 if (GetPathStyle(GetDevice().GetName()) == FSYS_STYLE_UNX)
940 {
941 return TRUE;
942 }
943 else
944 {
945 return FALSE;
946 }
947 }
948 else
949 {
936{
937 if (eFormatter==FSYS_STYLE_HOST)
938 {
939 if (GetPathStyle(GetDevice().GetName()) == FSYS_STYLE_UNX)
940 {
941 return TRUE;
942 }
943 else
944 {
945 return FALSE;
946 }
947 }
948 else
949 {
950 BOOL isCaseSensitive = FALSE; // ich bin unter OS2, also ist der default im Zweifelsfall case insensitiv
950 sal_Bool isCaseSensitive = FALSE; // ich bin unter OS2, also ist der default im Zweifelsfall case insensitiv
951 switch ( eFormatter )
952 {
953 case FSYS_STYLE_MAC:
954 case FSYS_STYLE_FAT:
955 case FSYS_STYLE_VFAT:
956 case FSYS_STYLE_NTFS:
957 case FSYS_STYLE_NWFS:
958 case FSYS_STYLE_HPFS:

--- 39 unchanged lines hidden (view full) ---

998 BigInt(aFSInfoBuf.cSectorUnit) );
999 rFreeBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnitAvail);
1000 rTotalBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnit);
1001 return 0;
1002}
1003
1004//=========================================================================
1005
951 switch ( eFormatter )
952 {
953 case FSYS_STYLE_MAC:
954 case FSYS_STYLE_FAT:
955 case FSYS_STYLE_VFAT:
956 case FSYS_STYLE_NTFS:
957 case FSYS_STYLE_NWFS:
958 case FSYS_STYLE_HPFS:

--- 39 unchanged lines hidden (view full) ---

998 BigInt(aFSInfoBuf.cSectorUnit) );
999 rFreeBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnitAvail);
1000 rTotalBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnit);
1001 return 0;
1002}
1003
1004//=========================================================================
1005
1006void FSysEnableSysErrorBox( BOOL bEnable )
1006void FSysEnableSysErrorBox( sal_Bool bEnable )
1007{
1008 DosError( bEnable ? 0 : FERR_DISABLEHARDERR );
1009}
1010
1007{
1008 DosError( bEnable ? 0 : FERR_DISABLEHARDERR );
1009}
1010