本文整理汇总了C++中setpath函数的典型用法代码示例。如果您正苦于以下问题:C++ setpath函数的具体用法?C++ setpath怎么用?C++ setpath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setpath函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: luaopen_package
LUALIB_API int luaopen_package(lua_State *L)
{
int i;
int noenv;
luaL_newmetatable(L, "_LOADLIB");
lj_lib_pushcf(L, lj_cf_package_unloadlib, 1);
lua_setfield(L, -2, "__gc");
luaL_register(L, LUA_LOADLIBNAME, package_lib);
lua_pushvalue(L, -1);
lua_replace(L, LUA_ENVIRONINDEX);
lua_createtable(L, sizeof(package_loaders)/sizeof(package_loaders[0])-1, 0);
for (i = 0; package_loaders[i] != NULL; i++) {
lj_lib_pushcf(L, package_loaders[i], 1);
lua_rawseti(L, -2, i+1);
}
lua_setfield(L, -2, "loaders");
lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
noenv = lua_toboolean(L, -1);
lua_pop(L, 1);
setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT, noenv);
setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT, noenv);
lua_pushliteral(L, LUA_PATH_CONFIG);
lua_setfield(L, -2, "config");
luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 16);
lua_setfield(L, -2, "loaded");
luaL_findtable(L, LUA_REGISTRYINDEX, "_PRELOAD", 4);
lua_setfield(L, -2, "preload");
lua_pushvalue(L, LUA_GLOBALSINDEX);
luaL_register(L, NULL, package_global);
lua_pop(L, 1);
return 1;
}
开发者ID:qyqx,项目名称:BerryBots,代码行数:32,代码来源:lib_package.c
示例2: luaopen_package
LUAMOD_API int luaopen_package (lua_State *L) {
/* create table CLIBS to keep track of loaded C libraries */
luaL_getsubtable(L, LUA_REGISTRYINDEX, CLIBS);
lua_createtable(L, 0, 1); /* metatable for CLIBS */
lua_pushcfunction(L, gctm);
lua_setfield(L, -2, "__gc"); /* set finalizer for CLIBS table */
lua_setmetatable(L, -2);
/* create `package' table */
luaL_newlib(L, pk_funcs);
createsearcherstable(L);
#if defined(LUA_COMPAT_LOADERS)
lua_pushvalue(L, -1); /* make a copy of 'searchers' table */
lua_setfield(L, -3, "loaders"); /* put it in field `loaders' */
#endif
lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */
/* set field 'path' */
setpath(L, "path", LUA_PATHVERSION, LUA_PATH, LUA_PATH_DEFAULT);
/* set field 'cpath' */
setpath(L, "cpath", LUA_CPATHVERSION, LUA_CPATH, LUA_CPATH_DEFAULT);
/* store config information */
lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n"
LUA_EXEC_DIR "\n" LUA_IGMARK "\n");
lua_setfield(L, -2, "config");
/* set field `loaded' */
luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
lua_setfield(L, -2, "loaded");
/* set field `preload' */
luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
lua_setfield(L, -2, "preload");
lua_pushglobaltable(L);
lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */
luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */
lua_pop(L, 1); /* pop global table */
return 1; /* return 'package' table */
}
开发者ID:alucard-dracula,项目名称:yggdrasil,代码行数:35,代码来源:loadlib.c
示例3: ngx_http_lua_new_state
lua_State *
ngx_http_lua_new_state(ngx_conf_t *cf, ngx_http_lua_main_conf_t *lmcf)
{
lua_State *L = luaL_newstate();
if(L == NULL) {
return NULL;
}
luaL_openlibs(L);
lua_getglobal(L, "package");
if (! lua_istable(L, -1)) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"the \"package\" table does not exist");
return NULL;
}
if (lmcf->lua_path.len != 0) {
const char *old_path;
const char *new_path;
lua_getfield(L, -1, "path"); /* get original package.path */
old_path = lua_tostring(L, -1);
lua_pushlstring(L, (char *) lmcf->lua_path.data, lmcf->lua_path.len);
new_path = lua_tostring(L, -1);
setpath(L, -3, "path", new_path, old_path);
lua_pop(L, 2);
}
if (lmcf->lua_cpath.len != 0) {
const char *old_cpath;
const char *new_cpath;
lua_getfield(L, -1, "cpath"); /* get original package.cpath */
old_cpath = lua_tostring(L, -1);
lua_pushlstring(L, (char *) lmcf->lua_cpath.data, lmcf->lua_cpath.len);
new_cpath = lua_tostring(L, -1);
setpath(L, -3, "cpath", new_cpath, old_cpath);
lua_pop(L, 2);
}
lua_remove(L, -1); /* remove the "package" table */
init_ngx_lua_registry(L);
init_ngx_lua_globals(L);
return L;
}
开发者ID:farcaller,项目名称:lua-nginx-module,代码行数:56,代码来源:ngx_http_lua_util.c
示例4: getlistevalue
char *iscommande(t_env **env, char *cmd)
{
char *path;
char **tab_path;
int freepath;
char *value;
freepath = 0;
path = NULL;
value = NULL;
tab_path = NULL;
path = getlistevalue(env, "PATH");
if (path)
tab_path = ft_strsplit(path, ':');
else
{
tab_path = setdefaultpath();
freepath = 1;
}
value = setpath(tab_path, cmd);
if (freepath == 0)
ft_freetab(tab_path);
else if (freepath == 1)
free(tab_path);
return (value);
}
开发者ID:gabkk,项目名称:monshell,代码行数:26,代码来源:pathexec.c
示例5: switch
int myclianttest::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: readyRead(); break;
case 1: bytesWritten((*reinterpret_cast< qint64(*)>(_a[1]))); break;
case 2: disconnected(); break;
case 3: list((*reinterpret_cast< QString(*)>(_a[1]))); break;
case 4: connected(); break;
case 5: test(); break;
case 6: mycomputer((*reinterpret_cast< QString(*)>(_a[1]))); break;
case 7: doubleClicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
case 8: doubleClickedServer((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
case 9: setpath((*reinterpret_cast< QString(*)>(_a[1]))); break;
case 10: getpath(); break;
case 11: servercomputer((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
case 12: serverfiledown((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
case 13: getserverpath(); break;
case 14: download(); break;
case 15: Serverclicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
case 16: gotomotherpath(); break;
case 17: gotoservermotherpath(); break;
default: ;
}
_id -= 18;
}
return _id;
}
开发者ID:dkithmal,项目名称:QtTcpClient,代码行数:31,代码来源:moc_myclianttest.cpp
示例6: luaopen_package
LUALIB_API int luaopen_package (lua_State *L) {
int i;
#if 0
/* create new type _LOADLIB */
luaL_newmetatable(L, "_LOADLIB");
lua_pushcfunction(L, gctm);
lua_setfield(L, -2, "__gc");
#endif
/* create `package' table */
luaL_register(L, LUA_LOADLIBNAME, pk_funcs);
#if 0
#if defined(LUA_COMPAT_LOADLIB)
lua_getfield(L, -1, "loadlib");
lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");
#endif
#endif
lua_pushvalue(L, -1);
lua_replace(L, LUA_ENVIRONINDEX);
/* create `loaders' table */
lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1);
/* fill it with pre-defined loaders */
for (i=0; loaders[i] != NULL; i++) {
lua_pushcfunction(L, loaders[i]);
lua_rawseti(L, -2, i+1);
}
lua_setfield(L, -2, "loaders"); /* put it in field `loaders' */
#if 0
setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT); /* set field `path' */
setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */
/* store config information */
lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n"
LUA_EXECDIR "\n" LUA_IGMARK);
lua_setfield(L, -2, "config");
#endif
/* set field `loaded' */
luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 2);
lua_setfield(L, -2, "loaded");
/* set field `preload' */
lua_newtable(L);
lua_setfield(L, -2, "preload");
lua_pushvalue(L, LUA_GLOBALSINDEX);
luaL_register(L, NULL, ll_funcs); /* open lib into global table */
lua_pop(L, 1);
return 1; /* return 'package' table */
}
开发者ID:arne182,项目名称:chdk-eyefi,代码行数:45,代码来源:loadlib.c
示例7: luaopen_upackage
LUAMOD_API int luaopen_upackage(lua_State *L)
{
int i;
/* create new type _LOADLIB */
luaL_newmetatable(L, "_LOADLIB");
lua_pushcfunction(L, gctm);
lua_setfield(L, -2, "__gc");
/* create `package' table */
luaL_newlib(L, pk_funcs);
/* create 'searchers' table */
lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0);
/* fill it with pre-defined searchers */
for(i=0; searchers[i] != NULL; i++)
{
lua_pushvalue(L, -2); /* set 'package' as upvalue for all searchers */
lua_pushcclosure(L, searchers[i], 1);
lua_rawseti(L, -2, i+1);
}
#if defined(LUA_COMPAT_LOADERS)
lua_pushvalue(L, -1); /* make a copy of 'searchers' table */
lua_setfield(L, -3, "loaders"); /* put it in field `loaders' */
#endif
lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */
/* set field 'path' */
setpath(L, "path", LUA_PATHVERSION, LUA_PATH, LUA_PATH_DEFAULT);
/* set field 'cpath' */
setpath(L, "cpath", LUA_CPATHVERSION, LUA_CPATH, LUA_CPATH_DEFAULT);
/* store config information */
push_utf8_string(L, LUA_DIRSEP L"\n" LUA_PATH_SEP L"\n" LUA_PATH_MARK L"\n"
LUA_EXEC_DIR L"\n" LUA_IGMARK L"\n", -1);
lua_setfield(L, -2, "config");
/* set field `loaded' */
luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
lua_setfield(L, -2, "loaded");
/* set field `preload' */
luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
lua_setfield(L, -2, "preload");
lua_pushglobaltable(L);
lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */
luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */
lua_pop(L, 1); /* pop global table */
return 1; /* return 'package' table */
}
开发者ID:CyberShadow,项目名称:FAR,代码行数:45,代码来源:uloadlib52.c
示例8: pbap_reset_path
/* should only be called inside pbap_set_path */
static void pbap_reset_path(struct pbap_data *pbap)
{
GObex *obex = obc_session_get_obex(pbap->session);
if (!pbap->path)
return;
setpath(obex, pbap->path, 3, NULL, NULL);
}
开发者ID:Sork007,项目名称:obexd,代码行数:10,代码来源:pbap.c
示例9: luaopen_package
LUAMOD_API int luaopen_package (lua_State *L) {
createclibstable(L);
luaL_newlib(L, pk_funcs); /* create 'package' table */
createsearcherstable(L);
/* set paths */
setpath(L, "path", LUA_PATH_VAR, LUA_PATH_DEFAULT);
setpath(L, "cpath", LUA_CPATH_VAR, LUA_CPATH_DEFAULT);
/* store config information */
lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n"
LUA_EXEC_DIR "\n" LUA_IGMARK "\n");
lua_setfield(L, -2, "config");
/* set field 'loaded' */
luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
lua_setfield(L, -2, "loaded");
/* set field 'preload' */
luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);
lua_setfield(L, -2, "preload");
lua_pushglobaltable(L);
lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */
luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */
lua_pop(L, 1); /* pop global table */
return 1; /* return 'package' table */
}
开发者ID:AMDmi3,项目名称:widelands,代码行数:23,代码来源:loadlib.c
示例10: luaopen_package
LUAMOD_API int luaopen_package (lua_State *L) {
int i;
/* create new type _LOADLIB */
luaL_newmetatable(L, "_LOADLIB");
lua_pushcfunction(L, gctm);
lua_setfield(L, -2, "__gc");
/* create `package' table */
luaL_newlib(L, pk_funcs);
/* create `loaders' table */
lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);
/* fill it with pre-defined loaders */
for (i=0; loaders[i] != NULL; i++) {
lua_pushvalue(L, -2); /* set 'package' as upvalue for all loaders */
lua_pushcclosure(L, loaders[i], 1);
lua_rawseti(L, -2, i+1);
}
lua_setfield(L, -2, "loaders"); /* put it in field `loaders' */
/* set field 'path' */
setpath(L, "path", LUA_PATHVERSION, LUA_PATH, LUA_PATH_DEFAULT);
/* set field 'cpath' */
setpath(L, "cpath", LUA_CPATHVERSION, LUA_CPATH, LUA_CPATH_DEFAULT);
/* store config information */
lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n"
LUA_EXEC_DIR "\n" LUA_IGMARK "\n");
lua_setfield(L, -2, "config");
/* set field `loaded' */
luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED");
lua_setfield(L, -2, "loaded");
/* set field `preload' */
luaL_findtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
lua_setfield(L, -2, "preload");
lua_pushglobaltable(L);
lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */
luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */
lua_pop(L, 1); /* pop global table */
return 1; /* return 'package' table */
}
开发者ID:BackupTheBerlios,项目名称:rsxplusplus-svn,代码行数:37,代码来源:loadlib.c
示例11: pbap_set_path
static int pbap_set_path(struct pbap_data *pbap, const char *path)
{
GObex *obex = obc_session_get_obex(pbap->session);
if (!path)
return G_OBEX_RSP_BAD_REQUEST;
if (pbap->path != NULL && g_str_equal(pbap->path, path))
return 0;
if (!setpath(obex, path, 3, pbap_setpath_cb, pbap))
return G_OBEX_RSP_INTERNAL_SERVER_ERROR;
g_free(pbap->path);
pbap->path = g_strdup(path);
return G_OBEX_RSP_SUCCESS;
}
开发者ID:Sork007,项目名称:obexd,代码行数:18,代码来源:pbap.c
示例12: setpath
int Skin::load(char *name, bool quiet) {
char d[512];
setpath(name);
makepath(d,"colors.conf");
if (!Colors.load(d)) {
sprintf(d, "Skin[%s]: Cannot load colors.conf", name);
if (!quiet) MessageBox(NULL,d,"Error",MB_ICONERROR | MB_OK);
return 0;
}
SDL_Surface *s;
pngLoad("toolbar.png");
bmToolbar = new Bitmap( s , true );
pngLoad("load.png");
bmLoad = new Bitmap( s , true );
pngLoad("save.png");
bmSave = new Bitmap( s , true );
pngLoad("buttons.png");
bmButtons = new Bitmap( s , true );
pngLoad("about.png");
bmAbout = new Bitmap( s , true );
if (640 != CONSOLE_WIDTH && 480 != CONSOLE_HEIGHT) {
double xscale = (double)CONSOLE_WIDTH / 640;
double yscale = (double)CONSOLE_HEIGHT / 480;
Drawable ss( zoomSurface(bmAbout->surface, xscale, yscale ,SMOOTHING_ON) , false );
// S->copy(&ss,5,row(12));
SDL_FreeSurface( bmAbout->surface );
bmAbout->surface = ss.surface;
}
pngLoad("logo.png");
SDL_FreeSurface(s);
bmLogo = NULL;
makepath(d,"font.fnt");
if (font_load(d)) {
sprintf(d, "Skin[%s]: Cannot load font.fnt", name);
if (!quiet) MessageBox(NULL,d,"Error",MB_ICONERROR | MB_OK);
return 0;
}
return 1;
}
开发者ID:cmicali,项目名称:ztracker,代码行数:43,代码来源:skins.cpp
示例13: luaopen_fileio
int luaopen_fileio(lua_State *L, const char *parent) {
luaL_register(L, parent, fileiolib);
lua_pushcfunction(L, Lua_FS_dofile);
lua_setglobal(L, "dofile");
/* insert the custom PhysFS loader into the loaders table */
lua_getglobal(L, "table");
lua_getfield(L, -1, "insert");
lua_remove(L, -2);
lua_getglobal(L, "package");
lua_getfield(L, -1, "loaders");
lua_remove(L, -2);
lua_pushinteger(L, 2);
lua_pushcfunction(L, loader_PhysFS);
lua_call(L, 3, 0);
/* set field `scrupppath' */
lua_getglobal(L, "package");
setpath(L, "scrupppath", SCRUPP_PATH, SCRUPP_PATH_DEFAULT);
lua_remove(L, -1);
return 1;
}
开发者ID:scriptum,项目名称:Engine,代码行数:24,代码来源:FileIO.c
示例14: setpath
Obstacle::Obstacle(SDL_Rect rect)
{
setpath(rect);
setpath2(rect);
setobstacle(rect);
}
开发者ID:FauxpointGuillaume,项目名称:Jeux-pour-yaourt,代码行数:6,代码来源:Obstacle.cpp
示例15: dosetpath
/*ARGSUSED*/
void
dosetpath(Char **arglist, struct command *c)
{
extern char *getenv();
Char **pathvars, **cmdargs;
char **spaths, **cpaths, **cmds;
char *tcp;
unsigned int npaths, ncmds;
int i, sysflag;
pintr_disabled++;
cleanup_push(&pintr_disabled, disabled_cleanup);
/*
* setpath(3) uses stdio and we want 0, 1, 2 to work...
*/
if (!didfds) {
(void) dcopy(SHIN, 0);
(void) dcopy(SHOUT, 1);
(void) dcopy(SHDIAG, 2);
didfds = 1;
}
for (i = 1; arglist[i] && (arglist[i][0] != '-'); i++);
npaths = i - 1;
cmdargs = &arglist[i];
for (; arglist[i]; i++);
ncmds = i - npaths - 1;
if (npaths) {
sysflag = 0;
pathvars = &arglist[1];
}
else {
sysflag = 1;
npaths = (sizeof syspaths / sizeof *syspaths) - 1;
pathvars = syspaths;
}
/* note that npaths != 0 */
spaths = xmalloc(npaths * sizeof *spaths);
setzero(spaths, npaths * sizeof *spaths);
cpaths = xmalloc((npaths + 1) * sizeof *cpaths);
setzero(cpaths, (npaths + 1) * sizeof *cpaths);
cmds = xmalloc((ncmds + 1) * sizeof *cmds);
setzero(cmds, (ncmds + 1) * sizeof *cmds);
for (i = 0; i < npaths; i++) {
char *val = getenv(short2str(pathvars[i]));
if (val == NULL)
val = "";
spaths[i] = xmalloc((Strlen(pathvars[i]) + strlen(val) + 2) *
sizeof **spaths);
(void) strcpy(spaths[i], short2str(pathvars[i]));
(void) strcat(spaths[i], "=");
(void) strcat(spaths[i], val);
cpaths[i] = spaths[i];
}
for (i = 0; i < ncmds; i++) {
Char *val = globone(cmdargs[i], G_ERROR);/*FIXRESET*/
if (val == NULL)
goto abortpath;
cmds[i] = strsave(short2str(val));
}
if (setpath(cpaths, cmds, LOCALSYSPATH, sysflag, 1) < 0) {
abortpath:
if (spaths) {
for (i = 0; i < npaths; i++)
xfree(spaths[i]);
xfree(spaths);
}
xfree(cpaths);
if (cmds) {
for (i = 0; i < ncmds; i++)
xfree(cmds[i]);
xfree(cmds);
}
cleanup_until(&pintr_disabled);
donefds();
return;
}
for (i = 0; i < npaths; i++) {
Char *val, *name;
name = str2short(cpaths[i]);
for (val = str2short(cpaths[i]); val && *val && *val != '='; val++);
if (val && *val == '=') {
*val++ = '\0';
tsetenv(name, val);/*FIXRESET*/
//.........这里部分代码省略.........
开发者ID:tcsh-org,项目名称:tcsh,代码行数:101,代码来源:tc.os.c
示例16: reg
// returns 0 or winerror.h error code
int reg(BOOL set, LPSTR keys)
{
WCHAR szwork[128];
char szID[128];
char szCLSID[128];
char szLIBID[128];
char iid[128];
char szLIBTYPELIBID[128];
char szdir[512];
char path[256];
char inter[256];
char typetext[256];
char progidcurtext[256];
char progidtext[256];
LPSTR p;
char progidcur[100];
char module[_MAX_PATH];
int r;
GetModuleFileNameA(g_hinst, module, sizeof(module));
#ifdef _JDLL
char progid[100] = "JDLLServer";
char producttext[] = "J DLL Server ";
#else
char progid[100] = "JEXEServer";
char producttext[] = "J EXE Server ";
#endif
setguids();
strcat(progid, jclass);
strcpy(progidcur, progid);
strcat(progidcur, ".");
strcat(progidcur, jversion);
StringFromGUID2(jclsid, szwork, 128);
toasc(szwork, szID);
strcpy(szCLSID, "CLSID\\");
strcat(szCLSID, szID);
StringFromGUID2(jlibid, szwork, 128);
toasc(szwork, szLIBID);
strcpy(szLIBTYPELIBID, "TypeLib\\");
strcat(szLIBTYPELIBID, szLIBID);
StringFromGUID2(jiid, szwork, 128);
toasc(szwork, iid);
strcpy(inter, "Interface\\");
strcat(inter, iid);
strcpy(szdir, module);
p=strrchr(szdir, '\\');
*p=0;
keys[0]=0;
strcpy(progidtext, "Jsoftware : ");
strcat(progidtext, producttext);
strcat(progidtext, jclass);
strcpy(progidcurtext, progidtext);
strcat(progidcurtext, " (version ");
strcat(progidcurtext, jversion);
strcat(progidcurtext, ")");
//HKEY_CLASSES_ROOT\JServer.Object = J Server
r=SetKeyAndValue(set, keys, progid, 0, progidtext);
if(r) return r;
//HKEY_CLASSES_ROOT\JServer.Object\CLSID = {21EB05E0-1AB3-11cf-A2AC-8FF70874C460}
setpath(progid,"\\CLSID");
r=SetKeyAndValue(set, keys, path, 0, szID);
if(r) return r;
//HKEY_CLASSES_ROOT\JServer.Object\CurVer = JServer.Object.1
setpath(progid,"\\CurVer");
r=SetKeyAndValue(set, keys, path, 0, progidcur);
if(r) return r;
//HKEY_CLASSES_ROOT\JServer.Object\NotInsertable
setpath(progid,"\\NotInsertable");
r=SetKeyAndValue(set, keys, path, 0, 0);
if(r) return r;
//HKEY_CLASSES_ROOT\JServer.Object.1 = J Server (Ver 1.0)
r=SetKeyAndValue(set, keys, progidcur, 0, progidcurtext);
if(r) return r;
//HKEY_CLASSES_ROOT\JServer.Object.1\CLSID = {21EB05E0-1AB3-11cf-A2AC-8FF70874C460}
setpath(progidcur,"\\CLSID");
r=SetKeyAndValue(set, keys, path, 0, szID);
if(r) return r;
//HKEY_CLASSES_ROOT\JServer.Object.1\NotInsertable
setpath(progidcur, "\\NotInsertable");
r=SetKeyAndValue(set, keys, path, 0, 0);
if(r) return r;
//HKEY_CLASSES_ROOT\CLSID\{21EB05E0-1AB3-11cf-A2AC-8FF70874C460} = J Server (Ver 1.0)
//.........这里部分代码省略.........
开发者ID:EdKeith,项目名称:core,代码行数:101,代码来源:jdllcomx.cpp
示例17: cmd
void cmd(int defer, int async){
int id, i, nwait;
int *p;
char retry[2002]; /* see sprintf below */
int w;
success=1;
if(!skip && argp!=args){
if(strcmp(args[0], "cd")==0){
if(argp!=args+2) err("Usage: cd directory\n");
else if(chdir(args[1])==-1) err("can't cd %s\n", args[1]);
}
else if(strcmp(args[0], "exit")==0){
if(argp==args+1) exit(0);
else if(argp==args+2) exit(atoi(args[1]));
else err("Usage: exit [status]\n");
}
else if(strcmp(args[0], "path")==0){
if(argp==args+1){
printf("path");
for(i=0;path[i];i++)
printf(" %s", path[i]);
printf("\n");
}
else
setpath(args, argp);
}
else switch(id=fork()){
case -1:
err("can't fork\n");
break;
default:
if(epid!=&pid[NPID]) *epid++=id;
if(defer) break;
if(!async){
nwait=epid-pid;
while(nwait!=0 && (id=wait(&w))!=-1){
for(p=pid;p!=epid;p++){
if(*p==id){
--nwait;
if(w!=0) success=0;
break;
}
}
}
}
epid=pid;
break;
case 0:
for(i=0;i!=NREDIR;i++){
if(redir[i]!=i){
dup2(redir[i], i);
close(redir[i]);
}
}
if(async && redir[0]==0) close(0);
arg(0);
for(i=0;path[i];i++){
sprintf(retry, "%.1000s/%.1000s",
path[i], args[0]);
execv(retry, args);
}
exit(1);
}
}
for(i=0;i!=NREDIR;i++){
if(redir[i]!=i){
close(redir[i]);
redir[i]=i;
}
}
argp=args;
chargp=charg;
if(skip) success=0;
}
开发者ID:anastasop,项目名称:oneshot,代码行数:74,代码来源:ssh.c
注:本文中的setpath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论