本文整理汇总了C++中write_status函数的典型用法代码示例。如果您正苦于以下问题:C++ write_status函数的具体用法?C++ write_status怎么用?C++ write_status使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buddy_idle_changed_cb
static void
buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle,
void *data)
{
if (idle) {
write_status(buddy, _("%s has become idle: %s (%s)"));
} else {
write_status(buddy, _("%s is no longer idle: %s (%s)"));
}
}
示例2: buddy_idle_changed_cb
static void
buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle,
void *data)
{
if (purple_prefs_get_bool("/plugins/core/statenotify/notify_idle")) {
if (idle) {
write_status(buddy, _("%s has become idle."));
} else {
write_status(buddy, _("%s is no longer idle."));
}
}
}
示例3: restore_sbuf
static int restore_sbuf(struct sbuf *sb, struct bu *arr, int a, int i, const char *tmppath1, const char *tmppath2, enum action act, const char *client, char status, struct cntr *p1cntr, struct cntr *cntr, struct config *cconf)
{
//logp("%s: %s\n", act==ACTION_RESTORE?"restore":"verify", sb->path);
write_status(client, status, sb->path, p1cntr, cntr);
if((sb->datapth && async_write(CMD_DATAPTH,
sb->datapth, strlen(sb->datapth)))
|| async_write(CMD_STAT, sb->statbuf, sb->slen))
return -1;
else if(sb->cmd==CMD_FILE
|| sb->cmd==CMD_ENC_FILE
|| sb->cmd==CMD_METADATA
|| sb->cmd==CMD_ENC_METADATA
|| sb->cmd==CMD_EFS_FILE)
{
return restore_file(arr, a, i, sb->datapth,
sb->path, tmppath1, tmppath2, act,
sb->endfile, sb->cmd, sb->winattr, cntr, cconf);
}
else
{
if(async_write(sb->cmd, sb->path, sb->plen))
return -1;
// If it is a link, send what
// it points to.
else if(sbuf_is_link(sb))
{
if(async_write(sb->cmd, sb->linkto, sb->llen))
return -1;
}
do_filecounter(cntr, sb->cmd, 0);
}
return 0;
}
示例4: write_status_begin_signing
/* Print the BEGIN_SIGNING status message. If MD is not NULL it is
used to retrieve the hash algorithms used for the message. */
void
write_status_begin_signing (gcry_md_hd_t md)
{
if (md)
{
char buf[100];
size_t buflen;
int i;
/* We use a hard coded list of possible algorithms. Using other
algorithms than specified by OpenPGP does not make sense
anyway. We do this out of performance reasons: Walking all
the 110 allowed Ids is not a good idea given the way the
check is implemented in libgcrypt. Recall that the only use
of this status code is to create the micalg algorithm for
PGP/MIME. */
buflen = 0;
for (i=1; i <= 11; i++)
if (i < 4 || i > 7)
if ( gcry_md_is_enabled (md, i) && buflen < DIM(buf) )
{
snprintf (buf+buflen, DIM(buf) - buflen - 1,
"%sH%d", buflen? " ":"",i);
buflen += strlen (buf+buflen);
}
write_status_text ( STATUS_BEGIN_SIGNING, buf );
}
else
write_status ( STATUS_BEGIN_SIGNING );
}
示例5: print_err
static int
print_err(int iErr)
{
write_status(_T(""));
if (iErr == DWNL_E_LASTERROR)
{
if (GetLastError() == ERROR_SUCCESS)
{
/* File not found */
_ftprintf(stderr, _T("\nERROR: Download failed.\n"));
}
else
{
/* Display last error code */
_ftprintf(stderr, _T("\nERROR: %u\n"), GetLastError());
}
}
else
{
switch (iErr)
{
case DWNL_E_NEEDTARGETFILENAME:
_ftprintf(stderr, _T("\nERROR: Cannot determine filename, please specify a destination file name.\n"));
break;
case DWNL_E_UNSUPPORTEDSCHEME:
_ftprintf(stderr, _T("\nERROR: Unsupported protocol.\n"));
break;
}
}
return 1;
}
示例6: write_error
int write_error(http_status status) {
time_t curtime;
char html_error[HTML_ERROR_LENGTH];
char last_modified[HEADER_LINE_LENGTH];
char content_length[HEADER_LINE_LENGTH];
/* maybe the error occured after some data was already
written, so reset the buffer */
response_buffer_size = 0;
/* send current time as lastmodified */
time(&curtime);
strftime(last_modified, HEADER_LINE_LENGTH, DATE_TIME_FORMAT,
gmtime(&curtime));
/* content body */
snprintf(html_error, HTML_ERROR_LENGTH, HTML_ERROR, VERSION, LISTEN_PORT);
snprintf(content_length, HEADER_LINE_LENGTH, "%d", strlen(html_error));
return (write_status(status)
&& write_general_headers()
&& write_header(HEADER_CONTENT_TYPE, "text/html")
&& write_header(HEADER_CONTENT_LENGTH, content_length)
&& write_header(HEADER_LAST_MODIFIED, last_modified)
&& write_data("\r\n", 2)
&& write_data(html_error, strlen(html_error)));
}
示例7: reap_and_check
static int
reap_and_check (void)
{
W_DEBUG ("waiting for a children to reap...\n");
int status;
pid_t pid = waitpid (-1, &status, WNOHANG);
if (pid == cmd_task.pid) {
W_DEBUGC (" reaped cmd process $I\n", (unsigned) pid);
write_status ("cmd exit $L $i\n", (unsigned long) pid, status);
cmd_task.pid = NO_PID;
/*
* If exit-on-success was request AND the process exited ok,
* then we do not want to respawn, but to gracefully shutdown.
*/
if (success_exit && WIFEXITED (status) && WEXITSTATUS (status) == 0) {
W_DEBUGC (" cmd process ended successfully, will exit\n");
running = 0;
}
else {
task_action_queue (&cmd_task, A_START);
}
return status;
}
else if (log_enabled && pid == log_task.pid) {
W_DEBUGC (" reaped log process $I\n", (unsigned) pid);
write_status ("log exit $L $i\n", (unsigned long) pid, status);
log_task.pid = NO_PID;
task_action_queue (&log_task, A_START);
}
else {
W_DEBUGC (" reaped unknown process $I", (unsigned) pid);
}
/*
* For cases where a return status is not meaningful (PIDs other than
* that of the command being run) just return some invalid return code
* value.
*/
return -1;
}
示例8: set_capability
static void set_capability(void)
{
static char buffer[1024];
memset(buffer, 0, sizeof(buffer));
snprintf(buffer, sizeof(buffer) - 1,
"MAC_FOR_CAPABILITY::%s=enforcing\n", capability);
write_status(buffer);
}
示例9: fifo_tick
void fifo_tick(struct bot *bot) {
status_fifo = open("status", O_WRONLY | O_NDELAY);
if (status_fifo != -1) {
write_status(bot);
close(status_fifo);
}
status_fifo = 0;
}
示例10: encode_crypt_files
void
encode_crypt_files(int nfiles, char **files, STRLIST remusr)
{
int rc = 0;
if (opt.outfile)
{
log_error(_("--output doesn't work for this command\n"));
return;
}
if (!nfiles)
{
char line[2048];
unsigned int lno = 0;
while ( fgets(line, DIM(line), stdin) )
{
lno++;
if (!*line || line[strlen(line)-1] != '\n')
{
log_error("input line %u too long or missing LF\n", lno);
return;
}
line[strlen(line)-1] = '\0';
print_file_status(STATUS_FILE_START, line, 2);
if ( (rc = encode_crypt(line, remusr, 0)) )
log_error("encryption of `%s' failed: %s\n",
print_fname_stdin(line), g10_errstr(rc) );
write_status( STATUS_FILE_DONE );
iobuf_ioctl( NULL, 2, 0, NULL); /* Invalidate entire cache. */
}
}
else
{
while (nfiles--)
{
print_file_status(STATUS_FILE_START, *files, 2);
if ( (rc = encode_crypt(*files, remusr, 0)) )
log_error("encryption of `%s' failed: %s\n",
print_fname_stdin(*files), g10_errstr(rc) );
write_status( STATUS_FILE_DONE );
iobuf_ioctl( NULL, 2, 0, NULL); /* Invalidate entire cache. */
files++;
}
}
}
示例11: buddy_status_changed_cb
static void
buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status,
PurpleStatus *status, void *data)
{
g_return_if_fail(buddy != NULL);
g_return_if_fail(status != NULL);
write_status(buddy, NULL);
}
示例12: encrypt_crypt_files
void
encrypt_crypt_files (ctrl_t ctrl, int nfiles, char **files, strlist_t remusr)
{
int rc = 0;
if (opt.outfile)
{
log_error(_("--output doesn't work for this command\n"));
return;
}
if (!nfiles)
{
char line[2048];
unsigned int lno = 0;
while ( fgets(line, DIM(line), stdin) )
{
lno++;
if (!*line || line[strlen(line)-1] != '\n')
{
log_error("input line %u too long or missing LF\n", lno);
return;
}
line[strlen(line)-1] = '\0';
print_file_status(STATUS_FILE_START, line, 2);
rc = encrypt_crypt (ctrl, -1, line, remusr, 0, NULL, -1);
if (rc)
log_error ("encryption of '%s' failed: %s\n",
print_fname_stdin(line), gpg_strerror (rc) );
write_status( STATUS_FILE_DONE );
}
}
else
{
while (nfiles--)
{
print_file_status(STATUS_FILE_START, *files, 2);
if ( (rc = encrypt_crypt (ctrl, -1, *files, remusr, 0, NULL, -1)) )
log_error("encryption of '%s' failed: %s\n",
print_fname_stdin(*files), gpg_strerror (rc) );
write_status( STATUS_FILE_DONE );
files++;
}
}
}
示例13: update_status_bits
static void update_status_bits(struct kcs_bmc *kcs_bmc, u8 mask, u8 val)
{
u8 tmp = read_status(kcs_bmc);
tmp &= ~mask;
tmp |= val & mask;
write_status(kcs_bmc, tmp);
}
示例14: buddy_status_changed_cb
static void
buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status,
PurpleStatus *status, void *data)
{
gboolean available, old_available;
if (!purple_status_is_exclusive(status) ||
!purple_status_is_exclusive(old_status))
return;
available = purple_status_is_available(status);
old_available = purple_status_is_available(old_status);
if (purple_prefs_get_bool("/plugins/core/statenotify/notify_away")) {
if (available && !old_available)
write_status(buddy, _("%s is no longer away."));
else if (!available && old_available)
write_status(buddy, _("%s has gone away."));
}
}
示例15: CBindStatusCallback_UpdateProgress
static void
CBindStatusCallback_UpdateProgress(CBindStatusCallback *This)
{
/* FIXME: better output */
if (This->Size != 0)
{
UINT Percentage;
Percentage = (UINT)((This->Progress * 100) / This->Size);
if (Percentage > 99)
Percentage = 99;
write_status(_T("%2d%% (%I64u bytes downloaded)"), Percentage, This->Progress);
}
else
{
/* Unknown size */
write_status(_T("%I64u bytes downloaded"), This->Progress);
}
}