这篇教程C++ sval函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sval函数的典型用法代码示例。如果您正苦于以下问题:C++ sval函数的具体用法?C++ sval怎么用?C++ sval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sval函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: show_config_gtmSlaveintshow_config_gtmSlave(int flag, char *hostname){ char lineBuf[MAXLINE+1]; char editBuf[MAXPATH+1]; if (!isVarYes(VAR_gtmSlave) || is_none(VAR_gtmSlaveServer)) { elog(ERROR, "ERROR: gtm slave is not configured./n"); return 0; } lineBuf[0] = 0; if (flag) strncat(lineBuf, "GTM Slave: ", MAXLINE); if (hostname) { snprintf(editBuf, MAXPATH, "host: %s", hostname); strncat(lineBuf, editBuf, MAXLINE); } if (flag || hostname) strncat(lineBuf, "/n", MAXLINE); lockLogFile(); elog(NOTICE, "%s", lineBuf); print_simple_node_info(sval(VAR_gtmName), sval(VAR_gtmSlavePort), sval(VAR_gtmSlaveDir), sval(VAR_gtmExtraConfig), sval(VAR_gtmSlaveSpecificExtraConfig)); unlockLogFile(); return 0;}
开发者ID:DBInsight,项目名称:postgres-x2,代码行数:28,
示例2: getCleanHostname/* * Please note that remote stdout is not in pgxc_ctl so far. It will directly be written * to local stdout. */char *createRemoteFileName(FileType type, char *buf, int len){ char hostname[MAXPATH+1]; /* * Filename is $TmpDir/hostname_type_serno. */ getCleanHostname(hostname, MAXPATH); switch (type) { case STDIN: snprintf(buf, len-1, "%s/%s_STDIN_%d_%d", sval(VAR_tmpDir), hostname, getpid(), file_sn++); break; case STDOUT: snprintf(buf, len-1, "%s/%s_STDOUT_%d_%d", sval(VAR_tmpDir), hostname, getpid(), file_sn++); break; case STDERR: snprintf(buf, len-1, "%s/%s_STDERR_%d_%d", sval(VAR_tmpDir), hostname, getpid(), file_sn++); break; case GENERAL: snprintf(buf, len-1, "%s/%s_GENERAL_%d_%d", sval(VAR_tmpDir), hostname, getpid(), file_sn++); break; default: return NULL; } return buf;}
开发者ID:HunterChen,项目名称:postgres-xc,代码行数:30,
示例3: TESTTEST(Type, SpecificExamples) { // Random examples to stress option types, values, etc: EXPECT_TRUE(!TInt.subtypeOf(ival(1))); EXPECT_TRUE(TInitCell.couldBe(ival(1))); EXPECT_TRUE(TInitCell.subtypeOf(TGen)); EXPECT_TRUE(ival(2).subtypeOf(TInt)); EXPECT_TRUE(!ival(2).subtypeOf(TBool)); EXPECT_TRUE(ival(3).subtypeOf(TOptInt)); EXPECT_TRUE(TInt.subtypeOf(TOptInt)); EXPECT_TRUE(!TBool.subtypeOf(TOptInt)); EXPECT_TRUE(TInitNull.subtypeOf(TOptInt)); EXPECT_TRUE(!TNull.subtypeOf(TOptInt)); EXPECT_TRUE(TNull.couldBe(TOptInt)); EXPECT_TRUE(TNull.couldBe(TOptBool)); EXPECT_TRUE(TInitNull.subtypeOf(TInitCell)); EXPECT_TRUE(TInitNull.subtypeOf(TCell)); EXPECT_TRUE(!TUninit.subtypeOf(TInitNull)); EXPECT_TRUE(ival(3).subtypeOf(TOptInt)); EXPECT_TRUE(ival(3).subtypeOf(opt(ival(3)))); EXPECT_TRUE(ival(3).couldBe(opt(ival(3)))); EXPECT_TRUE(ival(3).couldBe(TInt)); EXPECT_TRUE(TInitNull.couldBe(opt(ival(3)))); EXPECT_TRUE(TNull.couldBe(opt(ival(3)))); EXPECT_TRUE(TInitNull.subtypeOf(opt(ival(3)))); EXPECT_TRUE(!TNull.subtypeOf(opt(ival(3)))); EXPECT_EQ(TStr, union_of(sval(s_test.get()), TCStr)); EXPECT_EQ(TStr, union_of(TCStr, sval(s_test.get()))); EXPECT_EQ(TGen, union_of(TRef, TUninit));}
开发者ID:Dx3webs,项目名称:hhvm,代码行数:35,
示例4: checkDirConflictint checkDirConflict(char *host, char *dir){ int ii; /* GTM Master */ if ((strcasecmp(host, sval(VAR_gtmMasterServer)) == 0) && (strcmp(dir, sval(VAR_gtmMasterDir)) == 0)) return 1; /* GTM Slave */ if (isVarYes(VAR_gtmSlave) && (strcasecmp(host, sval(VAR_gtmSlaveServer)) == 0) && (strcmp(dir, sval(VAR_gtmSlaveDir)) == 0)) return 1; /* GTM Proxy */ if (isVarYes(VAR_gtmProxy)) for (ii = 0; aval(VAR_gtmProxyNames)[ii]; ii++) if ((strcasecmp(host, aval(VAR_gtmProxyServers)[ii]) == 0) && (strcmp(dir, aval(VAR_gtmProxyDirs)[ii]) == 0)) return 1; /* Coordinator Master */ for (ii = 0; aval(VAR_coordNames)[ii]; ii++) if ((strcasecmp(host, aval(VAR_coordMasterServers)[ii]) == 0) && (strcmp(dir, aval(VAR_coordMasterDirs)[ii]) == 0)) return 1; /* Coordinator Slave */ if (isVarYes(VAR_coordSlave)) for (ii = 0; aval(VAR_coordNames)[ii]; ii++) if ((strcasecmp(host, aval(VAR_coordSlaveServers)[ii]) == 0) && (strcmp(dir, aval(VAR_coordSlaveDirs)[ii]) == 0)) return 1; /* Datanode Master */ for (ii = 0; aval(VAR_datanodeNames)[ii]; ii++) if ((strcasecmp(host, aval(VAR_datanodeMasterServers)[ii]) == 0) && (strcmp(dir, aval(VAR_datanodeMasterDirs)[ii]) == 0)) return 1; /* Datanode Slave */ if (isVarYes(VAR_datanodeSlave)) if (doesExist(VAR_datanodeSlaveServers, ii) && doesExist(VAR_datanodeSlaveDirs, ii) && (strcasecmp(host, aval(VAR_datanodeSlaveServers)[ii]) == 0) && (strcmp(dir, aval(VAR_datanodeSlaveDirs)[ii]) == 0)) return 1; return 0;}
开发者ID:HunterChen,项目名称:postgres-xc,代码行数:35,
示例5: snprintfstatic GTM_Conn *connectGTM(){ char connect_str[MAXLINE+1]; /* Use 60s as connection timeout */ snprintf(connect_str, MAXLINE, "host=%s port=%d node_name=%s remote_type=%d postmaster=0 connect_timeout=60", sval(VAR_gtmMasterServer), atoi(sval(VAR_gtmMasterPort)), (myname == NULL) ? DefaultName : myname, GTM_NODE_COORDINATOR); return(PQconnectGTM(connect_str));}
开发者ID:pavanvd,项目名称:postgres-xl,代码行数:9,
示例6: build_configuration_pathstatic void build_configuration_path(char *path){ struct stat statbuf; int rr; if (path) reset_var_val(VAR_configFile, path); if (!find_var(VAR_configFile) || !sval(VAR_configFile) || (sval(VAR_configFile)[0] == 0)) { /* Default */ snprintf(pgxc_ctl_config_path, MAXPATH, "%s/%s", pgxc_ctl_home, DEFAULT_CONF_FILE_NAME); rr = stat(pgxc_ctl_config_path, &statbuf); if (rr || !S_ISREG(statbuf.st_mode)) { /* No configuration specified and the default does not apply --> simply ignore */ elog(ERROR, "ERROR: Default configuration file /"%s/" was not found while no configuration file was specified/n", pgxc_ctl_config_path); pgxc_ctl_config_path[0] = 0; /* Read prototype config file if no default config file found */ install_pgxc_ctl_bash(pgxc_ctl_bash_path, true); return; } } else if (sval(VAR_configFile)[0] == '/') { /* Absolute path */ strncpy(pgxc_ctl_config_path, sval(VAR_configFile), MAXPATH); } else { /* Relative path from $pgxc_ctl_home */ snprintf(pgxc_ctl_config_path, MAXPATH, "%s/%s", pgxc_ctl_home, sval(VAR_configFile)); } rr = stat(pgxc_ctl_config_path, &statbuf); if (rr || !S_ISREG(statbuf.st_mode)) { if (rr) elog(ERROR, "ERROR: File /"%s/" not found or not a regular file. %s/n", pgxc_ctl_config_path, strerror(errno)); else elog(ERROR, "ERROR: File /"%s/" not found or not a regular file", pgxc_ctl_config_path); /* Read prototype config file if no config file found */ install_pgxc_ctl_bash(pgxc_ctl_bash_path, true); } else { /* * Since we found a valid config file, don't read the prototype config * file as it may conflict with the user conf file */ install_pgxc_ctl_bash(pgxc_ctl_bash_path, false); } return;}
开发者ID:arcivanov,项目名称:postgres-xl,代码行数:56,
示例7: prepare_stopGtmMaster/* * Stop gtm master --------------------------------------------------------- */static cmd_t *prepare_stopGtmMaster(void){ cmd_t *cmdGtmCtl; cmdGtmCtl = initCmd(sval(VAR_gtmMasterServer)); snprintf(newCommand(cmdGtmCtl), MAXLINE, "gtm_ctl stop -Z gtm -D %s", sval(VAR_gtmMasterDir)); return(cmdGtmCtl);}
开发者ID:DBInsight,项目名称:postgres-x2,代码行数:14,
示例8: doCmdEl/* localStdout has to be set by the caller */int doCmdEl(cmd_t *cmd){ if (cmd->isInternal) { if (*cmd->callback) (*cmd->callback)(cmd->callback_parm); else elog(ERROR, "ERROR: no function entry was found in cmd_t./n"); freeAndReset(cmd->callback_parm); return 0; } if (cmd->host) { /* Build actual command */ snprintf(allocActualCmd(cmd), MAXLINE, "ssh %[email C++ svalue函数代码示例 C++ sv_2mortal函数代码示例
|