本文整理汇总了C++中process函数的典型用法代码示例。如果您正苦于以下问题:C++ process函数的具体用法?C++ process怎么用?C++ process使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: F847126
//.........这里部分代码省略.........
des2src(tSavdtl.bill_no,rPack->sphone); //票据号码
if(strlen(tSavdtl.bill_no)<1)
{
*pRetCode=E_INPUT_BILLNO;
goto L_RETU;
}
tSavdtl.card_no=tCard.card_id; //卡号
des2src(tSavdtl.oper_no,rPack->scust_limit); //操作员
tSavdtl.seqno=tradeserial.serial_no; //流水号
des2src(tSavdtl.tx_date,logicdate); //发生日期
des2src(tSavdtl.tx_time,systime); //发生时间
tSavdtl.cnt=1; //票据数量
tSavdtl.bill_type=type; //票据类型
tSavdtl.tx_code=tradeserial.serial_type; //交易码
ret=DB_t_tif_savdtl_add(&tSavdtl);
if(ret)
{
if(DB_REPEAT==ret)
*pRetCode = E_DB_SAVDTL_E;
else
*pRetCode = E_DB_SAVDTL_I;
goto L_RETU;
}
break;
default:
*pRetCode=E_TXCODE_NOT_EXIST;
goto L_RETU;
}
des2src(IA.sArrInActno[0],tAccount.account_id); //帐户
IA.iCardNo=tCard.card_id;
IA.iFeeType=tCustomer.fee_type;
//调用入账子模块
ret=process(&IA,&tradeserial);
if(ret)
{
*pRetCode=ret;
writelog(LOG_ERR,"process ret[%d]",ret);
goto L_RETU;
}
sprintf(out_pack->vsmess,"流水号:%d 卡号:%d ",IA.iSerialNo,IA.iCardNo);
for(i=1;i<=IA.iOutTxTypeCnt;i++)
{
switch(IA.iArrOutTxType[i])
{
case TXTYPE_TOLL_DEPOSIT:
case TXTYPE_TOLL_DEPOSIT_BILL:
case TXTYPE_TOLL_DEPOSIT_FUNDBOOK:
case TXTYPE_DEDUCT_DEPOSIT:
case TXTYPE_RETURN_DEPOSIT:
tradeserial.deposit_fee=IA.dArrOutAmt[i];
break;
case TXTYPE_PRE_TOLL_BOARD:
case TXTYPE_PRE_TOLL_BOARD_BILL:
case TXTYPE_PRE_TOLL_BOARD_FUNDBOOK:
case TXTYPE_TOLL_BOARD:
case TXTYPE_DEDUCT_BOARD:
case TXTYPE_RETURN_BOARD:
case TXTYPE_RETURN_BOARD_BILL:
case TXTYPE_RETURN_BOARD_FUNDBOOK:
tradeserial.boardfee=IA.dArrOutAmt[i];
break;
case TXTYPE_TOLL_CHARGE:
case TXTYPE_TOLL_CHARGE_BILL:
case TXTYPE_TOLL_CHARGE_FUNDBOOK:
tradeserial.in_fee=IA.dArrOutAmt[i];
示例2: process
// returns true if there was new data
bool FileWatch::update()
{
process();
return data.size() > 0;
}
示例3: process
void ui_menu_input::handle()
{
input_item_data *seqchangeditem = nullptr;
const ui_menu_event *menu_event;
int invalidate = false;
/* process the menu */
menu_event = process((pollingitem != nullptr) ? UI_MENU_PROCESS_NOKEYS : 0);
/* if we are polling, handle as a special case */
if (pollingitem != nullptr)
{
input_item_data *item = pollingitem;
/* if UI_CANCEL is pressed, abort */
if (ui_input_pressed(machine(), IPT_UI_CANCEL))
{
pollingitem = nullptr;
record_next = false;
toggle_none_default(item->seq, starting_seq, *item->defseq);
seqchangeditem = item;
}
/* poll again; if finished, update the sequence */
if (machine().input().seq_poll())
{
pollingitem = nullptr;
record_next = true;
item->seq = machine().input().seq_poll_final();
seqchangeditem = item;
}
}
/* otherwise, handle the events */
else if (menu_event != nullptr && menu_event->itemref != nullptr)
{
input_item_data *item = (input_item_data *)menu_event->itemref;
switch (menu_event->iptkey)
{
/* an item was selected: begin polling */
case IPT_UI_SELECT:
pollingitem = item;
last_sortorder = item->sortorder;
starting_seq = item->seq;
machine().input().seq_poll_start((item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, record_next ? &item->seq : nullptr);
invalidate = true;
break;
/* if the clear key was pressed, reset the selected item */
case IPT_UI_CLEAR:
toggle_none_default(item->seq, item->seq, *item->defseq);
record_next = false;
seqchangeditem = item;
break;
}
/* if the selection changed, reset the "record next" flag */
if (item->sortorder != last_sortorder)
record_next = false;
last_sortorder = item->sortorder;
}
/* if the sequence changed, update it */
if (seqchangeditem != nullptr)
{
update_input(seqchangeditem);
/* invalidate the menu to force an update */
invalidate = true;
}
/* if the menu is invalidated, clear it now */
if (invalidate)
{
pollingref = nullptr;
if (pollingitem != nullptr)
{
pollingref = pollingitem->ref;
pollingseq = pollingitem->seqtype;
}
reset(UI_MENU_RESET_REMEMBER_POSITION);
}
}
示例4: Process
Vector Process(const Vector &input) {
assert(input.rows() == numInputs);
NetworkContext ctx;
return process(input, ctx);
}
示例5: signalCompletion
void OscapScannerRemoteSsh::evaluate()
{
if (mDryRun)
{
signalCompletion(mCancelRequested);
return;
}
ensureConnected();
if (mCancelRequested)
{
signalCompletion(true);
return;
}
emit infoMessage(QObject::tr("Querying capabilities on remote machine..."));
{
SshSyncProcess proc(mSshConnection, this);
proc.setCommand(SCAP_WORKBENCH_REMOTE_OSCAP_PATH);
proc.setArguments(QStringList("--v"));
proc.setCancelRequestSource(&mCancelRequested);
proc.run();
if (proc.getExitCode() != 0)
{
emit errorMessage(
QObject::tr("Failed to query capabilities of oscap on local machine.\n"
"Diagnostic info:\n%1").arg(proc.getDiagnosticInfo())
);
mCancelRequested = true;
signalCompletion(mCancelRequested);
return;
}
mCapabilities.parse(proc.getStdOutContents());
}
if (!checkPrerequisites())
{
mCancelRequested = true;
signalCompletion(mCancelRequested);
return;
}
QStringList baseArgs;
baseArgs.append("-o"); baseArgs.append(QString("ControlPath=%1").arg(mSshConnection._getMasterSocket()));
baseArgs.append(mTarget);
QString diagnosticInfo;
emit infoMessage(QObject::tr("Copying input data to remote target..."));
const QString inputFile = copyInputFileOver();
const QString tailoringFile = mSession->hasTailoring() ?
copyFileOver(mSession->getTailoringFilePath()) : QString();
if (mCancelRequested)
{
signalCompletion(true);
return;
}
const QString reportFile = createRemoteTemporaryFile();
const QString resultFile = createRemoteTemporaryFile();
const QString arfFile = createRemoteTemporaryFile();
const QString workingDir = createRemoteTemporaryDirectory();
// TODO: We could be leaking any of the temporary files at this point!
if (mCancelRequested)
{
signalCompletion(true);
return;
}
QStringList args;
if (mScannerMode == SM_OFFLINE_REMEDIATION)
{
args = buildOfflineRemediationArgs(inputFile,
resultFile,
reportFile,
arfFile);
}
else
{
args = buildEvaluationArgs(inputFile,
tailoringFile,
resultFile,
reportFile,
arfFile,
mScannerMode == SM_SCAN_ONLINE_REMEDIATION);
}
const QString sshCmd = args.join(" ");
emit infoMessage(QObject::tr("Starting the remote process..."));
//.........这里部分代码省略.........
示例6: F847104
//.........这里部分代码省略.........
*pRetCode = E_DB_ACCOUNT_U;
}
DB_t_aif_account_free_lock_c0();
ret = getNewUniqNo(KEYTYPE_TRADESERIAL,&dSerialNo); //获得最大流水号
if(ret)
{
*pRetCode=ret;
goto L_RETU;
}
tradeserial.serial_no=D2I(dSerialNo);
tradeserial.serial_type=TXCODE_CHANGE_CARD;
tradeserial.card_id=tCard.card_id; //新卡号
des2src(tradeserial.showid,tCard.showid); //显示卡号
strcpy(IA.sArrInActno[0],tAccount.account_id); //账号
IA.dArrInAmt[0]=tradeserial.trade_fee; //交易金额
IA.iUseCardFlag=USE_CARD_TYPE_ONLINE; //联机交易
IA.dInCardBala=tAccount.cur_freebala; //入卡值
IA.iTxCnt=1;
IA.iCardNo=tCard.card_id;
IA.iFeeType=tCustomer.fee_type;
IA.iArrInFeeSwitch[0]=rPack->lvol0;
IA.iArrInFeeSwitch[1]=rPack->lvol1;
IA.iArrInFeeSwitch[2]=rPack->lvol2;
IA.iArrInFeeSwitch[3]=rPack->lvol3;
IA.iArrInFeeSwitch[4]=rPack->lvol4;
IA.iArrInFeeSwitch[5]=rPack->lvol5;
IA.iArrInFeeSwitch[6]=rPack->lvol6;
IA.iArrInFeeSwitch[7]=rPack->lvol7;
IA.iArrInFeeSwitch[8]=rPack->lvol8;
IA.iArrInFeeSwitch[9]=rPack->lvol9;
IA.iArrInFeeSwitch[10]=rPack->lvol10;
ret=process(&IA,&tradeserial);
if(ret)
{
writelog(LOG_ERR,"process ret[%d]",ret);
*pRetCode=ret;
goto L_RETU;
}
sprintf(out_pack->vsmess,"流水号:%d 卡号:%d ",IA.iSerialNo,IA.iCardNo);
for(i=1;i<=IA.iOutTxTypeCnt;i++)
{
switch(IA.iArrOutTxType[i])
{
case TXTYPE_TOLL_DEPOSIT:
case TXTYPE_DEDUCT_DEPOSIT:
case TXTYPE_RETURN_DEPOSIT:
tradeserial.deposit_fee=IA.dArrOutAmt[i];
break;
case TXTYPE_PRE_TOLL_BOARD:
case TXTYPE_TOLL_BOARD:
case TXTYPE_DEDUCT_BOARD:
case TXTYPE_RETURN_BOARD:
tradeserial.boardfee=IA.dArrOutAmt[i];
break;
case TXTYPE_TOLL_CHARGE:
tradeserial.in_fee=IA.dArrOutAmt[i];
break;
case TXTYPE_TOLL_CARDCOST:
tradeserial.cost_fee=IA.dArrOutAmt[i];
break;
default:
break;
}
if(amtcmp(IA.dArrOutAmt[i],0)!=0)
示例7:
BOOL CScriptEffector::Process (SPPInfo &pp)
{
return (!!process(&pp));
}
示例8: process
void process(std::vector<Entity>& entities) {
for(Entity& e : entities) process(e);
}
示例9: main
int main(int argc, char* const* argv) {
pst_item *item = NULL;
pst_desc_tree *d_ptr;
char *temp = NULL; //temporary char pointer
int c;
char *d_log = NULL;
while ((c = getopt(argc, argv, "d:hV"))!= -1) {
switch (c) {
case 'd':
d_log = optarg;
break;
case 'h':
usage(argv[0]);
exit(0);
break;
case 'V':
version();
exit(0);
break;
default:
usage(argv[0]);
exit(1);
break;
}
}
#ifdef DEBUG_ALL
// force a log file
if (!d_log) d_log = "lspst.log";
#endif // defined DEBUG_ALL
DEBUG_INIT(d_log, NULL);
DEBUG_ENT("main");
if (argc <= optind) {
usage(argv[0]);
exit(2);
}
// Open PST file
if (pst_open(&pstfile, argv[optind], NULL)) DIE(("Error opening File\n"));
// Load PST index
if (pst_load_index(&pstfile)) DIE(("Index Error\n"));
pst_load_extended_attributes(&pstfile);
d_ptr = pstfile.d_head; // first record is main record
item = pst_parse_item(&pstfile, d_ptr, NULL);
if (!item || !item->message_store) {
DEBUG_RET();
DIE(("Could not get root record\n"));
}
// default the file_as to the same as the main filename if it doesn't exist
if (!item->file_as.str) {
if (!(temp = strrchr(argv[1], '/')))
if (!(temp = strrchr(argv[1], '\\')))
temp = argv[1];
else
temp++; // get past the "\\"
else
temp++; // get past the "/"
item->file_as.str = strdup(temp);
item->file_as.is_utf8 = 1;
}
d_ptr = pst_getTopOfFolders(&pstfile, item);
if (!d_ptr) DIE(("Top of folders record not found. Cannot continue\n"));
process(item, d_ptr->child); // do the childred of TOPF
pst_freeItem(item);
pst_close(&pstfile);
DEBUG_RET();
return 0;
}
示例10: process
void process(pst_item *outeritem, pst_desc_tree *d_ptr)
{
struct file_ll ff;
pst_item *item = NULL;
char *result = NULL;
size_t resultlen = 0;
DEBUG_ENT("process");
memset(&ff, 0, sizeof(ff));
create_enter_dir(&ff, outeritem);
while (d_ptr) {
if (!d_ptr->desc) {
DEBUG_WARN(("ERROR item's desc record is NULL\n"));
ff.skip_count++;
}
else {
DEBUG_INFO(("Desc Email ID %"PRIx64" [d_ptr->d_id = %"PRIx64"]\n", d_ptr->desc->i_id, d_ptr->d_id));
item = pst_parse_item(&pstfile, d_ptr, NULL);
DEBUG_INFO(("About to process item @ %p.\n", item));
if (item) {
if (item->message_store) {
// there should only be one message_store, and we have already done it
DIE(("A second message_store has been found. Sorry, this must be an error.\n"));
}
if (item->folder && d_ptr->child) {
// if this is a folder, we want to recurse into it
pst_convert_utf8(item, &item->file_as);
printf("Folder \"%s\"\n", item->file_as.str);
process(item, d_ptr->child);
} else if (item->contact && (item->type == PST_TYPE_CONTACT)) {
if (!ff.type) ff.type = item->type;
// Process Contact item
if (ff.type != PST_TYPE_CONTACT) {
DEBUG_INFO(("I have a contact, but the folder isn't a contacts folder. Processing anyway\n"));
}
printf("Contact");
if (item->contact->fullname.str)
printf("\t%s", pst_rfc2426_escape(item->contact->fullname.str, &result, &resultlen));
printf("\n");
} else if (item->email && ((item->type == PST_TYPE_NOTE) || (item->type == PST_TYPE_SCHEDULE) || (item->type == PST_TYPE_REPORT))) {
if (!ff.type) ff.type = item->type;
// Process Email item
if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_SCHEDULE) && (ff.type != PST_TYPE_REPORT)) {
DEBUG_INFO(("I have an email, but the folder isn't an email folder. Processing anyway\n"));
}
printf("Email");
if (item->email->outlook_sender_name.str)
printf("\tFrom: %s", item->email->outlook_sender_name.str);
if (item->subject.str)
printf("\tSubject: %s", item->subject.str);
printf("\n");
} else if (item->journal && (item->type == PST_TYPE_JOURNAL)) {
if (!ff.type) ff.type = item->type;
// Process Journal item
if (ff.type != PST_TYPE_JOURNAL) {
DEBUG_INFO(("I have a journal entry, but folder isn't specified as a journal type. Processing...\n"));
}
if (item->subject.str)
printf("Journal\t%s\n", pst_rfc2426_escape(item->subject.str, &result, &resultlen));
} else if (item->appointment && (item->type == PST_TYPE_APPOINTMENT)) {
char time_buffer[30];
if (!ff.type) ff.type = item->type;
// Process Calendar Appointment item
DEBUG_INFO(("Processing Appointment Entry\n"));
if (ff.type != PST_TYPE_APPOINTMENT) {
DEBUG_INFO(("I have an appointment, but folder isn't specified as an appointment type. Processing...\n"));
}
printf("Appointment");
if (item->subject.str)
printf("\tSUMMARY: %s", pst_rfc2426_escape(item->subject.str, &result, &resultlen));
if (item->appointment->start)
printf("\tSTART: %s", pst_rfc2445_datetime_format(item->appointment->start, sizeof(time_buffer), time_buffer));
if (item->appointment->end)
printf("\tEND: %s", pst_rfc2445_datetime_format(item->appointment->end, sizeof(time_buffer), time_buffer));
printf("\tALL DAY: %s", (item->appointment->all_day==1 ? "Yes" : "No"));
printf("\n");
} else {
ff.skip_count++;
DEBUG_INFO(("Unknown item type. %i. Ascii1=\"%s\"\n",
item->type, item->ascii_type));
}
pst_freeItem(item);
} else {
ff.skip_count++;
DEBUG_INFO(("A NULL item was seen\n"));
}
}
d_ptr = d_ptr->next;
}
close_enter_dir(&ff);
if (result) free(result);
DEBUG_RET();
//.........这里部分代码省略.........
示例11: main
int
main(int argc, char *argv[])
{
int c, fflag;
char *temp_arg;
(void) setlocale(LC_ALL, "");
#ifndef TEXT_DOMAIN
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
fflag = 0;
inplace = NULL;
while ((c = getopt_long(argc, argv, "EI::ae:f:i::lnr", lopts, NULL)) !=
-1)
switch (c) {
case 'r': /* Gnu sed compat */
case 'E':
rflags = REG_EXTENDED;
break;
case 'I':
if (optarg != NULL)
inplace = optarg;
else
inplace = "";
ispan = 1; /* span across input files */
break;
case 'a':
aflag = 1;
break;
case 'e':
eflag = 1;
if (asprintf(&temp_arg, "%s\n", optarg) < 1)
err(1, "asprintf");
add_compunit(CU_STRING, temp_arg);
break;
case 'f':
fflag = 1;
add_compunit(CU_FILE, optarg);
break;
case 'i':
if (optarg != NULL)
inplace = optarg;
else
inplace = "";
ispan = 0; /* don't span across input files */
break;
case 'l':
/* On SunOS, setlinebuf "returns no useful value */
(void) setlinebuf(stdout);
break;
case 'n':
nflag = 1;
break;
default:
case '?':
usage();
}
argc -= optind;
argv += optind;
/* First usage case; script is the first arg */
if (!eflag && !fflag && *argv) {
add_compunit(CU_STRING, *argv);
argv++;
}
compile();
/* Continue with first and start second usage */
if (*argv)
for (; *argv; argv++)
add_file(*argv);
else
add_file(NULL);
process();
cfclose(prog, NULL);
if (fclose(stdout))
err(1, "stdout");
return (rval);
}
示例12: process
static int
process(const char *file)
{
char *cp;
int c;
char fname[BUFSIZ];
FILE *soee;
int isfile;
if (!strcmp(file, STDIN_NAME)) {
soee = stdin;
} else {
soee = fopen(file, "r");
if (soee == NULL) {
warn("%s", file);
return(-1);
}
}
for (;;) {
c = getc(soee);
if (c == EOF)
break;
if (c != '.')
goto simple;
c = getc(soee);
if (c != 's') {
putchar('.');
goto simple;
}
c = getc(soee);
if (c != 'o') {
printf(".s");
goto simple;
}
do
c = getc(soee);
while (c == ' ' || c == '\t');
cp = fname;
isfile = 0;
for (;;) {
switch (c) {
case ' ':
case '\t':
case '\n':
case EOF:
goto donename;
default:
*cp++ = c;
c = getc(soee);
isfile++;
continue;
}
}
donename:
if (cp == fname) {
printf(".so");
goto simple;
}
*cp = 0;
if (process(fname) < 0)
if (isfile)
printf(".so %s\n", fname);
continue;
simple:
if (c == EOF)
break;
putchar(c);
if (c != '\n') {
c = getc(soee);
goto simple;
}
}
if (soee != stdin) {
fclose(soee);
}
return(0);
}
示例13: DS2ASSERT
void Thread::updateState(DEBUG_EVENT const &de) {
DS2ASSERT(de.dwThreadId == _tid);
switch (de.dwDebugEventCode) {
case EXCEPTION_DEBUG_EVENT:
_state = kStopped;
_trap.event = StopInfo::kEventTrap;
_trap.reason = StopInfo::kReasonNone;
break;
case LOAD_DLL_DEBUG_EVENT: {
ErrorCode error;
std::wstring name = L"<NONAME>";
ProcessInfo pi;
error = process()->getInfo(pi);
if (error != kSuccess)
goto noname;
if (de.u.LoadDll.lpImageName == nullptr)
goto noname;
uint64_t ptr = 0;
error = process()->readMemory(
reinterpret_cast<uint64_t>(de.u.LoadDll.lpImageName), &ptr,
pi.pointerSize);
if (error != kSuccess)
goto noname;
if (ptr == 0)
goto noname;
// It seems like all strings passed by the kernel here are guaranteed to be
// unicode.
DS2ASSERT(de.u.LoadDll.fUnicode);
name.clear();
wchar_t c;
do {
error = process()->readMemory(ptr, &c, sizeof(c));
if (error != kSuccess)
break;
name.append(1, c);
ptr += sizeof(c);
} while (c != '\0');
noname:
DS2LOG(Debug, "new DLL loaded: %s",
Host::Platform::WideToNarrowString(name).c_str());
if (de.u.LoadDll.hFile != NULL)
CloseHandle(de.u.LoadDll.hFile);
}
case UNLOAD_DLL_DEBUG_EVENT:
case OUTPUT_DEBUG_STRING_EVENT:
_state = kStopped;
_trap.event = StopInfo::kEventNone;
_trap.reason = StopInfo::kReasonNone;
break;
default:
DS2BUG("unknown debug event code: %d", de.dwDebugEventCode);
}
}
示例14: main
int main(int argc, const char * argv[])
{
const char * hex = "0123456789abcdef";
self = basename((char*)argv[0]);
for (int ai = 1; ai < argc; ai++) {
const char * src = argv[ai];
display_mode[ai] = NULL;
if (!strcmp(argv[ai], "--loop")) {
bus = 4;
msg[0].addr = 0x55;
msg_count = 1;
while (1) {
process();
sleep(1);
}
}
while (*src) {
char c = *src++;
switch (c) {
case '=': {
if (process() > 0)
display();
bus = 0;
while (isdigit(*src))
bus = (bus * 10) + (*src++ - '0');
} break;
case '@': {
if (process() > 0)
display();
address = 0;
while (isxdigit(*src))
address = (address << 4) | (int)(strchr(hex, tolower(*src++)) - hex);
// printf("Set address to 0x%2x\n", address);
} break;
case 'w': {
msg[msg_count].addr = address;
msg[msg_count].flags = 0;
msg[msg_count].len = 0;
msg[msg_count].buf = write_ptr;
while (isxdigit(src[0]) && isxdigit(src[1])) {
uint8_t byte = ((strchr(hex, tolower(src[0])) - hex) << 4) |
(int)(strchr(hex, tolower(src[1])) - hex);
src += 2;
*write_ptr++ = byte;
msg[msg_count].len++;
}
if (msg[msg_count].len) {
// printf("Write %d bytes : ", msg[msg_count].len);
// for (int i = 0; i < msg[msg_count].len; i++)
// printf("%02x", msg[msg_count].buf[i]);
// printf("\n");
msg_count++;
} else {
fprintf(stderr, "%s: Warning '%s' won't write anything\n", self, argv[ai]);
}
} break;
case 'r': {
msg[msg_count].addr = address;
msg[msg_count].flags = I2C_M_RD;
msg[msg_count].len = 0;
msg[msg_count].buf = write_ptr;
display_mode[msg_count] = src; // keep it around for display
int count = 0;
while (*src) {
switch (*src) {
case '0' ... '9' :
count = (count*10) + (*src++ - '0');
break;
case 'b':
count = count ? count : 1;
msg[msg_count].len += count;
write_ptr += count;
count = 0;
src++;
break;
case 's':
count = count ? count * 2 : 2;
msg[msg_count].len += count;
write_ptr += count;
count = 0;
src++;
break;
case 't': // temperature
count = 2;
msg[msg_count].len += count;
write_ptr += count;
count = 0;
src++;
break;
case 'l':
count = count ? count * 4 : 4;
msg[msg_count].len += count;
write_ptr += count;
count = 0;
//.........这里部分代码省略.........
示例15: main
//.........这里部分代码省略.........
exit(1);
else
flog(LOG_WARNING, "Insecure file permissions, but continuing anyway");
}
/* if we know how to do it, check whether forwarding is enabled */
if (check_ip6_forwarding()) {
if (get_debuglevel() == 0) {
flog(LOG_ERR, "IPv6 forwarding seems to be disabled, exiting");
exit(1);
}
else
flog(LOG_WARNING, "IPv6 forwarding seems to be disabled, but continuing anyway.");
}
#endif
/* parse config file */
if (readin_config(conf_file) < 0)
exit(1);
/* FIXME: not atomic if pidfile is on an NFS mounted volume */
if ((fd = open(pidfile, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
{
flog(LOG_ERR, "another radvd seems to be already running, terminating");
exit(1);
}
/*
* okay, config file is read in, socket and stuff is setup, so
* lets fork now...
*/
#if 0 //brcm
if (get_debuglevel() == 0) {
/* Detach from controlling terminal */
if (daemon(0, 0) < 0)
perror("daemon");
/* close old logfiles, including stderr */
log_close();
/* reopen logfiles, but don't log to stderr unless explicitly requested */
if (log_method == L_STDERR_SYSLOG)
log_method = L_SYSLOG;
if (log_open(log_method, pname, logfile, facility) < 0)
exit(1);
}
#endif
/*
* config signal handlers, also make sure ALRM isn't blocked and raise a warning if so
* (some stupid scripts/pppd appears to do this...)
*/
sigemptyset(&nset);
sigaddset(&nset, SIGALRM);
sigprocmask(SIG_UNBLOCK, &nset, &oset);
if (sigismember(&oset, SIGALRM))
flog(LOG_WARNING, "SIGALRM has been unblocked. Your startup environment might be wrong.");
signal(SIGHUP, sighup_handler);
signal(SIGTERM, sigterm_handler);
signal(SIGINT, sigint_handler);
snprintf(pidstr, sizeof(pidstr), "%d\n", getpid());
write(fd, pidstr, strlen(pidstr));
close(fd);
config_interface();
kickoff_adverts();
/* enter loop */
for (;;)
{
int len, hoplimit;
struct sockaddr_in6 rcv_addr;
struct in6_pktinfo *pkt_info = NULL;
len = recv_rs_ra(sock, msg, &rcv_addr, &pkt_info, &hoplimit);
if (len > 0)
process(sock, IfaceList, msg, len,
&rcv_addr, pkt_info, hoplimit);
if (sigterm_received || sigint_received) {
stop_adverts();
break;
}
if (sighup_received)
{
reload_config();
sighup_received = 0;
}
}
unlink(pidfile);
exit(0);
}