本文整理汇总了C++中setstatus函数的典型用法代码示例。如果您正苦于以下问题:C++ setstatus函数的具体用法?C++ setstatus怎么用?C++ setstatus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setstatus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recruit_dracoids
static void recruit_dracoids(unit * dragon, int size)
{
faction *f = dragon->faction;
region *r = dragon->region;
const struct item *weapon = NULL;
order *new_order = NULL;
unit *un = create_unit(r, f, size, get_race(RC_DRACOID), 0, NULL, NULL);
fset(un, UFL_ISNEW | UFL_MOVED);
name_unit(un);
change_money(dragon, -un->number * 50);
equip_unit(un, get_equipment("recruited_dracoid"));
setstatus(un, ST_FIGHT);
for (weapon = un->items; weapon; weapon = weapon->next) {
const weapon_type *wtype = weapon->type->rtype->wtype;
if (wtype && (wtype->flags & WTF_MISSILE)) {
setstatus(un, ST_BEHIND);
}
new_order = create_order(K_STUDY, f->locale, "'%s'",
skillname(weapon->type->rtype->wtype->skill, f->locale));
}
if (new_order != NULL) {
addlist(&un->orders, new_order);
}
}
示例2: execshift
void
execshift(void)
{
int n;
word *a;
var *star;
switch(count(runq->argv->words)){
default:
pfmt(err, "Usage: shift [n]\n");
setstatus("shift usage");
poplist();
return;
case 2:
n = atoi(runq->argv->words->next->word);
break;
case 1:
n = 1;
break;
}
star = vlook("*");
for(;n && star->val;--n){
a = star->val->next;
efree(star->val->word);
efree((char *)star->val);
star->val = a;
star->changed = 1;
}
setstatus("");
poplist();
}
示例3: noit_snmp_trapvars_to_stats
static int
noit_snmp_trapvars_to_stats(stats_t *current, netsnmp_variable_list *var) {
if(isoidprefix(var->name, var->name_length, reconnoiter_check_status_oid,
reconnoiter_check_status_oid_len)) {
if(var->type == ASN_OBJECT_ID) {
if(isoid(var->name, var->name_length,
reconnoiter_check_state_oid, reconnoiter_check_state_oid_len)) {
oid *o = var->val.objid;
size_t l = var->val_len / sizeof(*o);
setstatus(state, reconnoiter_check_state_unknown_oid, NP_UNKNOWN);
else setstatus(state, reconnoiter_check_state_good_oid, NP_GOOD);
else setstatus(state, reconnoiter_check_state_bad_oid, NP_BAD);
else return -1;
示例4: Xpipewait
void
Xpipewait(void)
{
char status[NSTATUS+1];
if(runq->pid==-1)
setstatus(concstatus(runq->status, getstatus()));
else{
strncpy(status, getstatus(), NSTATUS);
status[NSTATUS]='\0';
Waitfor(runq->pid, 1);
runq->pid=-1;
setstatus(concstatus(getstatus(), status));
}
}
示例5: execnewpgrp
void
execnewpgrp(void)
{
int arg;
char *s;
switch(count(runq->argv->words)){
case 1:
arg = RFENVG|RFNAMEG|RFNOTEG;
break;
case 2:
arg = 0;
for(s = runq->argv->words->next->word;*s;s++) switch(*s){
default:
goto Usage;
case 'n':
arg|=RFNAMEG; break;
case 'N':
arg|=RFCNAMEG;
break;
case 'm':
arg|=RFNOMNT; break;
case 'e':
arg|=RFENVG; break;
case 'E':
arg|=RFCENVG; break;
case 's':
arg|=RFNOTEG; break;
case 'f':
arg|=RFFDG; break;
case 'F':
arg|=RFCFDG; break;
}
break;
default:
Usage:
pfmt(err, "Usage: %s [fnesFNEm]\n", runq->argv->words->word);
setstatus("rfork usage");
poplist();
return;
}
if(rfork(arg)==-1){
pfmt(err, "rc: %s failed\n", runq->argv->words->word);
setstatus("rfork failed");
}
else
setstatus("");
poplist();
}
示例6: main
int main(void) {
char *status;
float cpu0, cpu1;
char *datetime;
int bat0;
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "Cannot open display.\n");
return 1;
}
if((status = malloc(200)) == NULL)
exit(1);
for (;;sleep(1)) {
cpu0 = getfreq("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq");
cpu1 = getfreq("/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq");
datetime = getdatetime();
bat0 = getbattery();
snprintf(status, 200, "%0.2f, %0.2f | %d%% | %s", cpu0, cpu1, bat0, datetime);
free(datetime);
setstatus(status);
}
free(status);
XCloseDisplay(dpy);
return 0;
}
示例7: QGLWidget
MyWidget::MyWidget(QGLWidget *parent)
: QGLWidget(QGLFormat(), parent)
{
setMouseTracking(true);
setPaletteBackgroundColor(QColor(255,255,255));
setstatus();
menu = new QMenuBar(this, "Menu bar");
file = new QPopupMenu( this , "file");
save = new QPopupMenu( this , "save");
placement = new QPopupMenu( this , "placement");
options = new QPopupMenu( this , "options");
view = new QPopupMenu( this , "viewing");
save->insertItem( "Save &eps file", this, SLOT(savedepsfile()), CTRL+Key_E );
save->insertItem( "Save &stl file", this, SLOT(savedstlfile()), CTRL+Key_S );
file->insertItem( "&Load", this, SLOT(openedfile()), CTRL+Key_L );
generate_id = placement->insertItem( "&Generate", &p, SLOT(generate()), CTRL+Key_G );
generatefirst_id = placement->insertItem( "Generate &First", &p, SLOT(generateFirst()), CTRL+Key_F );
generatenext_id = placement->insertItem( "Generate &Next", &p, SLOT(generateNext()), CTRL+Key_N );
generateten_id = placement->insertItem( "Next &ten streamlines", &p, SLOT(generateTen()), CTRL+Key_T );
generateresume_id = placement->insertItem( "&Resume the placement", &p, SLOT(generateAll()), CTRL+Key_C );
clear_id = placement->insertItem( "&Clear", &p, SLOT(purge()), CTRL+Key_M );
drawstl_id = view->insertItem( "&Draw streamlines", &p, SLOT(draw_stl()), CTRL+Key_D );
drawpq_id = view->insertItem( "Draw &queue elements", &p, SLOT(draw_pq()), CTRL+Key_Q );
drawtr_id = view->insertItem( "Draw t&riangulation", &p, SLOT(draw_tr()), CTRL+Key_R );
drawbc_id = view->insertItem( "Draw &biggest circle", &p, SLOT(draw_bc()), CTRL+Key_B );
addimage_id = placement->insertItem( "&Image", this, SLOT(openedimage()), CTRL+Key_I );
options->insertItem( "Density...", &p, SLOT(density()));
options->insertItem( "Saturation ration...", &p, SLOT(ratio()));
options->insertItem( "Sampling step...", &p, SLOT(sampling()));
options->insertItem( "Integrating step...", &p, SLOT(integrating()));
placement->insertItem( "&Options ", options );
save_id = file->insertItem( "&Save", save );
menu->insertItem( "&File", file );
menu->insertItem( "&Placement", placement );
view_id = menu->insertItem( "&View ", view );
file->insertItem( "&Quit", qApp, SLOT(quit()), ALT+Key_F4 );
// desable all generator menu items
placement->setItemEnabled(generate_id, false);
placement->setItemEnabled(generatefirst_id, false);
placement->setItemEnabled(generatenext_id, false);
placement->setItemEnabled(generateten_id, false);
placement->setItemEnabled(generateresume_id, false);
placement->setItemEnabled(clear_id, false);
menu->setItemEnabled(view_id, false);
placement->setItemEnabled(addimage_id, false);
file->setItemEnabled(save_id, false);
connect(this, SIGNAL(fileloaded(const QString &)), &p, SLOT(load(const QString &)));
connect(this, SIGNAL(imageloaded(const QString &)), &p, SLOT(image(const QString &)));
connect(&p, SIGNAL(optionschanged()), this, SLOT(updatestatus()));
}
示例8: Exit
void
Exit(char *stat)
{
Updenv();
setstatus(stat);
exits(truestatus()?"":getstatus());
}
示例9: Waitfor
int
Waitfor(int pid, int n)
{
thread *p;
Waitmsg *w;
char errbuf[ERRMAX];
if(pid >= 0 && !havewaitpid(pid))
return 0;
while((w = wait()) != nil){
delwaitpid(w->pid);
if(w->pid==pid){
setstatus(w->msg);
free(w);
return 0;
}
for(p = runq->ret;p;p = p->ret)
if(p->pid==w->pid){
p->pid=-1;
strcpy(p->status, w->msg);
}
free(w);
}
errstr(errbuf, sizeof errbuf);
if(strcmp(errbuf, "interrupted")==0) return -1;
return 0;
}
示例10: execflag
void
execflag(void)
{
char *letter, *val;
switch(count(runq->argv->words)){
case 2:
setstatus(flag[(uchar)runq->argv->words->next->word[0]]?"":"flag not set");
break;
case 3:
letter = runq->argv->words->next->word;
val = runq->argv->words->next->next->word;
if(strlen(letter)==1){
if(strcmp(val, "+")==0){
flag[(uchar)letter[0]] = flagset;
break;
}
if(strcmp(val, "-")==0){
flag[(uchar)letter[0]] = 0;
break;
}
}
default:
Xerror1("Usage: flag [letter] [+-]");
return;
}
poplist();
}
示例11: main
int
main(void)
{
struct items {
char *up;
char *load;
char *fan;
char *temp;
char *mem;
char *swap;
char *diskio;
char *fs_root;
char *fs_home;
char *fs_storage;
char *net_speed;
char *batt;
char *vol;
char *time;
char *status;
};
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "dwmstatus: cannot open display.\n");
return 1;
}
struct items *i = malloc(sizeof(struct items));
while(1) {
i->up = get_up();
i->load = get_load();
i->fan = get_fan();
i->temp = get_temp();
i->mem = get_mem();
i->swap = get_swap();
i->diskio = get_diskio("sda");
i->fs_root = get_space("/");
i->fs_home = get_space("/home");
i->net_speed = get_net_speed();
i->batt = get_batt();
i->vol = get_vol();
i->time = mktimes("%m/%d/%Y %a %H:%M", tzkiev);
i->status = smprintf(
"up:%s la:%s fan:%s temp:%s m:%s s:%s io:%s /:%s "
"~/:%s net:%s bat:%s vol:%s %s",
i->up, i->load, i->fan, i->temp, i->mem, i->swap,
i->diskio, i->fs_root, i->fs_home, i->net_speed,
i->batt, i->vol, i->time);
setstatus(i->status);
sleep(INTERVAL);
}
free(i);
XCloseDisplay(dpy);
return EXIT_SUCCESS;
}
示例12: main
int main(void) {
char status[100];
int l = 0;
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "Cannot open display.\n");
return 1;
}
for (;;sleep(2)) {
l = getcpu(status, sizeof(status));
l += gettemp(status + l, sizeof(status) - l);
l += getmem(status + l, sizeof(status) - l);
l += getnetwork(status + l, sizeof(status) - l);
l += getbattery(status + l, sizeof(status) - l);
l += getvol(status + l, sizeof(status) - l);
l += getdatetime(status + l, sizeof(status) - l);
setstatus(status);
}
free(status);
XCloseDisplay(dpy);
return 0;
}
示例13: Xmatch
void
Xmatch(void)
{
word *p;
char *subject;
subject = list2str(runq->argv->words);
setstatus("no match");
for(p = runq->argv->next->words;p;p = p->next)
if(match(subject, p->word, '\0')){
setstatus("");
break;
}
efree(subject);
poplist();
poplist();
}
示例14: main
int main(void) {
char *status;
char *avgs;
char *tmar;
char *tmutc;
char *tmbln;
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "dwmstatus: cannot open display.\n");
return 1;
}
for (;;sleep(3)) {
avgs = loadavg();
tmar = mktimes("%H:%M", tzargentina);
tmutc = mktimes("%H:%M", tzutc);
tmbln = mktimes("KW %W %a %d %b %H:%M %Z %Y", tzberlin);
status = smprintf("L:%s A:%s ◷ %s", avgs, tmar, tmutc);
setstatus(status);
free(avgs);
free(tmar);
free(tmutc);
free(tmbln);
free(status);
}
XCloseDisplay(dpy);
return 0;
}
示例15: main
int
main(void)
{
char tmnyc[128];
char avgs[128];
char *status;
int warn = 0;
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "dwmstatus: cannot open display.\n");
return 1;
}
for (;;sleep(2)) {
loadavg(avgs, 128);
warn = mktimes(tmnyc, 128, "%a, %B %d, %R", tznyc);
if (warn) {
status = smprintf("[L: %s | \x04%s\x01]", avgs, tmnyc);
}
else {
status = smprintf("[L: %s | %s]", avgs, tmnyc);
}
setstatus(status);
free(status);
}
XCloseDisplay(dpy);
return 0;
}