本文整理汇总了C++中bye函数的典型用法代码示例。如果您正苦于以下问题:C++ bye函数的具体用法?C++ bye怎么用?C++ bye使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bye函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rm_fd
/* remove a descriptor from our list */
int rm_fd(fd_list_t *fdl, int fd)
{
int x = 0, last = fdl->nfds;
/* make sure we have a list */
if (last == 0)
bye("Program bug: Trying to remove fd from list with no fds.");
/* find the fd in the list */
for (x = 0; x < last; x++)
if (fdl->fds[x].fd == fd)
break;
/* make sure we found it */
if (x == last)
bye("Program bug: fd (%d) not on list.", fd);
/* remove it, does nothing if (last == 1) */
if (o.debug > 1)
logdebug("Swapping fd[%d] (%d) with fd[%d] (%d)\n",
x, fdl->fds[x].fd, last - 1, fdl->fds[last - 1].fd);
fdl->fds[x] = fdl->fds[last - 1];
fdl->nfds--;
/* was it the max */
if (fd == fdl->fdmax)
fdl->fdmax = get_maxfd(fdl);
if (o.debug > 1)
logdebug("Removed fd %d from list, nfds %d, maxfd %d\n", fd, fdl->nfds, fdl->fdmax);
return 0;
}
开发者ID:d33tah,项目名称:internet-census-2012-research,代码行数:34,代码来源:util.c
示例2: main
int main(int argc, char* argv[])
{
salad_filename = argv[0];
log_level = STATUS;
config_t config;
test_config_t test_config;
switch (parse_options(argc, argv, &config, &test_config))
{
case SALAD_EXIT: return bye(EXIT_FAILURE);
case SALAD_HELP: return usage_main();
case SALAD_HELP_TRAIN: return usage_train();
case SALAD_HELP_PREDICT: return usage_predict();
case SALAD_HELP_INSPECT: return usage_inspect();
case SALAD_HELP_STATS: return usage_stats();
#ifdef TEST_SALAD
case SALAD_HELP_TEST: return usage_test();
#endif
case SALAD_VERSION: return version();
default: break;
}
if (config.input_type == IOMODE_FILES)
{
error("Input mode 'files' is not yet implemented.");
return bye(EXIT_FAILURE);
}
int ret = EXIT_FAILURE, is_metaop = FALSE;
switch (config.mode)
{
case TRAINING:
ret = _salad_train_(&config);
break;
case PREDICT:
ret = _salad_predict_(&config);
break;
case INSPECT:
ret = _salad_inspect_(&config);
break;
default:
is_metaop = TRUE;
break;
}
switch (config.mode)
{
case STATS:
ret = _salad_stats_(&config);
break;
#ifdef TEST_SALAD
case TEST:
ret = _salad_test_(&test_config);
break;
#endif
default: break;
}
return bye_ex(ret, is_metaop ? NULL : "Done!");
}
开发者ID:chwress,项目名称:salad,代码行数:60,代码来源:main.c
示例3: bye
static void
bye (int signum)
{
#ifdef TCSETS
(void) ioctl (0, TCSETS, &termorig);
#endif
if (seteuid(orig_euid) != 0)
{
perror ("Reacquiring uid 0 failed");
bye (EXIT_FAILURE);
}
set_perms_and_close_file(&timing);
set_perms_and_close_file(&script);
#ifdef RECORDINPUT
set_perms_and_close_file(&input);
#endif
if (setuid(getuid()) != 0)
{
perror ("Dropping setuid 0 failed");
bye (EXIT_FAILURE);
}
if (sudosh_option.priority != -1)
mysyslog (sudosh_option.priority,
"stopping session for %s as %s, tty %s, shell %s", user.from,
user.to, ttyname (0), user.shell.ptr);
exit (signum);
}
开发者ID:Rubywithoutropes,项目名称:sudosh2,代码行数:29,代码来源:sudosh.c
示例4: main
int
main(int argc, char *argv[])
{
int sport, dport;
char *nick;
nick = NICK;
if (argc < 4 || strcmp(argv[1], "-h") == 0) {
fprintf(stderr, "%s host sport dport [nick]\n", argv[0]);
return 1;
}
if (initui() == -1)
bye(-1);
drawbar("connecting...");
if (argc >= 5)
nick = argv[4];
sserve = dial(argv[1], argv[2]);
sbroad = dial(argv[1], argv[3]);
if (sserve == -1 || sbroad == -1)
return -1;
loop(nick, argv[1]);
bye(0);
return 0;
}
开发者ID:m-b-,项目名称:talk,代码行数:32,代码来源:ctalk.c
示例5: post_handle_connection
/* This function handles the post connection specific actions that are needed
* after a socket has been initialized(normal socket or ssl socket). */
static void post_handle_connection(struct fdinfo sinfo)
{
/*
* Are we executing a command? If so then don't add this guy
* to our descriptor list or set.
*/
if (o.cmdexec) {
if (o.keepopen)
netrun(&sinfo, o.cmdexec);
else
netexec(&sinfo, o.cmdexec);
} else {
/* Now that a client is connected, pay attention to stdin. */
if (!stdin_eof)
FD_SET(STDIN_FILENO, &master_readfds);
if (!o.sendonly) {
/* add to our lists */
FD_SET(sinfo.fd, &master_readfds);
/* add it to our list of fds for maintaining maxfd */
#ifdef HAVE_OPENSSL
/* Don't add it twice (see handle_connection above) */
if (!o.ssl)
#endif
if (add_fdinfo(&client_fdlist, &sinfo) < 0)
bye("add_fdinfo() failed.");
}
FD_SET(sinfo.fd, &master_broadcastfds);
if (add_fdinfo(&broadcast_fdlist, &sinfo) < 0)
bye("add_fdinfo() failed.");
if (o.chat)
chat_announce_connect(sinfo.fd, &sinfo.remoteaddr);
}
}
开发者ID:Araleii,项目名称:nmap,代码行数:36,代码来源:ncat_listen.c
示例6: mbUnlock
void
mbUnlock(MbLock *ml)
{
if(ml != &mLock)
bye("bad mail unlock");
if(ml->fd < 0)
bye("mail unlock when not locked");
close(ml->fd);
ml->fd = -1;
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:10,代码来源:folder.c
示例7: setup_environment
void setup_environment(struct fdinfo *info)
{
union sockaddr_u su;
char ip[INET6_ADDRSTRLEN];
char port[16];
socklen_t alen = sizeof(su);
if (getpeername(info->fd, &su.sockaddr, &alen) != 0) {
bye("getpeername failed: %s", socket_strerror(socket_errno()));
}
#ifdef HAVE_SYS_UN_H
if (su.sockaddr.sa_family == AF_UNIX) {
/* say localhost to keep it backwards compatible */
setenv_portable("NCAT_REMOTE_ADDR", "localhost");
setenv_portable("NCAT_REMOTE_PORT", "");
} else
#endif
if (getnameinfo((struct sockaddr *)&su, alen, ip, sizeof(ip),
port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV) == 0) {
setenv_portable("NCAT_REMOTE_ADDR", ip);
setenv_portable("NCAT_REMOTE_PORT", port);
} else {
bye("getnameinfo failed: %s", socket_strerror(socket_errno()));
}
if (getsockname(info->fd, (struct sockaddr *)&su, &alen) < 0) {
bye("getsockname failed: %s", socket_strerror(socket_errno()));
}
#ifdef HAVE_SYS_UN_H
if (su.sockaddr.sa_family == AF_UNIX) {
/* say localhost to keep it backwards compatible, else su.un.sun_path */
setenv_portable("NCAT_LOCAL_ADDR", "localhost");
setenv_portable("NCAT_LOCAL_PORT", "");
} else
#endif
if (getnameinfo((struct sockaddr *)&su, alen, ip, sizeof(ip),
port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV) == 0) {
setenv_portable("NCAT_LOCAL_ADDR", ip);
setenv_portable("NCAT_LOCAL_PORT", port);
} else {
bye("getnameinfo failed: %s", socket_strerror(socket_errno()));
}
switch(o.proto) {
case IPPROTO_TCP:
setenv_portable("NCAT_PROTO", "TCP");
break;
case IPPROTO_SCTP:
setenv_portable("NCAT_PROTO", "SCTP");
break;
case IPPROTO_UDP:
setenv_portable("NCAT_PROTO", "UDP");
break;
}
}
开发者ID:kroosec,项目名称:nmap,代码行数:55,代码来源:ncat_core.c
示例8: bye
SSL *new_ssl(int fd)
{
SSL *ssl;
if (!(ssl = SSL_new(sslctx)))
bye("SSL_new(): %s.", ERR_error_string(ERR_get_error(), NULL));
if (!SSL_set_fd(ssl, fd))
bye("SSL_set_fd(): %s.", ERR_error_string(ERR_get_error(), NULL));
return ssl;
}
开发者ID:d33tah,项目名称:internet-census-2012-research,代码行数:11,代码来源:ncat_ssl.c
示例9: shell
void shell(char *host, u_short port)
{
int sock = 0, l = 0;
char buf[BS];
fd_set rfds;
sock = conn(host, port);
printf("--{ Got a shell\n\n"
"--{ Updating Webster's\n"
"--{ definitely, adv.:\n"
"--{ 1. See specious\n\n"
"--{ For the linguistically challenged...\n"
"--{ specious, adj. :\n"
"--{ 1. Having the ring of truth or plausibility but "
"actually fallacious\n"
"--{ 2. Deceptively attractive\n\n"
);
FD_ZERO(&rfds);
while (1) {
FD_SET(STDIN_FILENO, &rfds);
FD_SET(sock, &rfds);
if (select(sock + 1, &rfds, NULL, NULL, NULL) < 1)
die("select");
if (FD_ISSET(STDIN_FILENO, &rfds)) {
l = read(0, buf, BS);
if(l < 0)
die("read");
else if(l == 0)
bye("\n - Connection closed by user\n");
if (write(sock, buf, l) < 1)
die("write");
}
if (FD_ISSET(sock, &rfds)) {
l = read(sock, buf, sizeof(buf));
if (l == 0)
bye("\n - Connection terminated.\n");
else if (l < 0)
die("\n - Read failure\n");
if (write(STDOUT_FILENO, buf, l) < 1)
die("write");
}
}
}
开发者ID:0x24bin,项目名称:exploit-database,代码行数:52,代码来源:900.c
示例10: infrom
/*
* infrom:
* reads a card, supposedly in hand, accepting unambiguous brief
* input, returns the index of the card found...
*/
int
infrom(CARD hand[], int n, char *prompt)
{
int i, j;
CARD crd;
if (n < 1) {
bye();
printf("\nINFROM: %d = n < 1!!\n", n);
exit(74);
}
for (;;) {
msg("%s", prompt);
if (incard(&crd)) { /* if card is full card */
if (!isone(crd, hand, n))
msg("That's not in your hand");
else {
for (i = 0; i < n; i++)
if (hand[i].rank == crd.rank &&
hand[i].suit == crd.suit)
break;
if (i >= n) {
bye();
printf("\nINFROM: isone or something messed up\n");
exit(77);
}
return (i);
}
} else /* if not full card... */
if (crd.rank != EMPTY) {
for (i = 0; i < n; i++)
if (hand[i].rank == crd.rank)
break;
if (i >= n)
msg("No such rank in your hand");
else {
for (j = i + 1; j < n; j++)
if (hand[j].rank == crd.rank)
break;
if (j < n)
msg("Ambiguous rank");
else
return (i);
}
} else
msg("Sorry, I missed that");
}
/* NOTREACHED */
}
开发者ID:lattera,项目名称:openbsd,代码行数:54,代码来源:io.c
示例11: main
int main(int argc, char **argv)
{
int sock = 0, npad = 0;
u_int retloc = 0, retaddr = 0;
char *host = NULL;
if(parse_args(argc, argv, &host, &npad, &retloc, &retaddr))
bye("Usage: %s < host > < padding > < retloc > < retaddr >\n", argv[0]);
printf("--{ Smack 1.oohaah\n\n");
sock = conn(host, SMTP_PORT);
printf("--{ definitely, adv.:\n"
"--{ 1. Having distinct limits\n"
"--{ 2. Indisputable; certain\n"
"--{ 3. Clearly defined; explicitly precise\n\n"
);
sploit(sock, npad, retloc, retaddr);
printf("--{ Attempting to redefine the meaning of 'definitely'\n\n");
shell(host, SHELL_PORT);
return EXIT_SUCCESS;
}
开发者ID:0x24bin,项目名称:exploit-database,代码行数:27,代码来源:900.c
示例12: conn
int conn(char *host, u_short port)
{
int sock = 0;
struct hostent *hp;
struct sockaddr_in sa;
memset(&sa, 0, sizeof(sa));
hp = gethostbyname(host);
if (hp == NULL) {
bye("gethostbyname failed with error %s", hstrerror(h_errno));
}
sa.sin_family = AF_INET;
sa.sin_port = htons(port);
sa.sin_addr = **((struct in_addr **) hp->h_addr_list);
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0)
die("socket");
if (connect(sock, (struct sockaddr *) &sa, sizeof(sa)) < 0)
die("connect");
return sock;
}
开发者ID:0x24bin,项目名称:exploit-database,代码行数:25,代码来源:900.c
示例13: main
int
main (void)
{
hello ("everyone");
bye ();
return 0;
}
开发者ID:briangough,项目名称:gccintro,代码行数:7,代码来源:main3.c
示例14: switch
void hButton::update(){
if (enabled){
if (mouse_x > x - font->GetStringWidth(caption)
&& mouse_x < x + font->GetStringWidth(caption)
&& mouse_y < 20 + font->GetHeight()
&& mouse_y > 0){
selected = true;
if (hge->Input_KeyUp(HGEK_LBUTTON))
switch(id){
case idStart:
gameEnabled = true;
updateEnabled = true;
inputEnabled = true;
for (int i = 0; i < BUTTONS_COUNT-1; i++)
buttons[i]->enabled = false;
break;
case idRestart:
restartLevel();
canPunchBall = true;
break;
case idExit:
bye();
exit(4);
break;
}
}else
selected = false;
}
}
开发者ID:Badrpas,项目名称:LD26,代码行数:29,代码来源:hButton.cpp
示例15: sigterm_handler
/* watch for user kills and send bye */
void sigterm_handler()
{
my_error("Got some sort of term signal, sending bye and shutting down");
bye();
Mem->FlushFiles();
Mem->ServerAlive = FALSE;
}
开发者ID:edymanoloiu,项目名称:FotbalRobotic,代码行数:8,代码来源:client.C
示例16: main
int main() {
dummy();
bye();
dummy();
return 0;
}
开发者ID:sm88,项目名称:programs,代码行数:7,代码来源:test1.c
示例17: io_get_token
char * io_get_token(){
int e;
if(pos == -1){
do {
bufr = io_get_line();
if(bufr == NULL) return NULL;
// remove trailing spaces
e = strlen(bufr) - 1;
while(e >= 0 && isspace(bufr[e])) e--;
} while(e == -1);
bufr[e+1] = '\0';
pos = 0;
}
while(isspace(bufr[pos])) pos++;
int i = 0;
while(bufr[pos] > 32){
if(i >= MAX_TOKEN_SIZE - 1){
printf("\r\nMaximum token size exceeded");
bye();
}
token[i++] = bufr[pos++];
}
token[i] = '\0';
if(bufr[pos] == '\0') pos = -1;
return token;
}
开发者ID:thomaswhitcomb,项目名称:4th,代码行数:30,代码来源:io.c
示例18: main
int main(int argc, char **argv)
{
long a;
int i;
a = sysconf(_SC_ATEXIT_MAX);
printf("ATEXIT_MAX = %ld\n", a);
i = atexit(bye);
if (i != 0)
{
fprintf(stderr, "cannot set exit function\n");
return EXIT_FAILURE;
}
atexit(foo);
//int on_exit(void (*function)(int , void *), void *arg);
on_exit(print_value, (int *) 1);
on_exit(print_value, (int *) 2);
#if 0
bye();
#endif
return 8765;
}
开发者ID:Airead,项目名称:excise,代码行数:28,代码来源:atexit_test.c
示例19: disconnected_timeout
static void disconnected_timeout(void)
{
writes("* BYE Disconnected for inactivity.\r\n");
writeflush();
bye_msg("INFO: TIMEOUT");
bye();
}
开发者ID:MhdAlyan,项目名称:courier,代码行数:7,代码来源:imaptoken.c
示例20: bye
static char *make_nonce(const struct timeval *tv)
{
char *buf = NULL;
size_t size = 0, offset = 0;
MD5_CTX md5;
unsigned char hashbuf[MD5_DIGEST_LENGTH];
char hash_hex[MD5_DIGEST_LENGTH * 2 + 1];
char time_buf[32];
/* Crash if someone forgot to call http_digest_init_secret. */
if (!secret_initialized)
bye("Server secret not initialized for Digest authentication. Call http_digest_init_secret.");
Snprintf(time_buf, sizeof(time_buf), "%lu.%06lu",
(long unsigned) tv->tv_sec, (long unsigned) tv->tv_usec);
MD5_Init(&md5);
MD5_Update(&md5, secret, sizeof(secret));
MD5_Update(&md5, ":", 1);
MD5_Update(&md5, time_buf, strlen(time_buf));
MD5_Final(hashbuf, &md5);
enhex(hash_hex, hashbuf, sizeof(hashbuf));
strbuf_sprintf(&buf, &size, &offset, "%s-%s", time_buf, hash_hex);
return buf;
}
开发者ID:TomSellers,项目名称:nmap,代码行数:27,代码来源:http_digest.c
注:本文中的bye函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论