本文整理汇总了C++中do_hook函数的典型用法代码示例。如果您正苦于以下问题:C++ do_hook函数的具体用法?C++ do_hook怎么用?C++ do_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_hook函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: reset_metric_clock
static void reset_metric_clock (void)
{
static long last_milliday;
double metric_time;
long current_milliday;
get_metric_time(&metric_time);
current_milliday = (long)metric_time;
snprintf(current_clock, sizeof current_clock,
"%ld", (long)metric_time);
if (current_milliday != last_milliday)
{
int old_server = from_server;
int idle_milliday;
idle_milliday = (int)(timeval_to_metric(&idle_time).mt_mdays);
from_server = primary_server;
do_hook(TIMER_LIST, "%03ld", current_milliday);
do_hook(IDLE_LIST, "%ld",
(long)(idle_milliday - current_milliday));
from_server = old_server;
last_milliday = current_milliday;
}
}
开发者ID:Cloudxtreme,项目名称:epic5,代码行数:26,代码来源:clock.c
示例2: funny_mode
void funny_mode(char *from, char **ArgList)
{
char *mode, *channel;
ChannelList *chan = NULL;
if (!ArgList[0]) return;
channel = ArgList[0];
mode = ArgList[1];
PasteArgs(ArgList, 1);
if((channel && in_join_list(channel, from_server)) || get_chan_from_join_list(from_server))
{
if (!channel)
channel = get_chan_from_join_list(from_server);
update_channel_mode(from, channel, from_server, mode, chan);
update_all_status(current_window, NULL, 0);
got_info(channel, from_server, GOTMODE);
}
else
{
if (channel)
{
set_display_target(channel, LOG_CRAP);
if (do_hook(current_numeric, "%s %s %s", from, channel, mode))
put_it("%s", convert_output_format(fget_string_var(FORMAT_MODE_CHANNEL_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from, *FromUserHost ? FromUserHost:"ÿ", channel, mode));
reset_display_target();
}
else
{
if (do_hook(current_numeric, "%s %s", from, mode))
put_it("%s", convert_output_format(fget_string_var(FORMAT_MODE_CHANNEL_FSET), "%s %s %s %s", update_clock(GET_TIME), from, *FromUserHost ? FromUserHost:"ÿ", mode));
}
}
}
开发者ID:BitchX,项目名称:BitchX1.1,代码行数:35,代码来源:funny.c
示例3: show_wholeft_hashtable
int show_wholeft_hashtable(WhowasWrapList *cptr, time_t ltime, int *total, int *hook, char *list)
{
int count, count2;
WhowasList *ptr;
for (count = 0; count < WHOWASLIST_HASHSIZE; count++)
{
if (cptr->NickListTable[count].links == 0)
continue;
for (ptr = (WhowasList *) cptr->NickListTable[count].list, count2 = 1; ptr; count2++, ptr = ptr->next)
{
if (ptr->server1/* && ptr->server2*/)
{
if (!(*total)++ && (*hook = do_hook(WHOLEFT_HEADER_LIST, "%s %s %s %s %s %s", "Nick", "Host", "Channel", "Time", "Server", "Server")))
put_it("%s", convert_output_format(fget_string_var(FORMAT_WHOLEFT_HEADER_FSET), NULL));
if (do_hook(WHOLEFT_LIST, "%s %s %s %ld %s %s", ptr->nicklist->nick, ptr->nicklist->host, ptr->channel, ltime-ptr->time, ptr->server1?ptr->server1:"Unknown", ptr->server2?ptr->server2:"Unknown"))
put_it("%s", convert_output_format(fget_string_var(FORMAT_WHOLEFT_USER_FSET), "%s %s %s %l %s", ptr->nicklist->nick, ptr->nicklist->host, ptr->channel, (long)ltime-ptr->time, ptr->server1?ptr->server1:empty_string));
}
}
}
if (*total)
do_hook(WHOLEFT_FOOTER_LIST, "%s", "End of WhoLeft");
return *hook;
}
开发者ID:BitchX,项目名称:BitchX-SVN,代码行数:25,代码来源:hash.c
示例4: LOCAL_COPY
char *get_help_topic(char *args, int helpfunc)
{
char *new_comm = NULL;
int found = 0, i;
char *others = NULL;
new_comm = LOCAL_COPY(args);
for (i = 0; helpfunc ? script_help[i] : help_index[i]; i++)
{
if (!my_strnicmp(helpfunc?script_help[i]->title:help_index[i]->title, new_comm, strlen(new_comm)))
{
int j;
char *text = NULL;
if (found++)
{
m_s3cat(&others, " , ", helpfunc?script_help[i]->title:help_index[i]->title);
continue;
}
if (args && *args && do_hook(HELPTOPIC_LIST, "%s", args))
put_it("%s",convert_output_format("$G \002$0\002: Help on Topic: \002$1\002", version, args));
for (j = 0; ; j++)
{
if (helpfunc && (script_help[i] && script_help[i]->contents[j]))
text = script_help[i]->contents[j];
else if (!helpfunc && (help_index[i] && help_index[i]->contents[j]))
text = help_index[i]->contents[j];
else
break;
if (text && do_hook(HELPSUBJECT_LIST, "%s %s", new_comm, text))
{
in_chelp++;
put_it("%s", convert_output_format(text, NULL));
in_chelp--;
}
}
text = helpfunc ?script_help[i]->relates:help_index[i]->relates;
if (text && do_hook(HELPTOPIC_LIST, "%s", text))
put_it("%s", convert_output_format(text, NULL));
}
else if (found)
break;
}
if (!found)
{
if (do_hook(HELPTOPIC_LIST, "%s", args))
bitchsay("No help on %s", args);
}
if (others && found)
{
if (do_hook(HELPTOPIC_LIST, "%d %s", found, others))
put_it("Other %d subjects: %s", found - 1, others);
}
new_free(&others);
if (helpfunc)
return m_strdup(empty_string);
return NULL;
}
开发者ID:nikolatesla,项目名称:BitchXMPP,代码行数:60,代码来源:chelp.c
示例5: strftime
/* update_clock: figUres out the current time and returns it in a nice format */
char *update_clock(int flag)
{
static int min = -1,
hour = -1;
static time_t last_minute = -1;
time_t idlet;
static struct tm time_val;
time_t hideous;
int new_minute = 0;
int new_hour = 0;
hideous = now;
#if !defined(NO_CHEATING)
if (hideous / 60 > last_minute)
{
last_minute = hideous / 60;
time_val = *localtime(&hideous);
}
#else
time_val = *localtime(&hideous);
#endif
if (flag == RESET_TIME || time_val.tm_min != min || time_val.tm_hour != hour)
{
if (time_format) /* XXXX Bogus XXXX */
strftime(time_str, 60, time_format, &time_val);
else if (get_int_var(CLOCK_24HOUR_VAR))
strftime(time_str, 60, strftime_24hour, &time_val);
else
strftime(time_str, 60, strftime_12hour, &time_val);
lower(time_str);
if ((time_val.tm_min != min) || (time_val.tm_hour != hour))
{
if (time_val.tm_hour != hour)
new_hour = 1;
new_minute = 1;
hour = time_val.tm_hour;
min = time_val.tm_min;
do_hook(TIMER_LIST, "%02d:%02d", hour, min);
if (min == 0 || new_hour)
do_hook(TIMER_HOUR_LIST, "%02d:%02d", hour, min);
idlet = (hideous - idle_time) / 60L;
do_hook(IDLE_LIST, "%lu", (unsigned long)idlet);
}
if (!((hideous - start_time) % 20))
check_serverlag(-1);
if (flag != RESET_TIME || new_minute)
return time_str;
else
return NULL;
}
if (flag == GET_TIME)
return time_str;
else
return NULL;
}
开发者ID:jnbek,项目名称:TekNap,代码行数:60,代码来源:main.c
示例6: parse_server_notice
static void parse_server_notice(char *from, char *line)
{
int flag = 0;
int up_status = 0;
const char *f;
f = from;
if (!f || !*f)
if (!(f = get_server_itsname(from_server)))
f = get_server_name(from_server);
if (*line != '*' && *line != '#' && strncmp(line, "MOTD ", 4))
flag = 1;
else
flag = 0;
if (do_hook(SERVER_NOTICE_LIST, flag?"%s *** %s":"%s %s", f, line))
{
#ifdef WANT_OPERVIEW
if (handle_oper_vision(f, line, &up_status))
reset_display_target();
else
#endif
if (strstr(line, "***"))
{
set_display_target(NULL, LOG_SNOTE);
#ifdef WANT_OPERVIEW
if (get_int_var(OV_VAR) && !(get_server_ircop_flags(from_server) & SERVER_CRAP))
goto done1;
#endif
if (do_hook(SERVER_NOTICE_LIST, flag ? "%s *** %s" : "%s %s", f, line))
{
char *for_;
for_ = next_arg(line,&line);
serversay(1, from_server, "%s",
convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FSET), "%s %s %s", update_clock(GET_TIME),
f, stripansicodes(line)));
add_last_type(&last_servermsg[0], MAX_LAST_MSG, NULL, NULL, NULL, line);
}
}
else
{
set_display_target(NULL, LOG_SNOTE);
#ifdef WANT_OPERVIEW
if (get_int_var(OV_VAR) && !(get_server_ircop_flags(from_server) & SERVER_CRAP))
goto done1;
#endif
if (do_hook(SERVER_NOTICE_LIST, flag ? "%s *** %s" : "%s %s", f, line))
serversay(1, from_server, "%s",
convert_output_format(fget_string_var(FORMAT_SERVER_NOTICE_FSET), "%s %s %s", update_clock(GET_TIME),
f, stripansicodes(line)));
add_last_type(&last_servermsg[0], MAX_LAST_MSG, NULL, NULL, NULL, line);
}
}
if (up_status)
update_all_status(current_window, NULL, 0);
done1:
reset_display_target();
}
开发者ID:BitchX,项目名称:BitchX1.1,代码行数:59,代码来源:notice.c
示例7: send_ctcp
/*
* This is no longer directly sends information to its target.
* As part of a larger attempt to consolidate all data transmission
* into send_text, this function was modified so as to use send_text().
* This function can send both direct CTCP requests, as well as the
* appropriate CTCP replies. By its use of send_text(), it can send
* CTCPs to DCC CHAT and irc nickname peers, and handles encryption
* transparantly. This greatly reduces the logic, complexity, and
* possibility for error in this function.
*/
void send_ctcp (int type, const char *to, int datatag, const char *format, ...)
{
char putbuf [BIG_BUFFER_SIZE + 1],
*putbuf2;
int len;
int l;
const char *pb;
char *extra = NULL;
/* Make sure that the final \001 doesnt get truncated */
if ((len = IRCD_BUFFER_SIZE - (12 + strlen(to))) <= 0)
return; /* Whatever. */
putbuf2 = alloca(len);
l = message_from(to, LEVEL_CTCP);
if (format)
{
va_list args;
va_start(args, format);
vsnprintf(putbuf, BIG_BUFFER_SIZE, format, args);
va_end(args);
pb = outbound_recode(to, from_server, putbuf, &extra);
do_hook(SEND_CTCP_LIST, "%s %s %s %s",
ctcp_type[type], to,
ctcp_cmd[datatag].name, pb);
snprintf(putbuf2, len, "%c%s %s%c",
CTCP_DELIM_CHAR,
ctcp_cmd[datatag].name, pb,
CTCP_DELIM_CHAR);
new_free(&extra);
}
else
{
do_hook(SEND_CTCP_LIST, "%s %s %s",
ctcp_type[type], to,
ctcp_cmd[datatag].name);
snprintf(putbuf2, len, "%c%s%c",
CTCP_DELIM_CHAR,
ctcp_cmd[datatag].name,
CTCP_DELIM_CHAR);
}
/* XXX - Ugh. What a hack. */
putbuf2[len - 2] = CTCP_DELIM_CHAR;
putbuf2[len - 1] = 0;
send_text(from_server, to, putbuf2, ctcp_type[type], 0, 1);
pop_message_from(l);
}
开发者ID:srfrog,项目名称:epic5,代码行数:62,代码来源:ctcp.c
示例8: report_header_error
void report_header_error(int err)
{
char *s = NULL;
switch (err) {
case GETHDR_ERR:
s = "error reading mpeg bitstream. exiting.";
break;
case GETHDR_NS :
s = "this is a file in MPEG 2.5 format, which is not defined" \
"by ISO/MPEG. It is \"a special Fraunhofer format\"." \
"amp does not support this format. sorry.";
break;
case GETHDR_FL1:
s = "ISO/MPEG layer 1 is not supported by amp (yet).";
break;
case GETHDR_FF :
s = "free format bitstreams are not supported. sorry.";
break;
case GETHDR_SYN:
s = "oops, we're out of sync.";
break;
case GETHDR_EOF:
default: ; /* some stupid compilers need the semicolon */
}
if (s)
do_hook(MODULE_LIST, "AMP ERROR blip %s", s);
}
开发者ID:BitchX,项目名称:BitchX-SVN,代码行数:27,代码来源:audio.c
示例9: p_part
static void p_part(char *from, char **ArgList)
{
char *channel;
if (!from || !*from)
return;
channel = ArgList[0];
PasteArgs(ArgList, 1);
message_from(channel, LOG_CRAP);
in_on_who = 1;
if ((check_ignore(from, FromUserHost, channel, IGNORE_PARTS | IGNORE_CRAP, NULL) != IGNORED) &&
do_hook(LEAVE_LIST, "%s %s %s %s", from, channel, FromUserHost, ArgList[1] ? ArgList[1] : empty_str))
put_it("%s",
convert_output_format(get_format(FORMAT_LEAVE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from, FromUserHost,
channel, ArgList[1] ? ArgList[1] : empty_str));
if (!my_stricmp(from, get_server_nickname(from_server))) {
remove_channel(channel, from_server);
remove_from_mode_list(channel, from_server);
remove_from_join_list(channel, from_server);
set_input_prompt(curr_scr_win, get_string_var(INPUT_PROMPT_VAR), 0);
} else {
remove_from_channel(channel, from, from_server, 0, NULL);
}
update_all_status(curr_scr_win, NULL, 0);
update_input(UPDATE_ALL);
message_from(NULL, LOG_CRAP);
in_on_who = 0;
}
开发者ID:Nicholas-S,项目名称:xaric,代码行数:30,代码来源:parse.c
示例10: p_topic
/* in response to a TOPIC message from the server */
static void p_topic(char *from, char **ArgList)
{
struct channel *tmp;
if (!ArgList[1]) {
fake();
return;
}
tmp = lookup_channel(ArgList[0], from_server, CHAN_NOUNLINK);
malloc_strcpy(&tmp->topic, ArgList[1]);
if (check_ignore(from, FromUserHost, tmp->channel, IGNORE_TOPICS | IGNORE_CRAP, NULL) != IGNORED) {
message_from(ArgList[0], LOG_CRAP);
if (do_hook(TOPIC_LIST, "%s %s %s", from, ArgList[0], ArgList[1])) {
if (ArgList[1] && *ArgList[1]) {
if (get_format(FORMAT_TOPIC_CHANGE_HEADER_FSET))
put_it("%s",
convert_output_format(get_format(FORMAT_TOPIC_CHANGE_HEADER_FSET), "%s %s %s %s", update_clock(GET_TIME),
from, ArgList[0], ArgList[1]));
put_it("%s",
convert_output_format(get_format(FORMAT_TOPIC_CHANGE_FSET), "%s %s %s %s", update_clock(GET_TIME), from,
ArgList[0], ArgList[1]));
} else
put_it("%s",
convert_output_format(get_format(FORMAT_TOPIC_UNSET_FSET), "%s %s %s", update_clock(GET_TIME), from,
ArgList[0]));
}
message_from(NULL, LOG_CRAP);
}
update_all_status(curr_scr_win, NULL, 0);
}
开发者ID:Nicholas-S,项目名称:xaric,代码行数:32,代码来源:parse.c
示例11: debugyell
void debugyell(const char *format, ...)
{
const char *save_from;
unsigned long save_level;
unsigned long old_alias_debug = alias_debug;
alias_debug = 0;
save_display_target(&save_from, &save_level);
set_display_target(NULL, LOG_DEBUG);
if (format)
{
char debugbuf[BIG_BUFFER_SIZE+1];
va_list args;
va_start (args, format);
*debugbuf = 0;
vsnprintf(debugbuf, BIG_BUFFER_SIZE, format, args);
va_end(args);
in_debug_yell = 1;
if (*debugbuf && do_hook(DEBUG_LIST, "%s", debugbuf))
put_echo(debugbuf);
in_debug_yell = 0;
}
alias_debug = old_alias_debug;
reset_display_target();
restore_display_target(save_from, save_level);
}
开发者ID:BitchX,项目名称:BitchX1.1,代码行数:25,代码来源:debug.c
示例12: va_start
static void help_put_it (const char *topic, const char *format, ...)
{
char putbuf[BIG_BUFFER_SIZE * 3 + 1];
if (format)
{
va_list args;
va_start (args, format);
vsnprintf(putbuf, BIG_BUFFER_SIZE * 3, format, args);
va_end(args);
if (do_hook(HELP_LIST, "%s %s", topic, putbuf))
{
Window *old_to_window = to_window;
/*
* 'to_window' is of higher priority than who_level
* so we don't have to mangle who_level to send the
* output to the help window.
*/
if (help_window)
to_window = help_window;
else
to_window = current_window;
add_to_screen(putbuf);
to_window = old_to_window;
}
}
}
开发者ID:carriercomm,项目名称:epic5-1,代码行数:29,代码来源:help.c
示例13: hook_proc
LRESULT CALLBACK
hook_proc(int nCode, WPARAM wParam, LPARAM lParam) {
char hook_type[64];
pthread_t ga_server_thread;
if(module_checked || app_hooked)
return CallNextHookEx(gHook, nCode, wParam, lParam);
if(hook_app() < 0)
return CallNextHookEx(gHook, nCode, wParam, lParam);
// identified the executable: initialize once
if(do_hook(hook_type, sizeof(hook_type)) < 0) {
ga_error("hook_proc: hook failed.\n");
return CallNextHookEx(gHook, nCode, wParam, lParam);
}
// SDL: override controller
if(strcasecmp(hook_type, "sdl") == 0) {
sdl12_mapinit();
ctrl_server_setreplay(sdl_hook_replay_callback);
no_default_controller = 1;
ga_error("hook_proc: sdl - use native replayer.\n");
}
// start hook server
if(pthread_create(&ga_server_thread, NULL, ga_server, NULL) != 0) {
ga_error("cannot create GA server thread\n");
return CallNextHookEx(gHook, nCode, wParam, lParam);
}
pthread_detach(ga_server_thread);
return CallNextHookEx(gHook, nCode, wParam, lParam);
}
开发者ID:hillaker,项目名称:AdvancedNetworking,代码行数:34,代码来源:ga-hook.cpp
示例14: delete_process
/*
* delete_process: Removes the process specifed by index from the process
* list. The does not kill the process, close the descriptors, or any such
* thing. It only deletes it from the list. If appropriate, this will also
* shrink the list as needed
*/
static int delete_process(int process)
{
int flag;
if (process_list) {
if (process >= process_list_size)
return (-1);
if (process_list[process]) {
Process *dead;
dead = process_list[process];
process_list[process] = NULL;
if (process == (process_list_size - 1)) {
int i;
for (i = process_list_size - 1; process_list_size; process_list_size--, i--) {
if (process_list[i])
break;
}
if (process_list_size)
process_list = new_realloc(process_list, Process *, 0, process_list_size);
else {
new_free(&process_list);
process_list = NULL;
}
}
if (dead->logical)
flag = do_hook(EXEC_EXIT_LIST, "%s %d %d", dead->logical, dead->termsig, dead->retcode);
else
flag = do_hook(EXEC_EXIT_LIST, "%d %d %d", process, dead->termsig, dead->retcode);
if (flag) {
if (get_int_var(NOTIFY_ON_TERMINATION_VAR)) {
if (dead->termsig)
say("Process %d (%s) terminated with signal %s (%d)", process, dead->name, sys_siglist[dead->termsig],
dead->termsig);
else
say("Process %d (%s) terminated with return code %d", process, dead->name, dead->retcode);
}
}
new_free(&dead->name);
new_free(&dead->logical);
new_free(&dead->who);
new_free(&dead->redirect);
new_free(&dead);
return (0);
}
开发者ID:Nicholas-S,项目名称:xaric,代码行数:53,代码来源:exec.c
示例15: update_mail_level2_mbox
static void update_mail_level2_mbox (void)
{
Stat stat_buf;
int status;
int count;
status = poll_mbox_status(&stat_buf);
/* There is no mail */
if (status == 0)
{
mail_last_count = 0;
if (mail_last_count_str)
new_free(&mail_last_count_str);
}
/* If our count is invalid or there is new mail, recount mail */
else if (mail_last_count == -1 || status == 2)
{
/* So go ahead and recount the mails in mbox */
count = mbox_count();
if (count == 0)
new_free(&mail_last_count_str);
else
{
malloc_sprintf(&mail_last_count_str, "%d", count);
/*
* If there is new mail, or if we're switching to
* /set mail 2, tell the user how many emails there are.
*/
if (count > mail_last_count)
{
/* This is to avoid $0 in /on mail being wrong. */
if (mail_last_count < 0)
mail_last_count = 0;
if (!mail_latch)
{
mail_latch++;
if (do_hook(MAIL_LIST, "%d %d",
count - mail_last_count, count))
{
int lastlog_level =
set_lastlog_msg_level(LOG_CRAP);
say("You have new email.");
set_lastlog_msg_level(lastlog_level);
}
mail_latch--;
}
}
mbox_last_changed = stat_buf.st_ctime;
mbox_last_size = stat_buf.st_size;
mail_last_count = count;
}
}
}
开发者ID:carriercomm,项目名称:epic4,代码行数:59,代码来源:mail.c
示例16: funny_print_widelist
void funny_print_widelist(void)
{
int i;
char buffer1[BIG_BUFFER_SIZE];
char buffer2[BIG_BUFFER_SIZE];
char *ptr;
if (!wide_list)
return;
if (funny_flags & FUNNY_NAME)
qsort((void *) wide_list, wl_elements, sizeof(WideList *),
(int (*) (const void *, const void *)) funny_widelist_names);
else if (funny_flags & FUNNY_USERS)
qsort((void *) wide_list, wl_elements, sizeof(WideList *),
(int (*) (const void *, const void *)) funny_widelist_users);
set_display_target(NULL, LOG_CRAP);
*buffer1 = '\0';
for (i = 1; i < wl_elements; i++)
{
sprintf(buffer2, "%s(%d) ", wide_list[i]->channel,
wide_list[i]->users);
ptr = strchr(buffer1, '\0');
if (strlen(buffer1) + strlen(buffer2) > current_term->TI_cols - 5)
{
if (do_hook(WIDELIST_LIST, "%s", buffer1))
put_it("%s", convert_output_format(fget_string_var(FORMAT_WIDELIST_FSET), "%s %s", update_clock(GET_TIME), buffer1));
*buffer1 = 0;
strcat(buffer1, buffer2);
}
else
strcpy(ptr, buffer2);
}
if (*buffer1 && do_hook(WIDELIST_LIST, "%s", buffer1))
put_it("%s", convert_output_format(fget_string_var(FORMAT_WIDELIST_FSET), "%s %s", update_clock(GET_TIME), buffer1));
reset_display_target();
for (i = 0; i < wl_elements; i++)
{
new_free(&wide_list[i]->channel);
new_free((char **)&wide_list[i]);
}
new_free((char **)&wide_list);
wl_elements = wl_size = 0;
}
开发者ID:BitchX,项目名称:BitchX1.1,代码行数:46,代码来源:funny.c
示例17: p_silence
static void p_silence(char *from, char **ArgList)
{
char *target = ArgList[0];
char *mag = target++;
if (do_hook(SILENCE_LIST, "%c %s", *mag, target))
put_it("%s", convert_output_format(get_format(FORMAT_SILENCE_FSET), "%s %c %s", update_clock(GET_TIME), *mag, target));
}
开发者ID:Nicholas-S,项目名称:xaric,代码行数:8,代码来源:parse.c
示例18: nap_exit
/* nap_exit: cleans up and leaves */
void nap_exit (int really_quit, char *reason, char *format, ...)
{
if (dead == 1) {
kill_all_threads();
exit(1);
}
else if (dead == 2) {
kill_all_threads();
_exit(1);
}
else if (dead == 3) {
kill_all_threads();
kill(getpid(), SIGKILL);
}
dead++;
set_lastlog_size(NULL, NULL, 0);
set_history_size(NULL, NULL, 0);
if (really_quit)
{
kill_all_threads();
say("Signon time : %s", my_ctime(start_time));
say("Signoff time : %s", my_ctime(now));
say("Total uptime : %s", convert_time(now - start_time));
}
do_hook(EXIT_LIST, "%s", reason ? reason : empty_string);
if (reason)
say("%s", reason);
close_all_servers();
close_all_sockets();
if (term_initialized)
{
cursor_to_input();
term_cr();
term_clear_to_eol();
term_reset();
}
remove_bindings();
clear_variables();
delete_all_windows();
destroy_call_stack();
write_unfinished_list();
debug_cleanup();
fprintf(stdout, "\r");
fflush(stdout);
if (really_quit)
exit(0);
kill_all_threads();
my_signal(SIGABRT, SIG_DFL, 0);
kill(getpid(), SIGABRT);
kill(getpid(), SIGQUIT);
exit(1);
}
开发者ID:jnbek,项目名称:TekNap,代码行数:59,代码来源:main.c
示例19: print_id3_tag
static void print_id3_tag(FILE *fp, char *buf)
{
struct id3tag {
char tag[3];
char title[30];
char artist[30];
char album[30];
char year[4];
char comment[30];
unsigned char genre;
};
struct idxtag {
char tag[3];
char title[90];
char artist[50];
char album[50];
char comment[50];
};
struct id3tag *tag = (struct id3tag *) buf;
struct idxtag *xtag = (struct idxtag *) buf;
char title[121]="\0";
char artist[81]="\0";
char album[81]="\0";
char year[5]="\0";
char comment[81]="\0";
strncpy(title,tag->title,30);
strncpy(artist,tag->artist,30);
strncpy(album,tag->album,30);
strncpy(year,tag->year,4);
strncpy(comment,tag->comment,30);
strunpad(title);
strunpad(artist);
strunpad(album);
strunpad(comment);
if ((fseek(fp, 384, SEEK_END) != -1) && (fread(buf, 256, 1, fp) == 1))
{
if (!strncmp(buf, "TXG", 3))
{
strncat(title, xtag->title, 90);
strncat(artist, xtag->artist, 50);
strncat(album, xtag->album, 50);
strncat(comment, xtag->comment, 50);
strunpad(title);
strunpad(artist);
strunpad(album);
strunpad(comment);
}
}
if (!do_hook(MODULE_LIST, "AMP ID3 \"%s\" \"%s\" \"%s\" %s %d %s", title, artist, album, year, tag->genre, comment))
{
bitchsay("Title : %.120s Artist: %s",title, artist);
bitchsay("Album : %.80s Year: %4s, Genre: %d",album, year, (int)tag->genre);
bitchsay("Comment: %.80s",comment);
}
}
开发者ID:BitchX,项目名称:BitchX-SVN,代码行数:57,代码来源:audio.c
示例20: p_odd
static void p_odd(char *from, char *comm, char **ArgList)
{
PasteArgs(ArgList, 0);
if (do_hook(ODD_SERVER_STUFF_LIST, "%s %s %s", from ? from : "*", comm, ArgList[0])) {
if (from)
say("Odd server stuff: \"%s %s\" (%s)", comm, ArgList[0], from);
else
say("Odd server stuff: \"%s %s\"", comm, ArgList[0]);
}
}
开发者ID:Nicholas-S,项目名称:xaric,代码行数:10,代码来源:parse.c
注:本文中的do_hook函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论