⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 executable.cc

📁 This Source-Navigator, an IDE for C/C++/Fortran/Java/Tcl/PHP/Python and a host of other languages.
💻 CC
字号:
// $Header: /cvsroot/sourcenav/src/snavigator/demo/c++_demo/glish/Executable.cc,v 1.1.1.1 2002/04/18 23:35:24 mdejong Exp $#include "system.h"#include <stdio.h>#include <string.h>#include <osfcn.h>#include <sys/file.h>#include "Executable.h"#ifdef HAVE_UNISTD_H#include <unistd.h>#endifextern "C" {char* getenv( const char* );char* strdup( const char* );}Executable::Executable( const char* arg_executable )	{	executable = strdup( arg_executable );	exec_error = has_exited = 0;	}Executable::~Executable()	{	delete executable;	}char* which_executable( const char* exec_name )	{	char* path = getenv( "PATH" );	if ( ! path || exec_name[0] == '/' || exec_name[0] == '.' )		{		if ( access( exec_name, X_OK ) == 0 )			return strdup( exec_name );		else			return 0;		}	char directory[1024];	char* dir_beginning = path;	char* dir_ending = path;	while ( *dir_beginning )		{		while ( *dir_ending && *dir_ending != ':' )			++dir_ending;		int hold_char = *dir_ending;		if ( hold_char )			*dir_ending = '\0';		sprintf( directory, "%s/%s", dir_beginning, exec_name );		if ( hold_char )			*(dir_ending++) = hold_char;		if ( access( directory, X_OK ) == 0 )			return strdup( directory );		dir_beginning = dir_ending;		}	return 0;	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -