bool CProxyCheck::Check() { if( !Checkout()) return false; return true; }
void CheckoutModel::addRawItem(QString id,QString item, int price) { int amt_index; amt_index=searchItemGetQuantity(item); qWarning()<<"amt index "+ amt_index; if(amt_index==-1) { addCheckoutItem(Checkout(id,item,price,1,price)); } else { int quant=m_amount.at(amt_index).get_quantity()+1; addCheckoutItem(Checkout(id,item,quant*price,quant,price)); removeData(amt_index); } }
HRESULT STDMETHODCALLTYPE CPopupMenu::InvokeCommand( __in CMINVOKECOMMANDINFO *pici) { if(HIWORD(((CMINVOKECOMMANDINFOEX *)pici)->lpVerbW)){ return S_OK; } else { if(1 == LOWORD(pici->lpVerb)){ SetEnv(); } else if(2 == LOWORD(pici->lpVerb)){ Update(); } else if(3 == LOWORD(pici->lpVerb)){ Checkout(); } else if(4 == LOWORD(pici->lpVerb)){ Commit(); } else if(5 == LOWORD(pici->lpVerb)){ Checkin(); } else if(6 == LOWORD(pici->lpVerb)){ Cancel(); } else if(7 == LOWORD(pici->lpVerb)){ Add(); } else if(8 == LOWORD(pici->lpVerb)){ Revert(); } else if(9 == LOWORD(pici->lpVerb)){ Merge(); } else if(10 == LOWORD(pici->lpVerb)){ ShowLog(); } else if(11 == LOWORD(pici->lpVerb)){ Diff(); } else if(12 == LOWORD(pici->lpVerb)){ Compare(); } else if(13 == LOWORD(pici->lpVerb)){ UpdateRelyFiles(); } } return S_OK; }
/*ARGSUSED*/ static int WALK_FUNC(scan_archive) { char tmp[BUFSIZ]; (void) level; if (!strcmp(user_wd, path)) /* account for initial argument */ return (readable); if (!isFILE(sp->st_mode) || !an_archive(name)) { Ignore(name, " (not an archive)"); return (-1); } if (!strcmp(vcs_file((char *) 0, strcpy(tmp, name), FALSE), name)) return (readable); set_wd(user_wd); Checkout(rcs2name(name, FALSE), pathcat(tmp, rcs_dir(NULL, NULL), name)); set_wd(path); return (readable); }
void UdpServer(int server_socket) { struct sockaddr_in address; socklen_t addr_len = sizeof(sockaddr_in); while(quit_flag == 0) { for (int i = 0; i < pid_list.size(); i++) { waitpid(pid_list[i], NULL, WNOHANG); } int bytes_read = recvfrom(server_socket, buffer, BUFFER_SIZE, 0, (struct sockaddr*)&address, &addr_len); if (bytes_read < 1) { perror("recvfrom()"); continue; } long in_addr = address.sin_addr.s_addr; // network address Checkout(in_addr); if (addr_map.find(in_addr) == addr_map.end()) { struct file_info *fi = new file_info; if (is_file_exists(buffer) == 1) { fprintf(stderr, "File '%s' is already exists.\n", buffer); delete fi; continue; } strcpy(fi->file_name, buffer); // Open file fi->fd = fopen(buffer, "w+"); if (fi->fd == NULL) { delete fi; continue; } // Recieve file size bytes_read = recv(server_socket, buffer, BUFFER_SIZE, 0); if (bytes_read < 1) { perror("recv()"); fclose(fi->fd); delete fi; continue; } fi->file_size = atoi(buffer); addr_map[in_addr] = fi; } else { struct file_info *fi = addr_map[in_addr]; pid_t p = fork(); switch (p) { case -1: perror("fork()"); break; case 0: fi->sem.Wait(); fwrite(buffer, bytes_read, sizeof(char), fi->fd); if (fsize(fi->file_name) >= fi->file_size) { fclose(fi->fd); } fi->sem.Reset(); exit(0); default: pid_list.push_back(p); } // Send reply sendto(server_socket, "x", 1, 0, (struct sockaddr*)&address, addr_len); } } for (int i = 0; i < pid_list.size(); i++) { waitpid(pid_list[i], NULL, 0); } pid_list.clear(); }