void start() { if (!CHEAT) { level1(); return; } init_map(); int goal = count_goal(); if (goal == 0) { myprintf("It's impossible to win the game.\n"); } else if (play(goal)) { myprintf("Congraz! You pass %d! XD\n", goal); set_bestscore(); } else myprintf("You lose. What a pity.\n"); }
int main() { char a[10] = "Misoralv"; char b[10] = "Klose"; int a1 = 14; int n = myprintf("%s %s, his WorldCup goals reach %d.", a,b,a1); printf("n=%d\n",n); return 0; }
//----- (00002C00) -------------------------------------------------------- __myevic__ uint32_t hidResetParamCmd( CMD_T *pCmd ) { myprintf("Reset param\n"); ResetDataFlash(); UpdateDataFlash(); gFlags.refresh_display = 1; pCmd->u8Cmd = 0; return 0; }
/* ***************************************************************************** Set the buffer length and terminate the buffer with a \0(null) character. ***************************************************************************** */ void API_set_datalen( API_Header_Def *pAPI_buffer, long bufflen ) { char *pEndPtr; char localbuffer[DATA_LEN_FIELD+1]; if (pSCHEDULER_CONFIG_FLAGS.debug_level.api >= DEBUG_LEVEL_PROC) { myprintf( "DEBUG: Entered API_set_datalen\n" ); } UTILS_number_to_string( bufflen, (char *)&localbuffer, DATA_LEN_FIELD ); strncpy( pAPI_buffer->API_Data_Len, localbuffer, DATA_LEN_FIELD ); pEndPtr = (char *)&pAPI_buffer->API_Data_Buffer; pEndPtr = pEndPtr + bufflen; *pEndPtr = '\0'; if (pSCHEDULER_CONFIG_FLAGS.debug_level.api >= DEBUG_LEVEL_PROC) { myprintf( "DEBUG: Leaving API_set_datalen\n" ); } } /* API_set_datalen */
bool takeover() { bool activate = false; if (gim_backup) { myprintf("mark primary down, takeover and start backup.\n"); gpeer_nid = -1; gpeer_pid = -1; gim_backup = false; strcpy(gdisplay_name, gname); strcat(gdisplay_name, "-P(B)"); activate = true; } else { myprintf("mark backup down and restart backup.\n"); start_backup(-1); } return activate; }
int recv(void *buf, int *size) { int *lbuf; int ferr; int lerr; bool mon_msg; int nid; int pid; do { do { lerr = XWAIT(LREQ, -1); TEST_CHK_WAITIGNORE(lerr); lerr = XMSG_LISTEN_((short *) &gsre, // sre 0, // listenopts 0); // listenertag } while (lerr == XSRETYPE_NOWORK); mon_msg = (gsre.sre_flags & XSRE_MON); if (mon_msg) { int msg_size = gsre.sre_reqDataSize; char *msg = new char[msg_size]; ferr = XMSG_READDATA_(gsre.sre_msgId, // msgid msg, // reqdata (ushort) msg_size); // bytecount assert(ferr == XZFIL_ERR_OK); check_mon_msg(msg); XMSG_REPLY_(gsre.sre_msgId, // msgid NULL, // replyctrl 0, // replyctrlsize NULL, // replydata 0, // replydatasize 0, // errorclass NULL); // newphandle delete [] msg; if (gtakeover) return 1; } else { ferr = XMSG_READDATA_(gsre.sre_msgId, // msgid (char *) buf, // reqctrl (ushort) *size); // bytecount assert(ferr == XZFIL_ERR_OK); *size = gsre.sre_reqDataSize; ferr = XMSG_GETREQINFO_(MSGINFO_NID, gsre.sre_msgId, &nid); assert(ferr == XZFIL_ERR_OK); ferr = XMSG_GETREQINFO_(MSGINFO_PID, gsre.sre_msgId, &pid); assert(ferr == XZFIL_ERR_OK); lbuf = (int *) buf; myprintf("received from p-id=%d/%d: %d.%d.%d\n", nid, pid, lbuf[0], lbuf[1], lbuf[2]); } } while (mon_msg); return 0; }
/* This function creates the handler used by the edWeb server * to send the job to the module. */ handlerList *createHandler(myModule *mod) { handlerList *start, *work; /* Hand Helper settings */ handlerHelper_t handHelper = { .cmd = "^PRIVMSG.*$", .value = "^lydiaise.*$", .nick = NULL, .cmdArg = NULL, .host = NULL, .user = NULL }; start = NULL; /* Handler lydiaise */ if ( (work = addHandlerHelper(start, &handHelper, "lydia", mod)) != NULL) start = work; /* Handler verlan */ handHelper.value = "^verlan.*$"; if ( (work = addHandlerHelper(start, &handHelper, "verlan", mod)) != NULL) start = work; /* Handler leet sp34k */ handHelper.value = "^leet.*$"; if ( (work = addHandlerHelper(start, &handHelper, "leet", mod)) != NULL) start = work; /* Handler verif palin */ handHelper.value = "^verifPalin.*$"; if ( (work = addHandlerHelper(start, &handHelper, "verifPalin", mod)) != NULL) start = work; /* Done ?! Too easy !! */ return start; } char *lydia(void *args) { ircLine_t *ircLine; char *dest, *target, *retour; modInfo_t *modInfo; modInfo = (modInfo_t *) args; ircLine = modInfo->ircLine; dest = getDestination(ircLine); target = getTargetNum(ircLine, 2); retour = myprintf("PRIVMSG %s :%s", dest, lydiaise(target, strlen(target), 2)); free(target); free(dest); return retour; }
/* void CMainDlg::OnBnClickedFlRead() { CBusy busy; BOARD_MEM imageOut; if(!m_BootConnected) return; EnableControlBtn(false); reset_S19image(&imageOut); if(read_mem(&imageOut) >= 0) { // save image!! CString fileName,pathName; CFileDialog dlg(TRUE,NULL,NULL,(OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT),_T("S19 files (*.s19;*.sx;*.srec)|*.s19; *.sx; *.srec|MOT files (*.mot)|*.mot|All files (*.*)|*.*||")); if(dlg.DoModal() == IDOK) { pathName = dlg.GetPathName(); fileName=dlg.GetFileName(); if(write_s19(pathName.GetBuffer(), &imageOut)<0) { MessageBox("Write output file operation failed.", "Read image Error", MB_ICONERROR | MB_OK); } }else MessageBox("Open output file operation failed.", "Read image Error", MB_ICONERROR | MB_OK); }else { MessageBox("Read image operation failed.", "Read image Error", MB_ICONERROR | MB_OK); } LogResetReplaceLine(); ProgressChanged(100); LogResetReplaceLine(); EnableControlBtn(true); } */ void CMainDlg::OnBnClickedFlRead() { CBusy busy; BOARD_MEM* pImageOut; myprintf("/n Experimental feature!!!"); if(!m_BootConnected) return; pImageOut = (BOARD_MEM*)malloc(sizeof(BOARD_MEM)); EnableControlBtn(false); reset_S19image(pImageOut); if(read_mem(pImageOut, 1) >= 0) { // save image!! CString fileName,pathName; CFileDialog dlg(TRUE,NULL,NULL,(OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT),_T("S19 files (*.s19;*.sx;*.srec)|*.s19; *.sx; *.srec|MOT files (*.mot)|*.mot|All files (*.*)|*.*||")); if(dlg.DoModal() == IDOK) { pathName = dlg.GetPathName(); fileName=dlg.GetFileName(); if(write_s19(pathName.GetBuffer(), pImageOut)<0) { MessageBox("Write output file operation failed.", "Read image Error", MB_ICONERROR | MB_OK); } }else MessageBox("Open output file operation failed.", "Read image Error", MB_ICONERROR | MB_OK); }else { MessageBox("Read image operation failed.", "Read image Error", MB_ICONERROR | MB_OK); } free(pImageOut); LogResetReplaceLine(); ProgressChanged(100); LogResetReplaceLine(); EnableControlBtn(true); }
void CWheelStatusConsole::navigator_engine_statusCallback(const wheels::navigator_engine_statusConstPtr& msg) { try { m_LastMsgTime = time(NULL); } catch (...) { } myprintf(_THISFILELINNO+1, 1, "Broadcasted Navigator_Engine_Status: Active Engine ID= %d [%s]", msg->nActiveEngineID, msg->strActiveEngineDescription.c_str()); }
void CWheelStatusConsole::wheels_statusCallback(const wheels::wheels_statusConstPtr& msg) { try { m_LastMsgTime = time(NULL); } catch (...) { } myprintf(_THISFILELINNO, 1, "Broadcasted Wheel_Status (Dir, Speed, Health): Left[%d, %d, %d] Right[%d, %d, %d]", msg->nLeftWheelDirection, msg->nLeftWheelSpeed, msg->nLeftWheelHealthStatus, msg->nRightWheelDirection, msg->nRightWheelSpeed, msg->nRightWheelHealthStatus); }
main() { myprintf("MTX starts in main()\n"); init(); // initialize and create P0 as running kfork(); // P0 creates child P1 while(1){ // P0 switches if readyQueue not empty if (readyQueue) tswitch(); } }
int usb_init(CCyUSBDevice* USBDevice) { bool devicePresent = findDevice(USBDevice); if (!(devicePresent && (USBDevice->VendorID != 0x0))){ myprintf("ERROR:Did not find matching device\n"); mysystem("PAUSE"); return 0; }else return 1; }
int sendMessage(SOCKET socket, char* message, int messageSize){ int returnValue; if ((returnValue = send(socket, message, messageSize, 0)) == SOCKET_ERROR){ myprintf("Ошибка send %s\n", encodeWSAGetLastError(WSAGetLastError())); closesocket(socket); WSACleanup(); exit(1); } return (returnValue); }
int getSocket(int family, int type, int protocol) { int n; if ((n = socket(family, type, protocol)) == INVALID_SOCKET){ myprintf("Ошибка socket %s ", encodeWSAGetLastError(WSAGetLastError())); WSACleanup(); exit(1); } return(n); }
int accepting(SOCKET listeningSocket, struct sockaddr_storage *ClientAddr, int ClientAddrLen){ int NewConnection; if ((NewConnection = accept(listeningSocket, (struct sockaddr *) &ClientAddr, &ClientAddrLen)) == INVALID_SOCKET){ myprintf("Ошибка accept %s\n", encodeWSAGetLastError(WSAGetLastError())); closesocket(listeningSocket); WSACleanup(); exit(1); } return (NewConnection); }
static void decrypt_payload(void *payload, size_t len, uint8_t encryptkey[16], uint8_t IV[16]){ AES_CTX ctx; int pad = (16 - len%16)% 16; /* blocks must be 16 bytes padded */ len += pad; #ifdef CRYPTO_DEBUG myprintf("Aes_decrypt (%x %d) = ", *(uint32_t *)payload, len); #endif AES_set_key(&ctx, encryptkey, IV, AES_MODE_128); AES_convert_key(&ctx); /* do the encryption in-place to spare memory */ AES_cbc_decrypt(&ctx, payload, payload, len); #ifdef CRYPTO_DEBUG myprintf("%x\n", *(uint32_t *)payload); #endif ZERO(ctx); }
void mygets(char *buff, unsigned int length) { char *sptr; int i; union REGS regs; if (input_redir==-1) { regs.h.ah = 0x44; regs.h.al = 0x0; regs.x.bx = 0x0; intdos(®s, ®s); if (regs.x.dx & 0x80) input_redir = 0; else input_redir = 1; } /* end if. */ if (input_redir) { regs.h.ah = 0xb; /* check if input waiting */ intdos(®s,®s); if (regs.h.al==0) /* no input waiting */ { /* puts(""); */ /* WHY ??? */ exit(10); } /* end if. */ } /* end if. */ getsbuf[0] = (char) length; getsbuf[2] = 0; regs.x.dx = (unsigned) getsbuf; regs.h.ah = 0xa; intdos(®s,®s); myprintf("\r",0); /* puts("\r"); */ sptr = &getsbuf[2]; if (*sptr==0x1a) { /* puts(""); */ /* WHY ??? */ exit(10); } /* end if. */ for (i=0;i<getsbuf[1];i++) { *buff = *sptr; buff++; sptr++; } /* end for. */ *buff='\0'; } /* end mygets. */
int read_file(char *cmd) { int fd,i,nbytes,ino,count,dev; char *buffer, file[1024], nbt[12]; OFT *oftp; MINODE *mip; MOUNT *mnt; mnt=(MOUNT *)find_mount(running->cwd->dev); i=mnt->blksize; buffer=malloc(i); memset(buffer, 0, i); bzero(file, 1024); bzero(nbt, 12); if (strcmp(cmd, "")==0) { printf("Enter filename/fd [nbytes=1]: "); fgets(cmd, 512, stdin); } sscanf(cmd, "%s %s", file, nbt); fd=strtol(file, NULL, 0); nbytes=strtol(nbt, NULL, 0); if (fd==0) { if (strcmp(file, "0")!=0) { dev=running->cwd->dev; ino = getino(&dev, file); mip = iget(dev, ino); for (i=0;i<NFD;i++) { oftp=running->fd[i]; if (oftp==0) continue; if (oftp->ptr->ino==ino && oftp->refCount>0) { fd=i; break; } } if (mip->ino!=ino) { printf(RED"File is not open!\n"RESET); free(buffer); return -1; } iput(mip); } } if (oftp->mode!=0 && oftp->mode!=2) { printf(RED"File is open in incompatible mode!\n"RESET); free(buffer); return -1; } count=(myread(fd, buffer, nbytes)); buffer[count]=0; myprintf("READ BUFFER: %s\n", buffer); free(buffer); return count; }
static int nilfs_clean_do_shutdown(struct nilfs_cleaner *cleaner) { int ret; ret = nilfs_cleaner_shutdown(cleaner); if (unlikely(ret < 0)) { myprintf(_("Error: shutdown failed: %s\n"), strerror(errno)); return -1; } return 0; }
int main() { #ifdef DEBUG cout<<"define DEBUG"<<endl; #endif printf("words:%s\n", TEST(hello)); //cout<<TOKEN(a,b)<<endl; myprintf("log:%d\n", 1); myprintf("log:hi\n"); //mynoprintf("log:hi\n",); argprintf("log:%d\n", 1); argprintf("log:hi\n"); printf("This file:%s\n", THISFILE); printf("This fun:%s\n", THISFUNCTION); printf("This line:%d\n", THISLINE); printf("This time:%s\n", THISTIME); printf("This time:%s\n", THISDATE); }
static int nilfs_clean_do_reload(struct nilfs_cleaner *cleaner) { int ret; ret = nilfs_cleaner_reload(cleaner, conffile); if (unlikely(ret < 0)) { myprintf(_("Error: reload failed: %s\n"), strerror(errno)); return -1; } return 0; }
void CWheelStatusConsole::wheels_cmd_velCallback(const geometry_msgs::Twist::ConstPtr& msg) { try { m_LastMsgTime = time(NULL); } catch (...) { } myprintf(_THISFILELINNO + 2, 1, "wheels_cmd_vels: z=%3.3f, x=%3.3f", msg->angular.z, msg->linear.x); }
void hexprint(char c) { unsigned char temp; temp = c; /* Print hi. */ temp = temp>>4; if (temp<10) temp += '0'; else temp += ('A'-10); myprintf(&temp,1); /* printf(&temp); */ temp = c & 0xf; /* Print lo. */ if (temp<10) temp += '0'; else temp += ('A'-10); myprintf(&temp,1); /* printf(&temp) */ } /* end hexprint. */
static procmap_entry_t *search_process_map(procmap_entry_t *map, const char *name) { const char *base = __base_name(name); while (map->base && map->limit) { if (strstr(map->name, base)) { return map; } ++map; } myprintf("Could not find %s (basename %s) in the process map\n", name, base); return NULL; }
void* osl_malloc(osl_t *osh, uint size) { void *addr; gfp_t flags; if (osh) ASSERT(osh->magic == OS_HANDLE_MAGIC); #ifdef DHD_USE_STATIC_BUF if (bcm_static_buf) { int i = 0; if ((size >= PAGE_SIZE)&&(size <= STATIC_BUF_SIZE)) { mutex_lock(&bcm_static_buf->static_sem); for (i = 0; i < MAX_STATIC_BUF_NUM; i++) { if (bcm_static_buf->buf_use[i] == 0) break; } if (i == MAX_STATIC_BUF_NUM) { mutex_unlock(&bcm_static_buf->static_sem); myprintf("all static buff in use!\n"); goto original; } bcm_static_buf->buf_use[i] = 1; mutex_unlock(&bcm_static_buf->static_sem); bzero(bcm_static_buf->buf_ptr+STATIC_BUF_SIZE*i, size); if (osh) osh->malloced += size; return ((void *)(bcm_static_buf->buf_ptr+STATIC_BUF_SIZE*i)); } } original: #endif flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL; if ((addr = kmalloc(size, flags)) == NULL) { if (osh) osh->failed++; return (NULL); } if (osh) osh->malloced += size; return (addr); }
int sendToMessage(SOCKET sendingSocket, char *message, struct sockaddr_in receiverAddr){ int returnValue; if ((returnValue = sendto(sendingSocket, message, strlen(message), 0, (struct sockaddr *)&receiverAddr, sizeof(receiverAddr))) == SOCKET_ERROR) { myprintf("Ошибка sendto %s\n", encodeWSAGetLastError(WSAGetLastError())); closesocket(sendingSocket); WSACleanup(); exit(1); } return (returnValue); }
//--------------------------------------------------------------------------- void ListExprVar(mecParserHandle_t a_hParser) { mecInt_t iNumVar = mecGetExprVarNum(a_hParser), i = 0; if (iNumVar == 0) { myprintf(_T("Expression dos not contain variables\n")); return; } myprintf(_T("\nExpression variables:\n")); myprintf(_T("---------------------\n")); myprintf(_T("Expression: %s\n"), mecGetExpr(a_hParser)); myprintf(_T("Number: %d\n"), iNumVar); for (i = 0; i < iNumVar; ++i) { const mecChar_t* szName = 0; mecFloat_t* pVar = 0; mecGetExprVar(a_hParser, i, &szName, &pVar); myprintf(_T("Name: %s Address: [0x%x]\n"), szName, (long long)pVar); } }
//main Method int main() { //printing myprintf("Nothing much\n"); myprintf("The letter %c\n", 'A'); myprintf("A string: %s\n", "Splash!"); myprintf("The number %d\n", 11); myprintf("The number %x in hexadecimal\n", 11); myprintf("%d is a negative number\n", -5); myprintf("The number %d\n", 'A'); myprintf("The number %x in hexadecimal\n", 'A'); return 0; }
int showdetForDigit(char a[40],char txt[40],int size) { int i,fd; char s[1]; D_Ycoord=20; D_Xcoord=-6; clear_area(5,12,121,48); myprintf("********entered show detail*******"); s[1]='\0'; for(i=0;i<chklen;i++) { s[0]=a[i]; myprintf("s[0]=%c",s[0]); D_Xcoord=D_Xcoord+6; kmy_LcdTextOut(5+D_Xcoord,5+D_Ycoord,s); if(D_Xcoord>102) { kmy_LcdTextOut(5+D_Xcoord+6,5+D_Ycoord," "); D_Xcoord=-6; D_Ycoord=D_Ycoord+12; } if(i==chklen-1) kmy_LcdTextOut(5+D_Xcoord+6,5+D_Ycoord," "); } myprintf("\na[]=%s",a); ChkForDig(txt,size); return 0; }
int app_main() { int rc; int pool_id; // int i; // myprintf("app main start\n"); //do some init work rc = init_system(); if(rc) { myprintf("system init failed, progame is exiting... \n"); return rc; } #ifdef __TEST__ init_test_data(); trigger_test(pool_id); #endif //MAIN PROCESS while(1) { //poll S frame pool_id = S_select_recv(); if((pool_id == 0) || (pool_id == 1)) { s_decode(pool_id); if(g_s_sample_full[pool_id]) { release_fpga_buffer(S_MODE, pool_id); g_s_sample_full[pool_id]=0; gSReleaseCnt[pool_id]++; } } //poll C frame pool_id = C_select_recv(); if((pool_id == 0) || (pool_id == 1)) { c_decode(pool_id); if(g_c_sample_full[pool_id]) { release_fpga_buffer(C_MODE, pool_id); g_c_sample_full[pool_id]=0; gCReleaseCnt[pool_id]++; } } } }