#pragma once #define lm_strerror_dup() strdup(lm_strerror()) typedef enum lm_error { LM_ERR_NoError = 0, LM_ERR_URLBadChar = 1, LM_ERR_URLBadProtocol = 2, LM_ERR_URLTooLarge = 3, LM_ERR_URLHostLarge = 4, LM_ERR_URLPathLarge = 5, LM_ERR_URLBadHost = 6, LM_ERR_URLBadPort = 7, LM_ERR_URLBadPath = 8, LM_ERR_URLPortUnknown = 9, LM_ERR_BadPort = 10, LM_ERR_BadHost = 11, LM_ERR_PoolNoSupport = 12, LM_ERR_URLEnd = 13, LM_ERR_MPTPBadVersion = 14, LM_ERR_MPTPBadCode = 15, LM_ERR_MPTPBadUrl = 16, LM_ERR_MPTPHostFail = 17, LM_ERR_MPTPSocketFail = 18, LM_ERR_MPTPConnectFail = 19, LM_ERR_MPTPRecvFail = 20, LM_ERR_MPTPSendFail = 21, LM_ERR_MPTPBadData = 22, LM_ERR_MPTPBadHost = 23, LM_ERR_MPTPSetsockopt = 24, LM_ERR_MPTPTimeout = 25, LM_ERR_MPTPBindFail = 26, LM_ERR_ArgNULL = 27, LM_ERR_MPTPNotResponse = 28, LM_ERR_MPTPNotRequest = 29, LM_ERR_MPTPNotLast = 30, LM_ERR_NoPort = 31, LM_ERR_PoolInfoBad = 32, LM_ERR_ArcWBlockFail = 33, LM_ERR_ArcRBlockFail = 34, LM_ERR_ArcOpenFail = 35, LM_ERR_ArcWHeaderFail = 36, LM_ERR_ArcWEntryFail = 37, LM_ERR_ArcNewFail = 38, LM_ERR_ArcNextHeaderFail = 39, LM_ERR_GetCwdFail = 39, LM_ERR_PoolListDirFail = 40, LM_ERR_PoolListCantRead = 41, LM_ERR_PoolInfoCantRead = 42, LM_ERR_PkgBadName = 43, LM_ERR_PkgDataBad = 44, LM_ERR_CtxDataNULL = 45, LM_ERR_CtxTempFail = 46, LM_ERR_CtxRootFail = 49, LM_ERR_CtxDataFail = 54, LM_ERR_ArcRealpathFail = 55, LM_ERR_PoolTestNotPong = 56, LM_ERR_PkgPathsEmpty = 57, LM_ERR_SendOpenFail = 58, LM_ERR_RecvDelFail = 59, LM_ERR_RecvOpenFail = 60, LM_ERR_RecvBadCode = 61, LM_ERR_RecvWriteFail = 62, LM_ERR_PkgNotFound = 63, LM_ERR_DbCantAccess = 64, LM_ERR_DbSqlOpenFail = 65, LM_ERR_DbSqlCreateFail = 66, LM_ERR_DbSqlPrepareFail = 67, LM_ERR_DbSqlInsertFail = 68, LM_ERR_PkgGPGFail = 69, LM_ERR_PkgGPGSigFail = 70, LM_ERR_PkgGPGArchiveFail = 71, LM_ERR_PkgSigNoMatch = 72, LM_ERR_PkgSigNoResult = 73, LM_ERR_PoolPathsEmpty = 74, LM_ERR_PoolNotAvailable = 75, LM_ERR_PoolUrlEmpty = 76, LM_ERR_PoolBadDir = 77, LM_ERR_PoolBadPaths = 78, LM_ERR_DbFilesNotFound = 79, LM_ERR_DbFilesOpenFail = 80, LM_ERR_DbFilesDirFail = 81, LM_ERR_DbFilesUnlinkFail = 82, LM_ERR_DbFilesRenameFail = 83, LM_ERR_DbKeepsNotFound = 84, LM_ERR_DbKeepsOpenFail = 85, LM_ERR_DbKeepsDirFail = 86, LM_ERR_DbKeepsUnlinkFail = 87, LM_ERR_DbSqlNotFound = 88, LM_ERR_DependNotFound = 89, LM_ERR_InstallDownloadFail = 90, LM_ERR_PkgNotDownloaded = 91, LM_ERR_PkgRemoveDownloadFail = 92, LM_ERR_CtxTempNULL = 93, LM_ERR_CtxRootNULL = 94, LM_ERR_DstOpenFail = 95, LM_ERR_SrcOpenFail = 96, LM_ERR_DstWriteFail = 97, LM_ERR_CtxTempFailMkdir = 98, LM_ERR_PkgBadArchive = 99, LM_ERR_PkgDataNotMatch = 100, LM_ERR_PkgChangesUpdateFail = 101, LM_ERR_PkgHashesOpenFail = 102, LM_ERR_PkgNoPool = 103, LM_ERR_DbChangesUnlinkFail = 104, LM_ERR_SendStatFail = 105, LM_ERR_SendSnprintfFail = 106, LM_ERR_SendReadFail = 107, LM_ERR_RecvBadSize = 108, LM_ERR_RecvNotCompleted = 109, LM_ERR_DbSqlSelectFail = 110, LM_ERR_DbSqlDeleteFail = 111, LM_ERR_ExtractStatFail = 112, LM_ERR_PkgFilesAddFail = 113, LM_ERR_PkgExtractFilesFail = 114, LM_ERR_PkgDatabaseAddFail = 115, LM_ERR_PkgAlreadyInstalled = 116, LM_ERR_PkgNotInstalled = 117, LM_ERR_PkgFileUnlinkFail = 118, LM_ERR_PkgDatabaseDelFail = 119, LM_ERR_PkgFilesDelFail = 119, LM_ERR_PkgChangesDelFail = 120, LM_ERR_InstallCwdFail = 121, LM_ERR_InstallRootChdirFail = 122, LM_ERR_InstallSpawnFail = 123, LM_ERR_InstallBackChdirFail = 124, LM_ERR_InstallStatusFail = 125, LM_ERR_InstallRunFail = 126, LM_ERR_PkgBreaks = 127, LM_ERR_PkgUpToDate = 128, LM_ERR_HashOpenFail = 129, LM_ERR_HashDigestFail = 130, LM_ERR_FileHashFail = 131, LM_ERR_FileHashNoMatch = 132, LM_ERR_InfoNotLoaded = 133, LM_ERR_NoPools = 134, LM_ERR_DbChangesNotExists = 135, LM_ERR_DbChangesChmodFail = 136, LM_ERR_InstallDirFail = 137, LM_ERR_InstallSaveFail = 138, LM_ERR_FailMkdir = 139, LM_ERR_NotDir = 140, LM_ERR_NoRead = 141, LM_ERR_PoolListBadDir = 142, LM_ERR_FileNotExist = 143, LM_ERR_FileNotLink = 144, LM_ERR_ArchiveSetFail = 145, LM_ERR_ChdirFail = 146, LM_ERR_ExtractRootChdirFail = 147, LM_ERR_ExtractOldChdirFail = 148, LM_ERR_MPTPAcceptFail = 149, LM_ERR_MPTPListenFail = 150, LM_ERR_PoolInfoBadName = 151, LM_ERR_PoolInfoUnknown = 152, LM_ERR_MPTPBadPath = 153, LM_ERR_UnknownThread = 154, LM_ERR_PkgBadVersion = 155, LM_ERR_PkgDataMissing = 156, LM_ERR_PoolListDataFail = 157, LM_ERR_PoolListAddFail = 158, } lm_error_t; typedef struct lm_error_desc { lm_error_t code; char *desc; } lm_error_desc_t; void lm_error_set(lm_error_t code, ...); void lm_error_clear(); void lm_error_init(); lm_error_t lm_error(); char *lm_strerror(); extern lm_error_t lm_error_code; extern char *lm_error_str;