STRPTR GetDefInterfaceName(int argc, char **argv) { struct DiskObject *dobj; struct WBStartup *wbs; struct WBArg *wbarg; STRPTR icname; STRPTR iname; if (argc == 0) { wbs = (struct WBStartup *)argv; wbarg = wbs->sm_ArgList; icname = wbarg[0].wa_Name; CurrentDir(wbarg[0].wa_Lock); } else icname = argv[0]; if( !(dobj = GetDiskObject(icname)) ) { CurrentDir(NULL); return(NULL); } iname = FindToolType(dobj->do_ToolTypes, "INTERFACE"); FreeDiskObject(dobj); CurrentDir(NULL); return(iname); }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) CyaSSL_Debugging_ON(); #endif if (CurrentDir("client") || CurrentDir("build")) ChangeDirBack(2); #ifdef HAVE_STACK_SIZE StackSizeCheck(&args, client_test); #else client_test(&args); #endif CyaSSL_Cleanup(); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif return args.return_code; }
eOSState cCMDDir::New(void) { MYDEBUG("Verzeichnis: Neu"); cFileInfo *info = new cFileInfo(CurrentDir()); if(!info->isWriteable()) { MYDEBUG("Verzeichnis: Neu: Keine Berechtigung in %s", CurrentDir()); OSD_ERRMSG(tr("no rights to create")); } else { State = csDirNew; SetCols(5); SetTitle(CurrentDir()); SetDir(); cMainMenuItem *mItem = (cMainMenuItem*)First(); Ins(new cMenuEditStrItem(tr("New"), Dir, MaxFileName, trVDR(FileNameChars)), true, mItem); while(mItem) { mItem->SetSelectable(false); mItem = (cMainMenuItem*)Next(mItem); } Display(); cOsdMenu::ProcessKey(kRight); } return osContinue; }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #ifdef DEBUG_CYASSL CyaSSL_Debugging_ON(); #endif if (CurrentDir("echoclient") || CurrentDir("build")) ChangeDirBack(2); echoclient_test(&args); CyaSSL_Cleanup(); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif return args.return_code; }
static int simulated_chdir(char *name) { int result = -1; BPTR lock = Lock(name, ACCESS_READ); if (lock != NULL) { /* Change the current working directory (CWD) of the task */ BPTR old_lock = CurrentDir(lock); /* Attempt to update internal buffer of the process. If we are not running in a process, but a plain task, this call does not cause any harm. */ /* FIXME: What's the result of SetCurrentDirName() in a plain task? If it is FALSE, the below code won't work. */ if (SetCurrentDirName(name)) { /* If this was successful, unlock `old_lock' because we are not going to restore it later; this routine is one of the few cases where such behavior is appropriate. */ UnLock(old_lock); result = 0; } else { /* If it fails, restore the previous CWD and make the whole routine fail. */ CurrentDir(old_lock); } } return result; }
int main(int argc, char** argv) { func_args args; #ifdef HAVE_CAVIUM int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) CyaSSL_Debugging_ON(); #endif if (CurrentDir("echoserver")) ChangeDirBack(2); else if (CurrentDir("Debug") || CurrentDir("Release")) ChangeDirBack(3); echoserver_test(&args); CyaSSL_Cleanup(); #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif return args.return_code; }
BOOL SwitchCurrentdir( STRPTR path, BPTR * where, BPTR * old ) { /* set the CurrentDir before extracting */ if((*where) == 0) { // the function wasn't used previously, lock then (*where) = Lock( path, SHARED_LOCK ); if(!(*where)) { PrintError("cannot lock selected drawer !?"); return FALSE; } (*old) = CurrentDir((*where)); } else { CurrentDir((*old)); UnLock((*where)); } return TRUE; }
/****************************************************************** Save the contents of a given mail *******************************************************************/ static void save_contents(struct Read_Data *data, struct mail *mail) { if (!mail->num_multiparts) { if (MUI_AslRequestTags(data->file_req, mail->filename?ASLFR_InitialFile:TAG_IGNORE,mail->filename, TAG_DONE)) { BPTR dlock; STRPTR drawer = data->file_req->fr_Drawer; mail_decode(mail); if ((dlock = Lock(drawer,ACCESS_READ))) { BPTR olock; BPTR fh; olock = CurrentDir(dlock); if ((fh = Open(data->file_req->fr_File, MODE_NEWFILE))) { Write(fh,mail->decoded_data,mail->decoded_len); Close(fh); } CurrentDir(olock); UnLock(dlock); } } } }
void RenameFile (const std::string& srcName, const std::string& dstName, const std::string& path, bool removeExisting) { if (srcName.empty()) throw error::InvalidParam("No source file name specified!", ERROR_LOCATION); else if (dstName.empty()) throw error::InvalidParam("No destination file name specified!", ERROR_LOCATION); const std::string srcPath((path.empty()) ? (CurrentDir() + "\\" + srcName) : (path + "\\" + srcName)); const std::string dstPath((path.empty()) ? (CurrentDir() + "\\" + dstName) : (path + "\\" + dstName)); MoveFile(srcPath, dstPath, removeExisting); }
ULONG NATDECLFUNC_5(GUI_Open, d0, ULONG, cpu, a0, UBYTE *, ProgramName, a1, struct WBArg *, IconName, a2, CONST_STRPTR, vstring, a6, struct DnetcLibrary *, LibBase) { DECLARG_5(d0, ULONG, cpu, a0, UBYTE *, ProgramName, a1, struct WBArg *, IconName, a2, CONST_STRPTR, vstring, a6, struct DnetcLibrary *, LibBase) ULONG sigmask; (void)ProgramName; (void)cpu; if (!LibBase->dobj) { if (IconName) { BPTR olddir; olddir = CurrentDir(IconName->wa_Lock); LibBase->dobj = GetDiskObject(IconName->wa_Name); CurrentDir(olddir); } } sigmask = 0; ObtainSemaphore(&LibBase->SemaphoreGUI); if (!LibBase->App) { Object *app; strcpy(LibBase->Version, vstring); app = NewObjectA(LibBase->AppMCC->mcc_Class, NULL, NULL); if (app) { LibBase->App = app; LibBase->OwnerTask = FindTask(NULL); DoMethod(app, MUIM_MyApplication_OpenMainWindow); sigmask = 0xffff0000; } } ReleaseSemaphore(&LibBase->SemaphoreGUI); return sigmask; }
bool FileEnumerator::MoveNext() { bool result = false; if (!m_StartupDir.empty()) { if (m_CurrentNonRecursiveEnumerator == NULL) m_CurrentNonRecursiveEnumerator = new NonRecursiveFileEnumerator(NULL, m_StartupDir.c_str()); // Enter directory if mode is recursive if ((m_Flags & DIRENUM_RECURSIVE_MODE) != 0 && !m_CurrentNonRecursiveEnumerator->Bof() && !m_CurrentNonRecursiveEnumerator->Eof() && IsDir(CurrentPath())) { //std::string s = m_EntriesEnumerator->StartupDir(); std::string s = JoinPath(CurrentDir(), m_CurrentNonRecursiveEnumerator->CurrentFileName()); m_CurrentNonRecursiveEnumerator = new NonRecursiveFileEnumerator(m_CurrentNonRecursiveEnumerator, s.c_str()); } // Find next entry result = m_CurrentNonRecursiveEnumerator->MoveNext(); while (!result && m_CurrentNonRecursiveEnumerator->Parent() != NULL) { // Go to the parent directory NonRecursiveFileEnumerator* p = m_CurrentNonRecursiveEnumerator; m_CurrentNonRecursiveEnumerator = p->Parent(); delete p; result = m_CurrentNonRecursiveEnumerator->MoveNext(); } m_Flags &= ~DIRENUM_CURRENT_CACHED; } return result; }
void cCMDMove::Build(char *dir) { MYDEBUG("Verzeichnis: Move: Erstelle Verzeichnisliste: %s", dir); if(!dir) dir = CurrentDir(); Clear(); cDirHandling *DirHand = new cDirHandling(this, this); SetCurrent(Get(DirHand->Build(dir, true))); delete(DirHand); if(Count()) { cMainMenuItem *item = (cMainMenuItem*)First(); while(item) { if(!strcasecmp(item->FileName(), File)) { Del(item->Index()); break; } item = (cMainMenuItem*)Next(item); } } Display(); SetHelp(); }
void __exitcommandline(void) { struct WBStartup *wbs=_WBenchMsg; if (wbs!=NULL) { BPTR file; if((file=window)!=0) { SelectOutput(output); SelectInput(input); PPCClose(file); } if(wbs->sm_ArgList!=NULL) { // set original lock UnLock(CurrentDir(cd)); } } else { char *cl=cline; if(cl!=NULL) { char **av=__argv; if(av!=NULL) { PPCFreeVec(av); } PPCFreeVec(cl); } } }
//------------------------------------------------------------- // Pre : If bCreateIntermediates is TRUE, create all eventually // missing parent directories too // Post : Return TRUE on success // Task : Create new directory //------------------------------------------------------------- bool CPath::DirectoryCreate(bool bCreateIntermediates /*= TRUE*/) { std::string PathText; bool bSuccess; GetDriveDirectory(PathText); StripTrailingBackslash(PathText); bSuccess =::CreateDirectory(PathText.c_str(),NULL) != 0; if(!bSuccess) { CPath CurrentDir(CPath::CURRENT_DIRECTORY); bSuccess = ChangeDirectory() != 0; CurrentDir.ChangeDirectory(); } if(!bSuccess && bCreateIntermediates) { std::string::size_type nDelimiter =PathText.rfind(DIRECTORY_DELIMITER); if(nDelimiter == std::string::npos) return FALSE; PathText.resize(nDelimiter + 1); CPath SubPath(PathText); if (SubPath.DirectoryCreate()) return DirectoryCreate(false); else return FALSE; } return bSuccess; }
/* This function changes the current directory to the wolfssl root */ static void ChangeDirToRoot(void) { /* Normal Command Line=_build, Visual Studio=testsuite */ if (CurrentDir("testsuite") || CurrentDir("_build")) { ChangeDirBack(1); } /* Xcode: To output application to correct location: */ /* 1. Xcode->Preferences->Locations->Locations */ /* 2. Derived Data Advanced -> Custom */ /* 3. Relative to Workspace, Build/Products */ /* Build/Products/Debug or Build/Products/Release */ else if (CurrentDir("Debug") || CurrentDir("Release")) { ChangeDirBack(5); } }
void __exitcommandline(void) { struct WBStartup *wbs=_WBenchMsg; if(wbs!=NULL) { BPTR file; if((file=window)!=0l) Close(file); if(wbs->sm_ArgList!=NULL) /* set original lock */ UnLock(CurrentDir(cd)); }else { char *cl=cline; if(cl!=NULL) { char **av=__argv; if(av!=NULL) { if(*av!=NULL) FreeVec(*av); FreeVec(av); } FreeVec(cl); } } }
bool removeDirectoryRecursively(const QString& Path) { bool Res = true; QDir CurrentDir(Path); if (CurrentDir.exists(Path)) { for (QFileInfo Info : CurrentDir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) { if (Info.isDir()) { Res = removeDirectoryRecursively(Info.absoluteFilePath()); } else { Res = QFile::remove(Info.absoluteFilePath()); } if (!Res) { return Res; } } Res = CurrentDir.rmdir(Path); } return Res; }
const char *Q_FindFirstFile (const char *path, const char *pattern) { BPTR newdir; if (apath) COM_Error ("FindFirst without FindClose"); apath = (struct AnchorPath *) AllocVec (sizeof(struct AnchorPath) + PATH_SIZE, MEMF_CLEAR); if (!apath) return NULL; apath->ap_Strlen = PATH_SIZE; apath->ap_BreakBits = 0; apath->ap_Flags = 0; /* APF_DOWILD */ newdir = Lock((const STRPTR) path, SHARED_LOCK); if (newdir) oldcurrentdir = CurrentDir(newdir); else { FreeVec(apath); apath = NULL; return NULL; } pattern_str = pattern_helper (pattern); if (MatchFirst((const STRPTR) pattern_str, apath) == 0) { if (apath->ap_Info.fib_DirEntryType < 0) return (const char *) (apath->ap_Info.fib_FileName); } return Q_FindNextFile(); }
eOSState cCMDDir::Edit(cMainMenuItem *mItem) { MYDEBUG("Verzeichnis: Edit: %s", mItem->FileName()); cFileInfo *info = new cFileInfo(mItem->FileName()); if(!info->isWriteable()) { DELETENULL(info); info = new cFileInfo(CurrentDir()); if(!info->isWriteable()) { MYDEBUG("Verzeichnis: Edit: Keine Rechte"); OSD_ERRMSG(tr("no rights to rename")); DELETENULL(info); return osContinue; } } DELETENULL(info); info = new cFileInfo(mItem->FileName()); SetDir(info->FileName()); DELETENULL(info); State = csDirEdit; SetCols(11); SetTitle(CurrentDir()); cMainMenuItem *dmItem = NULL; mItem = (cMainMenuItem*)First(); while(mItem) { if(!strcasecmp(mItem->FileName(), LastSelDir())) { MYDEBUG("Verzeichnis: Edit: Item gefunden: %s", mItem->FileName()); Ins(new cMenuEditStrItem(tr("Rename"), Dir, MaxFileName, trVDR(FileNameChars)), true, mItem); dmItem = mItem; } mItem->SetSelectable(false); mItem = (cMainMenuItem*)Next(mItem); } if(dmItem) Del(dmItem->Index()); Display(); cOsdMenu::ProcessKey(kRight); return osContinue; }
eOSState cCMDMove::ProcessKey(eKeys Key) { cMainMenuItem *mItem = (cMainMenuItem*)Get(Current()); cDirHandling *DirHand = NULL; cFileMoveThread *move = NULL; switch(Key) { case kUp: case kUp|k_Repeat: case kDown: case kDown|k_Repeat: cOsdMenu::ProcessKey(Key); SetHelp(); mItem = (cMainMenuItem*)Get(Current()); if(mItem) LastSelDir(mItem->FileName()); return osContinue; break; case kOk: DirHand = new cDirHandling(this, this); DirHand->ProcessKey(mItem); DELETENULL(DirHand); Build(); break; case kBlue: MYDEBUG("Verzeichnis: Move: Verschiede in: %s", CurrentDir()); move = new cFileMoveThread(File, CurrentDir()); if(move->OK()) { MYDEBUG("Verzeichnis: Move: Erfolgreich"); move->Start(); cCondWait::SleepMs(1 * 500); OsdObject->SetState(mmsReInit); } else DELETENULL(move); if(!Dir && !Direct) cRemote::Put(kBack); return osBack; break; default: break; } return cOsdMenu::ProcessKey(Key); }
void myexit() { if (XSaveLockValid) { CurrentDir(XSaveLock); XSaveLockValid = 0; } }
TempCurrentDir::TempCurrentDir(const char* dir) { if (!IsEmpty(dir)) { m_SavedDir = CurrentDir(); SetCurrentDir(dir); } }
const char* FileEnumerator::CurrentPath() { if ((m_Flags & DIRENUM_CURRENT_CACHED) == 0) { m_Current = JoinPath(CurrentDir(), CurrentFileName()); m_Flags |= DIRENUM_CURRENT_CACHED; } return m_Current.c_str(); }
void __initchdir(void) { BPTR fl; if (!(fl=Lock("",SHARED_LOCK))) exit(20); oldlock=CurrentDir(fl); havelock=1; }
// Delete any temporary files void delete_temp_files(struct DateStamp *last) { struct AnchorPath *anchor; BPTR old,lock; // Lock T: and cd if ((lock=Lock("t:",ACCESS_READ))) { // CD to t: old=CurrentDir(lock); // Allocate an anchor if ((anchor=AllocVec(sizeof(struct AnchorPath),MEMF_CLEAR))) { short error; struct FileInfoBlock fibcopy; // See if any script files already exist error=MatchFirst("T:dopus#?tmp#?",anchor); while (!error) { // Copy fib fibcopy=anchor->ap_Info; // Get next error=MatchNext(anchor); // Check datestamp if (!last || CompareDates(&fibcopy.fib_Date,last)>=0) { // Try to delete file DeleteFile(fibcopy.fib_FileName); } } // Cleanup anchor MatchEnd(anchor); FreeVec(anchor); } UnLock(CurrentDir(old)); } }
int main(int argc, char** argv) { func_args args; StartTCP(); args.argc = argc; args.argv = argv; CyaSSL_Init(); #ifdef DEBUG_CYASSL CyaSSL_Debugging_ON(); #endif if (CurrentDir("echoclient") || CurrentDir("build")) ChangeDirBack(2); echoclient_test(&args); CyaSSL_Cleanup(); return args.return_code; }
int unit_test(int argc, char** argv) { int ret; (void)argc; (void)argv; printf("starting unit tests...\n"); #ifdef HAVE_CAVIUM ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) err_sys("Cavium OpenNitroxDevice failed"); #endif /* HAVE_CAVIUM */ #ifndef WOLFSSL_TIRTOS if (CurrentDir("tests") || CurrentDir("_build")) ChangeDirBack(1); else if (CurrentDir("Debug") || CurrentDir("Release")) ChangeDirBack(3); #endif ApiTest(); if ( (ret = HashTest()) != 0){ printf("hash test failed with %d\n", ret); return ret; } #ifndef SINGLE_THREADED if ( (ret = SuiteTest()) != 0){ printf("suite test failed with %d\n", ret); return ret; } #endif #ifdef HAVE_CAVIUM CspShutdown(CAVIUM_DEV_ID); #endif return 0; }
int main(int argc, char** argv) { func_args server_args; server_args.argc = argc; server_args.argv = argv; if (CurrentDir("testsuite") || CurrentDir("_build")) ChangeDirBack(1); else if (CurrentDir("Debug") || CurrentDir("Release")) ChangeDirBack(3); /* Xcode->Preferences->Locations->Locations*/ /* Derived Data Advanced -> Custom */ /* Relative to Workspace, Build/Products */ /* Debug or Release */ ctaocrypt_test(&server_args); if (server_args.return_code != 0) return server_args.return_code; printf("\nAll tests passed!\n"); return EXIT_SUCCESS; }
void Q_FindClose (void) { if (apath == NULL) return; MatchEnd(apath); FreeVec(apath); UnLock(CurrentDir(oldcurrentdir)); oldcurrentdir = 0; apath = NULL; free (pattern_str); pattern_str = NULL; }
void UBTDecorator_KeepInCone::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) { TNodeInstanceMemory* DecoratorMemory = reinterpret_cast<TNodeInstanceMemory*>(NodeMemory); FVector CurrentDir(1.0f, 0, 0); if (CalculateCurrentDirection(OwnerComp, CurrentDir)) { const float Angle = DecoratorMemory->InitialDirection.CosineAngle2D(CurrentDir); if (Angle < ConeHalfAngleDot || (IsInversed() && Angle > ConeHalfAngleDot)) { OwnerComp.RequestExecution(this); } } }