📄 macos.c
字号:
printf("\n Modified = %4d/%2d/%2d %2d:%2d:%2d ", MacTime.year, MacTime.month, MacTime.day, MacTime.hour, MacTime.minute, MacTime.second); SecondsToDate(mi->fpb.hFileInfo.ioFlBkDat, &MacTime); printf("\n Backup = %4d/%2d/%2d %2d:%2d:%2d ", MacTime.year, MacTime.month, MacTime.day, MacTime.hour, MacTime.minute, MacTime.second); if (!(mi->flags & EB_M3_FL_NOUTC)) { printf("\nGMT Offset of Creation time = %4ld sec %2d h", mi->Cr_UTCoffs, (int)mi->Cr_UTCoffs / (60 * 60)); printf("\nGMT Offset of Modification time = %4ld sec %2d h", mi->Md_UTCoffs, (int)mi->Md_UTCoffs / (60 * 60)); printf("\nGMT Offset of Backup time = %4ld sec %2d h", mi->Bk_UTCoffs, (int)mi->Bk_UTCoffs / (60 * 60)); } printf("\n\nFinder Flags : %s 0x%x %4d", sBit2Str(mi->MY_FNDRINFO.fdFlags), mi->MY_FNDRINFO.fdFlags, mi->MY_FNDRINFO.fdFlags); printf("\nFinder Icon Position = X: %4d", mi->MY_FNDRINFO.fdLocation.h); printf("\n Y: %4d", mi->MY_FNDRINFO.fdLocation.v); printf("\n\nText Encoding Base (System/MacZip) \"%s\"", PrintTextEncoding(mi->TextEncodingBase)); printf("\n%s\n", line);#undef MY_FNDRINFO}/*** Decode mac extra-field and assign the data to the structure***/static Boolean GetExtraFieldData(short *MacZipMode, MACINFO *mi){uch *ptr;int retval = PK_OK;ptr = scanMacOSexfield(G.extra_field, G.lrec.extra_field_length, MacZipMode);/* MacOS is no preemptive OS therefore do some (small) event-handling */UserStop();if (uO.J_flag) { *MacZipMode = UnKnown_EF; IgnoreEF_Macfilename = true; return false; }if (ptr != NULL){ /* Collect the data from the extra field buffer. */ mi->header = makeword(ptr); ptr += 2; mi->data = makeword(ptr); ptr += 2; switch (*MacZipMode) { case NewZipMode_EF: { mi->size = makelong(ptr); ptr += 4; mi->flags = makeword(ptr); ptr += 2; /* Type/Creator are always uncompressed */ mi->fpb.hFileInfo.ioFlFndrInfo.fdType = makePPClong(ptr); ptr += 4; mi->fpb.hFileInfo.ioFlFndrInfo.fdCreator = makePPClong(ptr); ptr += 4; if (!(mi->flags & EB_M3_FL_UNCMPR)) { retval = memextract(__G__ attrbuff, mi->size, ptr, mi->data - EB_MAC3_HLEN); if (retval != PK_OK) /* error uncompressing attributes */ { Info(slide, 0x201, ((char *)slide, LoadFarString(ErrUncmpEF))); *MacZipMode = UnKnown_EF; return false; /* EF-Block unusable, ignore it */ } } else { /* file attributes are uncompressed */ attrbuff = ptr; } DecodeMac3ExtraField(attrbuff, mi); return true; break; } case JohnnyLee_EF: { if (strncmp((char *)ptr, "JLEE", 4) == 0) { /* Johnny Lee's old MacZip e.f. was found */ attrbuff = ptr + 4; DecodeJLEEextraField(attrbuff, mi); return true; } else { /* second signature did not match, ignore EF block */ *MacZipMode = UnKnown_EF; return false; } break; } case TomBrownZipIt1_EF: case TomBrownZipIt2_EF: { if (strncmp((char *)ptr, "ZPIT", 4) == 0) { /* Johnny Lee's old MacZip e.f. was found */ attrbuff = ptr + 4; DecodeZPITextraField(attrbuff, mi); return true; } else { /* second signature did not match, ignore EF block */ *MacZipMode = UnKnown_EF; return false; } break; } default: { /* just to make sure */ *MacZipMode = UnKnown_EF; IgnoreEF_Macfilename = true; return false; break; } }} /* if (ptr != NULL) *//* no Mac extra field was found */return false;}/*** Assign the new Mac3 Extra-Field to the structure***/static void DecodeMac3ExtraField(ZCONST uch *buff, MACINFO *mi){ /* extra-field info of the new MacZip implementation */ /* compresssed extra-field starts here (if compressed) */Assert_it(buff, "", "");mi->fpb.hFileInfo.ioFlFndrInfo.fdFlags = makeword(buff); buff += 2;mi->fpb.hFileInfo.ioFlFndrInfo.fdLocation.v = makeword(buff); buff += 2;mi->fpb.hFileInfo.ioFlFndrInfo.fdLocation.h = makeword(buff); buff += 2;mi->fpb.hFileInfo.ioFlFndrInfo.fdFldr = makeword(buff); buff += 2;mi->fpb.hFileInfo.ioFlXFndrInfo.fdIconID = makeword(buff); buff += 2;mi->fpb.hFileInfo.ioFlXFndrInfo.fdReserved[0] = makeword(buff); buff += 2;mi->fpb.hFileInfo.ioFlXFndrInfo.fdReserved[1] = makeword(buff); buff += 2;mi->fpb.hFileInfo.ioFlXFndrInfo.fdReserved[2] = makeword(buff); buff += 2;mi->fpb.hFileInfo.ioFlXFndrInfo.fdScript = *buff; buff += 1;mi->fpb.hFileInfo.ioFlXFndrInfo.fdXFlags = *buff; buff += 1;mi->fpb.hFileInfo.ioFlXFndrInfo.fdComment = makeword(buff); buff += 2;mi->fpb.hFileInfo.ioFlXFndrInfo.fdPutAway = makelong(buff); buff += 4;mi->fpb.hFileInfo.ioFVersNum = *buff; buff += 1;mi->fpb.hFileInfo.ioACUser = *buff; buff += 1;/*This implementation does not use the 64 bit time values, thereforeuse the UT extra field instead*/if (mi->flags & EB_M3_FL_TIME64) { Info(slide, 0x201, ((char *)slide, LoadFarString(No64Time))); UseUT_ExtraField = true; buff += 24; /* jump over the date values */ }else { UseUT_ExtraField = false; mi->fpb.hFileInfo.ioFlCrDat = makelong(buff); buff += 4; mi->fpb.hFileInfo.ioFlMdDat = makelong(buff); buff += 4; mi->fpb.hFileInfo.ioFlBkDat = makelong(buff); buff += 4; }if (!(mi->flags & EB_M3_FL_NOUTC)) { mi->Cr_UTCoffs = makelong(buff); buff += 4; mi->Md_UTCoffs = makelong(buff); buff += 4; mi->Bk_UTCoffs = makelong(buff); buff += 4; }/* TextEncodingBase type & values *//* (values 0-32 correspond to the Script Codes defined in "Inside Macintosh", Text pages 6-52 and 6-53) */mi->TextEncodingBase = makeword(buff); buff += 2;if (mi->TextEncodingBase >= kTextEncodingUnicodeV1_1) { Info(slide, 0x201, ((char *)slide, LoadFarString(NoUniCode))); IgnoreEF_Macfilename = true; }mi->FullPath = (char *)buff; buff += strlen(mi->FullPath) + 1;mi->FinderComment = (char *)buff; buff += strlen(mi->FinderComment) + 1;if (uO.i_flag) IgnoreEF_Macfilename = true;}/*** Assign the new JLEE Extra-Field to the structure***/static void DecodeJLEEextraField(ZCONST uch *buff, MACINFO *mi){ /* extra-field info of Johnny Lee's old MacZip */Assert_it(buff, "", "");mi->fpb.hFileInfo.ioFlFndrInfo.fdType = makePPClong(buff); buff += 4;mi->fpb.hFileInfo.ioFlFndrInfo.fdCreator = makePPClong(buff); buff += 4;mi->fpb.hFileInfo.ioFlFndrInfo.fdFlags = makePPCword(buff); buff += 2;mi->fpb.hFileInfo.ioFlFndrInfo.fdLocation.v = makePPCword(buff); buff += 2;mi->fpb.hFileInfo.ioFlFndrInfo.fdLocation.h = makePPCword(buff); buff += 2;mi->fpb.hFileInfo.ioFlFndrInfo.fdFldr = makePPCword(buff); buff += 2;mi->fpb.hFileInfo.ioFlCrDat = makePPClong(buff); buff += 4;mi->fpb.hFileInfo.ioFlMdDat = makePPClong(buff); buff += 4;mi->flags = makePPClong(buff); buff += 4;newExtraField.fpb.hFileInfo.ioFlXFndrInfo.fdScript = smSystemScript;}/*** Assign the new JLEE Extra-Field to the structure***/static void DecodeZPITextraField(ZCONST uch *buff, MACINFO *mi){ /* extra-field info of Johnny Lee's old MacZip */unsigned char filelen;Assert_it(buff, "", "");#ifdef SwitchZIPITefSupportOffMacZipMode = UnKnown_EF;Info(slide, 0x221, ((char *)slide,LoadFarString(ZitIt_EF)));return;#endifif (MacZipMode == TomBrownZipIt1_EF) { filelen = *buff; newExtraField.filename = buff; buff += 1; buff += filelen; mi->fpb.hFileInfo.ioFlFndrInfo.fdType = makePPClong(buff); buff += 4; mi->fpb.hFileInfo.ioFlFndrInfo.fdCreator = makePPClong(buff); buff += 4; }else /* if (MacZipMode == TomBrownZipIt2_EF) */ { mi->fpb.hFileInfo.ioFlFndrInfo.fdType = makePPClong(buff); buff += 4; mi->fpb.hFileInfo.ioFlFndrInfo.fdCreator = makePPClong(buff); buff += 4; }newExtraField.fpb.hFileInfo.ioFlXFndrInfo.fdScript = smSystemScript;}/*** Return char* to describe the text encoding***/static char *PrintTextEncoding(short script){char *info;static char buffer[14];/* TextEncodingBase type & values *//* (values 0-32 correspond to the Script Codes defined in Inside Macintosh: Text pages 6-52 and 6-53 */switch (script) { /* Mac OS encodings*/ case kTextEncodingMacRoman: info = "Roman"; break; case kTextEncodingMacJapanese: info = "Japanese"; break; case kTextEncodingMacChineseTrad: info = "ChineseTrad"; break; case kTextEncodingMacKorean: info = "Korean"; break; case kTextEncodingMacArabic: info = "Arabic"; break; case kTextEncodingMacHebrew: info = "Hebrew"; break; case kTextEncodingMacGreek: info = "Greek"; break; case kTextEncodingMacCyrillic: info = "Cyrillic"; break; case kTextEncodingMacDevanagari: info = "Devanagari"; break; case kTextEncodingMacGurmukhi: info = "Gurmukhi"; break; case kTextEncodingMacGujarati: info = "Gujarati"; break; case kTextEncodingMacOriya: info = "Oriya"; break; case kTextEncodingMacBengali: info = "Bengali"; break; case kTextEncodingMacTamil: info = "Tamil"; break; case kTextEncodingMacTelugu: info = "Telugu"; break; case kTextEncodingMacKannada: info = "Kannada"; break; case kTextEncodingMacMalayalam: info = "Malayalam"; break; case kTextEncodingMacSinhalese: info = "Sinhalese"; break; case kTextEncodingMacBurmese: info = "Burmese"; break; case kTextEncodingMacKhmer: info = "Khmer"; break; case kTextEncodingMacThai: info = "Thai"; break; case kTextEncodingMacLaotian: info = "Laotian"; break; case kTextEncodingMacGeorgian: info = "Georgian"; break; case kTextEncodingMacArmenian: info = "Armenian"; break; case kTextEncodingMacChineseSimp: info = "ChineseSimp"; break; case kTextEncodingMacTibetan: info = "Tibetan"; break; case kTextEncodingMacMongolian: info = "Mongolian"; break; case kTextEncodingMacEthiopic: info = "Ethiopic"; break; case kTextEncodingMacCentralEurRoman: info = "CentralEurRoman"; break; case kTextEncodingMacVietnamese: info = "Vietnamese"; break; case kTextEncodingMacExtArabic: info = "ExtArabic"; break; case kTextEncodingUnicodeV1_1: info = "Unicode V 1.1"; break; case kTextEncodingUnicodeV2_0: info = "Unicode V 2.0"; break; default: { sprintf(buffer,"Code: 0x%x",(short) script); info = buffer; break; } }return info;}/*** Init Globals***/void MacGlobalsInit(__GPRO){newExtraField.FullPath = NULL;newExtraField.FinderComment = NULL;OpenZipFile = true;MacZipMode = UnKnown_EF;IgnoreEF_Macfilename = true;if (malloced_attrbuff == NULL) { /* make room for extra-field */ attrbuff = (uch *)malloc(EB_MAX_OF_VARDATA); if (attrbuff == NULL) { /* No memory to uncompress attributes */ Info(slide, 0x201, ((char *)slide, LoadFarString(OutOfMemEF))); exit(PK_MEM); } else { malloced_attrbuff = attrbuff; } }else { attrbuff = malloced_attrbuff; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -