本文整理汇总了C++中say函数的典型用法代码示例。如果您正苦于以下问题:C++ say函数的具体用法?C++ say怎么用?C++ say使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了say函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: puts
void Board::I_win()
{
puts(">>>> I win");
info.sprintf("OK, you are the winner!\n");
emit say(info);
}
开发者ID:aijunbai,项目名称:reversi,代码行数:6,代码来源:board.cpp
示例2: main
int main(int argc,char *argv[]) {
struct sockaddr_in serv_addr;
struct hostent *host;
char *hostname,hostaddr[20];
fprintf(stderr,"Sendmail DoS (up to 8.9.3) by siwa9 [[email protected]]\n");
if (argc<2) usage(argv[0]);
#ifdef VERBOSE
fprintf(stderr,">Preparing address. \n");
#endif
hostname=argv[1];
serv_addr.sin_port=htons(PORT);
serv_addr.sin_family=AF_INET;
if ((serv_addr.sin_addr.s_addr=inet_addr(hostname))==-1) {
#ifdef VERBOSE
fprintf(stderr,">Getting info from DNS.\n");
#endif
if ((host=gethostbyname(hostname))==NULL) {
herror("gethostbyname()");
exit(h_errno);
}
serv_addr.sin_family=host->h_addrtype;
bcopy(host->h_addr,(char *)&serv_addr.sin_addr,host->h_length);
#ifdef VERBOSE
fprintf(stderr,">Official name of host: %s\n",host->h_name);
#endif
hostname=host->h_name;
sprintf(hostaddr,"%d.%d.%d.%d",(unsigned char)host->h_addr[0],
(unsigned char)host->h_addr[1],
(unsigned char)host->h_addr[2],
(unsigned char)host->h_addr[3]);
}
else sprintf(hostaddr,"%s",hostname);
#ifdef MORECONN
for (;loop<MAXCONN;loop++) if (!(chpid=fork())) {
#endif
for(;;) {
bzero(&(serv_addr.sin_zero),8);
if ((sockfd=socket(AF_INET,SOCK_STREAM,0))==-1) {
perror("socket()");
exit(errno);
}
if ((connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr))) == -1) {
perror("connect()");
exit(errno);
}
#ifdef VERBOSE
fprintf(stderr,">Connected to [%s:%d].\n",hostname,PORT);
#endif
bzero(buffer,BSIZE);read(sockfd,buffer,BSIZE);
#ifdef VERBOSE
fprintf(stderr,buffer);
#else
fprintf(stderr,".");
#endif
say("helo foo\n");
say("mail from:[email protected]\n");
say("rcpt to:" RCPT_TO "\n");
say("data\n");
for (x=0;x<=BSIZE;x++) buffer[x]='X';write(sockfd,buffer,BSIZE);
say("\n.\n");
sleep(1);
say("quit\n");
shutdown(sockfd,2);
close(sockfd);
#ifdef VERBOSE
fprintf(stderr,">Connection closed succesfully.\n");
#endif
}
#ifdef MORECONN
}
waitpid(chpid,NULL,0);
#endif
return 0;
//.........这里部分代码省略.........
开发者ID:amari100,项目名称:PacketStorm-Exploits,代码行数:101,代码来源:smdos.c
示例3: fetchname
void
fetchname (char const *at, int strip_leading, bool maybe_quoted, char **pname,
char **ptimestr, struct timespec *pstamp)
{
char *name;
const char *t;
char *timestr = NULL;
struct timespec stamp;
stamp.tv_sec = -1;
stamp.tv_nsec = 0;
while (ISSPACE ((unsigned char) *at))
at++;
if (debug & 128)
say ("fetchname %s %d\n", at, strip_leading);
if (maybe_quoted && *at == '"')
{
name = parse_c_string (at, &t);
if (! name)
{
if (debug & 128)
say ("ignoring malformed filename %s\n", quotearg (at));
return;
}
}
else
{
for (t = at; *t; t++)
{
if (ISSPACE ((unsigned char) *t))
{
/* Allow file names with internal spaces,
but only if a tab separates the file name from the date. */
char const *u = t;
while (*u != '\t' && ISSPACE ((unsigned char) u[1]))
u++;
if (*u != '\t' && (strchr (u + 1, pstamp ? '\t' : '\n')))
continue;
break;
}
}
name = savebuf (at, t - at + 1);
name[t - at] = 0;
}
/* If the name is "/dev/null", ignore the name and mark the file
as being nonexistent. The name "/dev/null" appears in patches
regardless of how NULL_DEVICE is spelled. */
if (strcmp (name, "/dev/null") == 0)
{
free (name);
if (pstamp)
{
pstamp->tv_sec = 0;
pstamp->tv_nsec = 0;
}
return;
}
/* Ignore the name if it doesn't have enough slashes to strip off. */
if (! strip_leading_slashes (name, strip_leading))
{
free (name);
return;
}
if (ptimestr)
{
char const *u = t + strlen (t);
if (u != t && *(u-1) == '\n')
u--;
if (u != t && *(u-1) == '\r')
u--;
timestr = savebuf (t, u - t + 1);
timestr[u - t] = 0;
}
if (*t != '\n')
{
if (! pstamp)
{
free (name);
free (timestr);
return;
}
if (set_time | set_utc)
get_date (&stamp, t, &initial_time);
else
{
/* The head says the file is nonexistent if the
timestamp is the epoch; but the listed time is
local time, not UTC, and POSIX.1 allows local
time offset anywhere in the range -25:00 <
offset < +26:00. Match any time in that range. */
const struct timespec lower = { -25L * 60 * 60 },
upper = { 26L * 60 * 60 };
//.........这里部分代码省略.........
开发者ID:tizenorg,项目名称:toolchains.patch,代码行数:101,代码来源:util.c
示例4: move_file
void
move_file (char const *from, int *from_needs_removal,
struct stat const *fromst,
char const *to, mode_t mode, bool backup)
{
struct stat to_st;
int to_errno;
to_errno = lstat (to, &to_st) == 0 ? 0 : errno;
if (backup)
create_backup (to, to_errno ? NULL : &to_st, false);
if (! to_errno)
insert_file_id (&to_st, OVERWRITTEN);
if (from)
{
if (S_ISLNK (mode))
{
bool to_dir_known_to_exist = false;
/* FROM contains the contents of the symlink we have patched; need
to convert that back into a symlink. */
char *buffer = xmalloc (PATH_MAX);
int fd, size = 0, i;
if ((fd = open (from, O_RDONLY | O_BINARY)) < 0)
pfatal ("Can't reopen file %s", quotearg (from));
while ((i = read (fd, buffer + size, PATH_MAX - size)) > 0)
size += i;
if (i != 0 || close (fd) != 0)
read_fatal ();
buffer[size] = 0;
if (! backup)
{
if (unlink (to) == 0)
to_dir_known_to_exist = true;
}
if (symlink (buffer, to) != 0)
{
if (errno == ENOENT && ! to_dir_known_to_exist)
makedirs (to);
if (symlink (buffer, to) != 0)
pfatal ("Can't create %s %s", "symbolic link", to);
}
free (buffer);
if (lstat (to, &to_st) != 0)
pfatal ("Can't get file attributes of %s %s", "symbolic link", to);
insert_file_id (&to_st, CREATED);
}
else
{
if (debug & 4)
say ("Renaming file %s to %s\n",
quotearg_n (0, from), quotearg_n (1, to));
if (rename (from, to) != 0)
{
bool to_dir_known_to_exist = false;
if (errno == ENOENT
&& (to_errno == -1 || to_errno == ENOENT))
{
makedirs (to);
to_dir_known_to_exist = true;
if (rename (from, to) == 0)
goto rename_succeeded;
}
if (errno == EXDEV)
{
struct stat tost;
if (! backup)
{
if (unlink (to) == 0)
to_dir_known_to_exist = true;
else if (errno != ENOENT)
pfatal ("Can't remove file %s", quotearg (to));
}
copy_file (from, to, &tost, 0, mode, to_dir_known_to_exist);
insert_file_id (&tost, CREATED);
return;
}
pfatal ("Can't rename file %s to %s",
quotearg_n (0, from), quotearg_n (1, to));
}
rename_succeeded:
insert_file_id (fromst, CREATED);
/* Do not clear *FROM_NEEDS_REMOVAL if it's possible that the
rename returned zero because FROM and TO are hard links to
the same file. */
if ((0 < to_errno
|| (to_errno == 0 && to_st.st_nlink <= 1))
&& from_needs_removal)
*from_needs_removal = 0;
}
}
else if (! backup)
//.........这里部分代码省略.........
开发者ID:tizenorg,项目名称:toolchains.patch,代码行数:101,代码来源:util.c
示例5: cast_light
int cast_light (string str, int obj) {
object target, light;
int flag = 0;
seteuid(getuid());
if (!str||str=="me"||str==(string)TP->query("name")) {
target = TP;
} else {
if (str == "here") {
target = environment(TP);
flag = 1;
} else {
target = present(str, environment(TP));
if (!target) {
write("Couldn't find "+capitalize(str)+" here.\n");
return 1;
}
if (!living(target)) {
write("The target must be alive.\n");
return 1;
}
flag = 2;
}
}
if (present("#LIGHT_OBJECT#", target)) {
if (flag==2) write("That person already has a light effect.\n");
if (flag==1) write("There is already a light spell in the room.\n");
if (!flag && present("#LIGHT_OBJECT#", TP))
write("You already have a light spell upon you.\n");
return 1;
}
if (living(target) && target!=TP)
if (!check_magic_resist(TP, target, COST, 0)) return 0;
if (!obj) {
if (!cast_spell(TP, COST)) return 1;
} else {
obj = query_caster_level(TP, "wizard");
}
// Clone the light object.
light = clone_object(M_OBJ(light_ob));
if (!light) {
write("Your spell fizzles. Notify Cyanide.\n");
return 1;
}
// Tell the room and caster what happens...
switch (flag) {
case 1 :
write("You cast light upon the room.\n");
say(TPN+" utters a strange incantation.\n");
tell_room(environment(TP), "The room suddenly gets brighter.\n");
break;
case 2 :
tell_object(target, TPN +
" gestures at you and utters a strange incantation.\n"+
"An aura of light springs up around you!\n");
write ("You cast light upon "+target->query("cap_name")+".\n");
message("spell",
TPN+" gestures at "+target->query("cap_name")+
" and utters a strange incantation.\n", environment(TP),
({ TP, target }) );
break;
default :
write("You cast a light spell upon yourself.\n"+
"An aura of light springs up around you.\n");
say(TPN+" utters a strange incantation.\nAn aura of light springs "+
"up around "+objective(TP->query("gender"))+".\n");
break;
}
开发者ID:ClockworkSoul,项目名称:MortalRemains,代码行数:74,代码来源:light.c
示例6: update_properties
/**
* update_properties
*
* @param phandle
* @returns 0 on success, !0 otherwise
*/
static int
update_properties(unsigned int phandle)
{
int rc;
char cmd[DR_PATH_MAX];
char *longcmd = NULL;
char *newcmd;
int cmdlen = 0;
int proplen = 0;
unsigned int wa[1024];
unsigned int *op;
unsigned int nprop;
unsigned int vd;
int lenpos = 0;
char *pname;
unsigned int i;
int more = 0;
char *name = find_phandle(phandle);
int initial = 1;
memset(wa, 0x00, 16);
wa[0] = phandle;
do {
say(DEBUG, "about to call rtas_update_properties. work area:\n"
"phandle %8.8x, node %s\n"
" %8.8x %8.8x %8.8x %8.8x\n",
phandle, name ? name : "NULL", wa[0], wa[1], wa[2], wa[3]);
rc = rtas_update_properties((char *)wa, 1);
if (rc && rc != 1) {
say(DEBUG, "Error %d from rtas_update_properties()\n",
rc);
return 1;
}
say(DEBUG, "successful rtas_update_properties (more %d)\n", rc);
op = wa+4;
nprop = *op++;
/* After the initial call to rtas_update_properties the first
* property value descriptor in the buffer is the path of the
* node being updated. Format is as follows:
*
* property name - 1 byte set to NULL 0x00
* value descriptor - 4 bytes containing length of value string
* value string - fully qualified path name of updated node
* */
if (initial) {
say(DEBUG, "Null byte = %2.2x, ", *((char *)op));
op = (unsigned int *)(((char *)op) + 1);
vd = *op++;
say(DEBUG, "string length = %u, path = %s\n", vd, ((char *)op));
op = (unsigned int *)(((char *)op) + vd);
initial = 0;
/* The path we are skipping is inclusive in the
* property count.
*/
nprop--;
}
for (i = 0; i < nprop; i++) {
pname = (char *)op;
op = (unsigned int *)(pname + strlen(pname) + 1);
vd = *op++;
switch (vd) {
case 0x00000000:
say(DEBUG, "%s - name only property %s\n",
name, pname);
break;
case 0x80000000:
say(DEBUG, "%s - delete property %s\n", name,
pname);
sprintf(cmd,"remove_property %u %s",
phandle, pname);
do_update(cmd, strlen(cmd) + 1);
break;
default:
if (vd & 0x80000000) {
say(DEBUG, "partial property!\n");
/* twos compliment of length */
vd = ~vd + 1;
more = 1;
}
else {
more = 0;
}
say(DEBUG, "%s - updating property %s length "
//.........这里部分代码省略.........
开发者ID:cyphermox,项目名称:powerpc-utils,代码行数:101,代码来源:drmig_chrp_pmig.c
示例7: plan_a
static bool
plan_a(const char *filename)
{
int ifd, statfailed;
char *p, *s, lbuf[MAXLINELEN];
struct stat filestat;
off_t i;
ptrdiff_t sz;
size_t iline, lines_allocated;
#ifdef DEBUGGING
if (debug & 8)
return false;
#endif
if (filename == NULL || *filename == '\0')
return false;
statfailed = stat(filename, &filestat);
if (statfailed && ok_to_create_file) {
if (verbose)
say("(Creating file %s...)\n", filename);
/*
* in check_patch case, we still display `Creating file' even
* though we're not. The rule is that -C should be as similar
* to normal patch behavior as possible
*/
if (check_only)
return true;
makedirs(filename, true);
close(creat(filename, 0666));
statfailed = stat(filename, &filestat);
}
if (statfailed && check_only)
fatal("%s not found, -C mode, can't probe further\n", filename);
/* For nonexistent or read-only files, look for RCS or SCCS versions. */
if (statfailed ||
/* No one can write to it. */
(filestat.st_mode & 0222) == 0 ||
/* I can't write to it. */
((filestat.st_mode & 0022) == 0 && filestat.st_uid != getuid())) {
char *cs = NULL, *filebase, *filedir;
struct stat cstat;
filebase = basename(filename);
filedir = dirname(filename);
/* Leave room in lbuf for the diff command. */
s = lbuf + 20;
#define try(f, a1, a2, a3) \
(snprintf(s, sizeof lbuf - 20, f, a1, a2, a3), stat(s, &cstat) == 0)
if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) ||
try("%s/RCS/%s%s", filedir, filebase, "") ||
try("%s/%s%s", filedir, filebase, RCSSUFFIX)) {
snprintf(buf, sizeof buf, CHECKOUT, filename);
snprintf(lbuf, sizeof lbuf, RCSDIFF, filename);
cs = "RCS";
} else if (try("%s/SCCS/%s%s", filedir, SCCSPREFIX, filebase) ||
try("%s/%s%s", filedir, SCCSPREFIX, filebase)) {
snprintf(buf, sizeof buf, GET, s);
snprintf(lbuf, sizeof lbuf, SCCSDIFF, s, filename);
cs = "SCCS";
} else if (statfailed)
fatal("can't find %s\n", filename);
/*
* else we can't write to it but it's not under a version
* control system, so just proceed.
*/
if (cs) {
if (!statfailed) {
if ((filestat.st_mode & 0222) != 0)
/* The owner can write to it. */
fatal("file %s seems to be locked "
"by somebody else under %s\n",
filename, cs);
/*
* It might be checked out unlocked. See if
* it's safe to check out the default version
* locked.
*/
if (verbose)
say("Comparing file %s to default "
"%s version...\n",
filename, cs);
if (system(lbuf))
fatal("can't check out file %s: "
"differs from default %s version\n",
filename, cs);
}
if (verbose)
say("Checking out file %s from %s...\n",
filename, cs);
if (system(buf) || stat(filename, &filestat))
fatal("can't check out file %s from %s\n",
filename, cs);
}
}
//.........这里部分代码省略.........
开发者ID:memagit,项目名称:obase,代码行数:101,代码来源:inp.c
示例8: say
// -----------------------------------------------------------------
// Name : addToInventory
// -----------------------------------------------------------------
void Character::addToInventory(InventoryObject * obj)
{
inventory.push_back(obj);
say("I've found a " + obj->getName());
}
开发者ID:jotak,项目名称:RPGProject,代码行数:8,代码来源:Character.cpp
示例9: OpenSesame
int OpenSesame(){
write("You uncover a secret passageway!");
say(this_player()->GetName()+" uncovers a secret passageway!");
AddItem(({"secret passageway","passageway"}) , "A secret passageway you can enter.");
开发者ID:Elohim,项目名称:FGmud,代码行数:4,代码来源:wall.c
示例10: text_to_process
int text_to_process (int x, const char *y, int z)
{
say("Cannot send text to process without job control, sorry.");
return 1;
}
开发者ID:srfrog,项目名称:epic5,代码行数:5,代码来源:exec.c
示例11: cmd_say
int cmd_say (string str) {
write ("You strive to speak, but you cannot form words in your ghostly state.\n") ;
say ("You hear the sound of distant wind.\n") ;
return 1 ;
}
开发者ID:ClockworkSoul,项目名称:MortalRemains,代码行数:5,代码来源:_say.c
示例12: main
void main( void )
{
if (&caveguy == 5)
{
script_attach(1000);
//preload_seq(740); <-- for sucking.
preload_seq(375);
preload_seq(168);
int &junk;
int &dude;
int &evil;
int &evil2;
int &evil3;
freeze(1);
&dude = create_sprite(551, 157, 0, 0, 0);
sp_brain(&dude, 0);
sp_base_walk(&dude, 370);
sp_speed(&dude, 2);
sp_timing(&dude, 0);
//set starting pic
sp_pseq(&dude, 371);
sp_pframe(&dude, 1);
//Now EVIL
&evil = create_sprite(-20, 130, 0, 0, 0);
sp_brain(&evil, 0);
sp_base_walk(&evil, 300);
sp_speed(&evil, 1);
sp_timing(&evil, 0);
//set starting pic
sp_pseq(&evil, 303);
sp_pframe(&evil, 1);
//Now EVIL's friend
&evil2 = create_sprite(-20, 210, 0, 0, 0);
sp_brain(&evil2, 0);
sp_base_walk(&evil2, 300);
sp_speed(&evil2, 1);
sp_timing(&evil2, 0);
//set starting pic
sp_pseq(&evil2, 303);
sp_pframe(&evil2, 1);
//And the third EVIL
&evil3 = create_sprite(300, 470, 0, 0, 0);
sp_brain(&evil3, 0);
sp_base_walk(&evil3, 300);
sp_speed(&evil3, 1);
sp_timing(&evil3, 0);
//set starting pic
sp_pseq(&evil3, 307);
sp_pframe(&evil3, 1);
Playmidi("1004.mid");
say_stop("`5Ok, let's get going before they come.", &dude);
wait(500);
say_stop("`5This way.", &dude);
move(&dude, 4, 500, 1);
wait(50);
move(1, 4, 550, 1);
wait(150);
say("`4Not so fast.", &evil);
move(&evil, 6, 100, 1);
wait(850);
move(&evil3, 8, 380, 1);
move_stop(&evil2, 6, 67, 1);
say_stop("`4We have a small matter to discuss with your friend.", &evil);
say("`4Hahahaaahaha", &evil);
say("`4Haha ha ha", &evil2);
say_stop("`4Ha ha haaa", &evil3);
wait(800);
sp_dir(&dude, 3);
say_stop("`5It's okay Dink, I can take 'em.", &dude);
wait(250);
say("`5Allright.", &dude);
move_stop(&dude, 4, 400, 1);
sp_dir(&dude, 1);
say_stop("`5Which one of you is first?", &dude);
wait(250);
say("`4Haha ha ha", &evil2);
wait(500);
say_stop("`4Ha ha haaa", &evil3);
wait(500);
say_stop("`4I am!!", &evil);
move_stop(&evil, 2, 157, 1);
move_stop(&evil, 6, 170, 1);
wait(500);
//say("`4I'm attacking now...", &evil);
&junk = create_sprite(240, 157, 11, 506, 1);
sp_seq(&junk, 506);
sp_dir(&junk, 6);
sp_speed(&junk, 6);
sp_flying(&junk, 1);
wait(390);
sp_active(&junk, 0);
&junk = create_sprite(390, 157, 7, 168, 1);
sp_seq(&junk, 168);
sp_pseq(&dude, 375);
sp_pframe(&dude, 1);
say_stop("`5Ahhhhhh!", &dude);
wait(50);
sp_active(&junk, 0);
//Kill guy too
//.........这里部分代码省略.........
开发者ID:qubodup,项目名称:freedink-data,代码行数:101,代码来源:S2-CAVE2.c
示例13: elevator_arrives
elevator_arrives() {
say("The lamp on the button beside the elevator goes out.\n");
lamp_is_lit = 0;
}
开发者ID:nfarrar,项目名称:mudfiles,代码行数:4,代码来源:wiz_hall.c
示例14: add_phandles
/**
* add_phandles
*
* @param parent
* @param p
* @returns
*/
static int
add_phandles(char *parent, char *p)
{
DIR *d;
struct dirent *de;
char path[PATH_MAX];
unsigned int phandle;
char *pend;
FILE *fd;
strcpy(path,parent);
if (strlen(p)) {
strcat(path,"/");
strcat(path,p);
}
pend = path + strlen(path);
d = opendir(path);
if (d == NULL) {
perror(path);
return 1;
}
while ((de = readdir(d))) {
if ((de->d_type == DT_DIR) &&
(strcmp(de->d_name,".")) &&
(strcmp(de->d_name,"..")))
add_phandles(path,de->d_name);
}
strcpy(pend,"/linux,phandle");
fd = fopen(path,"r");
if (fd != NULL) {
if (fread(&phandle,sizeof(phandle),1,fd) != 1) {
perror(path);
say(DEBUG, "Error reading phandle data!\n");
fclose(fd);
return 1;
}
*pend = '\0';
add_phandle(path + strlen("/proc/device-tree"),phandle, 0);
fclose(fd);
}
strcpy(pend,"/ibm,phandle");
fd = fopen(path,"r");
if (fd != NULL) {
if (fread(&phandle,sizeof(phandle),1,fd) != 1) {
perror(path);
say(DEBUG, "Error reading phandle data!\n");
fclose(fd);
return 1;
}
*pend = '\0';
add_phandle(path + strlen("/proc/device-tree"), phandle, 1);
fclose(fd);
}
closedir(d);
return 0;
}
开发者ID:cyphermox,项目名称:powerpc-utils,代码行数:68,代码来源:drmig_chrp_pmig.c
示例15: countAndSay
string countAndSay(int n) {
if (n == 1) return "1";
if (n == 2) return "11";
return say(countAndSay(n-1));
}
开发者ID:bigship,项目名称:leetcode_solutions,代码行数:5,代码来源:countAndSay.cpp
示例16: drmig_chrp_pmig
int
drmig_chrp_pmig(struct options *opts)
{
int rc;
char *cmd = opts->p_option;
char sys_src[20];
uint64_t stream_val;
/* Ensure that this partition is migratable/mobile */
if (! pmig_capable()) {
fprintf(stderr, "drmig_chrp_pmig: Partition Mobility is not "
"supported on this kernel.\n");
return -1;
}
/* Today we do no pre-checks for migratability. The only check
* we could do is whether the "ibm,suspend-me" RTAS call exists.
* But if it doesn't, the firmware level doesn't support migration,
* in which case why the heck are we being invoked anyways.
*/
if (strcmp(cmd, "check") == 0) {
say(DEBUG, "check: Nothing to do...\n");
return 0;
}
/* The only other command is pre, any other command is invalid */
if (strcmp(cmd, "pre")) {
say(DEBUG, "Invalid command \"%s\" specified\n", cmd);
return 1;
}
if (opts->usr_drc_name == NULL) {
say(ERROR, "No streamid specified\n");
return -1;
}
errno = 0;
stream_val = strtoull(opts->usr_drc_name, NULL, 16);
if (errno != 0) {
say(ERROR, "Invalid streamid specified: %s\n", strerror(errno));
return -1;
}
/* Get the ID of the original system, for later logging */
get_str_attribute(OFDT_BASE, "system-id", sys_src, 20);
sleep(5);
/* Now do the actual migration */
do {
if (action == MIGRATE)
rc = do_migration(stream_val);
else if (action == HIBERNATE)
rc = do_hibernation(stream_val);
else
rc = -EINVAL;
if (rc == NOT_SUSPENDABLE)
sleep(1);
} while (rc == NOT_SUSPENDABLE);
syslog(LOG_LOCAL0 | LOG_INFO, "drmgr: %s rc %d\n",
(action == MIGRATE ? "migration" : "hibernation"), rc);
if (rc)
return rc;
post_mobility_update(action);
say(DEBUG, "Refreshing RMC via refrsrc\n");
rc = system("/usr/sbin/rsct/bin/refrsrc IBM.ManagementServer");
return 0;
}
开发者ID:cyphermox,项目名称:powerpc-utils,代码行数:73,代码来源:drmig_chrp_pmig.c
示例17: shop_hook_value_asking
/*
* Function name: shop_hook_value_asking
* Description: What other see when someone evaluates something
* Arguments: str - The text form what the player is asking about
*/
void
shop_hook_value_asking(string str)
{
say(QCTNAME(this_player()) + " asks about some values.\n");
}
开发者ID:xxx,项目名称:cdlib,代码行数:10,代码来源:shop.c
示例18: create_backup
void
create_backup (char const *to, const struct stat *to_st, bool leave_original)
{
/* When the input to patch modifies the same file more than once, patch only
backs up the initial version of each file.
To figure out which files have already been backed up, patch remembers the
files that replace the original files. Files not known already are backed
up; files already known have already been backed up before, and are
skipped.
When a patch tries to delete a file, in order to not break the above
logic, we merely remember which file to delete. After the entire patch
file has been read, we delete all files marked for deletion which have not
been recreated in the meantime. */
if (to_st && ! (S_ISREG (to_st->st_mode) || S_ISLNK (to_st->st_mode)))
fatal ("File %s is not a %s -- refusing to create backup",
to, S_ISLNK (to_st->st_mode) ? "symbolic link" : "regular file");
if (to_st && lookup_file_id (to_st) == CREATED)
{
if (debug & 4)
say ("File %s already seen\n", quotearg (to));
}
else
{
int try_makedirs_errno = 0;
char *bakname;
if (origprae || origbase || origsuff)
{
char const *p = origprae ? origprae : "";
char const *b = origbase ? origbase : "";
char const *s = origsuff ? origsuff : "";
char const *t = to;
size_t plen = strlen (p);
size_t blen = strlen (b);
size_t slen = strlen (s);
size_t tlen = strlen (t);
char const *o;
size_t olen;
for (o = t + tlen, olen = 0;
o > t && ! ISSLASH (*(o - 1));
o--)
/* do nothing */ ;
olen = t + tlen - o;
tlen -= olen;
bakname = xmalloc (plen + tlen + blen + olen + slen + 1);
memcpy (bakname, p, plen);
memcpy (bakname + plen, t, tlen);
memcpy (bakname + plen + tlen, b, blen);
memcpy (bakname + plen + tlen + blen, o, olen);
memcpy (bakname + plen + tlen + blen + olen, s, slen + 1);
if ((origprae
&& (contains_slash (origprae + FILE_SYSTEM_PREFIX_LEN (origprae))
|| contains_slash (to)))
|| (origbase && contains_slash (origbase)))
try_makedirs_errno = ENOENT;
}
else
{
bakname = find_backup_file_name (to, backup_type);
if (!bakname)
xalloc_die ();
}
if (! to_st)
{
int fd;
if (debug & 4)
say ("Creating empty file %s\n", quotearg (bakname));
try_makedirs_errno = ENOENT;
unlink (bakname);
while ((fd = creat (bakname, 0666)) < 0)
{
if (errno != try_makedirs_errno)
pfatal ("Can't create file %s", quotearg (bakname));
makedirs (bakname);
try_makedirs_errno = 0;
}
if (close (fd) != 0)
pfatal ("Can't close file %s", quotearg (bakname));
}
else if (leave_original)
create_backup_copy (to, bakname, to_st, try_makedirs_errno == 0);
else
{
if (debug & 4)
say ("Renaming file %s to %s\n",
quotearg_n (0, to), quotearg_n (1, bakname));
while (rename (to, bakname) != 0)
{
if (errno == try_makedirs_errno)
{
makedirs (bakname);
//.........这里部分代码省略.........
开发者ID:tizenorg,项目名称:toolchains.patch,代码行数:101,代码来源:util.c
示例19: shop_hook_appraise_object
/*
* Function name: shop_hook_appraise_object
* Description : Called when a player asks to see an object for sale.
*/
void
shop_hook_appraise_object(object ob)
{
say(QCTNAME(this_player()) + " asks to see " + LANG_ASHORT(ob) + ".\n");
}
开发者ID:xxx,项目名称:cdlib,代码行数:9,代码来源:shop.c
示例20: cmd_hrm
int cmd_hrm(){
write("You hrm.\n");
say(this_player()->query("cap_name")+" hrms.\n", this_player());
return 1;
}
开发者ID:ClockworkSoul,项目名称:MortalRemains,代码行数:5,代码来源:_hrm.c
注:本文中的say函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论