本文整理汇总了C++中err_msg函数的典型用法代码示例。如果您正苦于以下问题:C++ err_msg函数的具体用法?C++ err_msg怎么用?C++ err_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了err_msg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: doc
void
tws::geoarray::load_geoarrays(std::map<std::string, geoarray_t>& arrays,
const std::string& input_file)
{
arrays.clear();
try
{
std::unique_ptr<rapidjson::Document> doc(tws::core::open_json_file(input_file));
const rapidjson::Value& jarrays = (*doc)["arrays"];
if(!jarrays.IsArray())
{
boost::format err_msg("error parsing input file '%1%': expected a vector of array metadata.");
throw tws::parse_error() << tws::error_description((err_msg % input_file).str());
}
const rapidjson::SizeType nelements = jarrays.Size();
for(rapidjson::SizeType i = 0; i != nelements; ++i)
{
const rapidjson::Value& jarray = jarrays[i];
if(jarray.IsNull())
continue;
geoarray_t g_array = read_array_metadata(jarray);
arrays.insert(std::make_pair(g_array.name, g_array));
}
}
catch(...)
{
throw;
}
}
开发者ID:rogervictor,项目名称:tws,代码行数:39,代码来源:utils.cpp
示例2: select_table
int select_table()
{
int i,j;
Window temp=main_win;
char *n[MAX_TAB],key[MAX_TAB],ch;
for(i=0;i<NTable;i++){
n[i]=(char *)malloc(25);
key[i]='a'+i;
sprintf(n[i],"%c: %s",key[i],my_table[i].name);
}
key[NTable]=0;
ch=(char)pop_up_list(&temp,"Table",n,key,NTable,12,0,10,0,
no_hint,info_pop,info_message);
for(i=0;i<NTable;i++)free(n[i]);
j=(int)(ch-'a');
if(j<0||j>=NTable){
err_msg("Not a valid table");
return -1;
}
return j;
}
开发者ID:leocomitale,项目名称:xppaut,代码行数:22,代码来源:many_pops.c
示例3: write_root_summary
static int
write_root_summary(datum_t *key, datum_t *val, void *arg)
{
char *name, *type;
char sum[256];
char num[256];
Metric_t *metric;
int rc;
struct type_tag *tt;
name = (char*) key->data;
metric = (Metric_t*) val->data;
type = getfield(metric->strings, metric->type);
/* Summarize all numeric metrics */
tt = in_type_list(type, strlen(type));
/* Don't write a summary for an unknown or STRING type. */
if (!tt || (tt->type == STRING))
return 0;
/* We log all our sums in double which does not suffer from
wraparound errors: for example memory KB exceeding 4TB. -twitham */
sprintf(sum, "%.5f", metric->val.d);
sprintf(num, "%u", metric->num);
/* err_msg("Writing Overall Summary for metric %s (%s)", name, sum); */
/* Save the data to a rrd file unless write_rrds == off */
if (gmetad_config.write_rrds == 0)
return 0;
rc = write_data_to_rrd( NULL, NULL, name, sum, num, 15, 0, metric->slope);
if (rc)
{
err_msg("Unable to write meta data for metric %s to RRD", name);
}
return 0;
}
开发者ID:bnicholes,项目名称:monitor-core,代码行数:39,代码来源:gmetad.c
示例4: malloc
t_ram *xdeclare(void)
{
t_ram *ram;
ram = malloc(sizeof(*ram));
if (ram == NULL)
{
err_msg("Critical error: ", 0, "Can't init XMap system.");
exit(EXIT_FAILURE);
}
ram->next = NULL;
ram->memory = NULL;
ram->name = "Xmap root";
debug(-1, "XMap System: No leak allowed", "");
xmalloc(0, (char*)ram, INIT);
xfree(ram, INIT);
xfreedom(ram, INIT);
xftmp(ram, INIT);
showmem(INIT, ram);
liveliness(ram, INIT);
return (ram);
}
开发者ID:catuss-a,项目名称:raytracer,代码行数:22,代码来源:xdeclare.c
示例5: main
int main (int argc, char **argv)
{
FILE *fp;
struct mnttab mp;
int ret;
if (argc != 2)
err_quit ("Usage: hasmntopt mount_option");
if ((fp = fopen ("/etc/mnttab", "r")) == NULL)
err_msg ("Can't open /etc/mnttab");
while ((ret = getmntent (fp, &mp)) == 0) {
if (hasmntopt (&mp, argv [1]))
printf ("%s\n", mp.mnt_mountp);
}
if (ret != -1)
err_quit ("Bad /etc/mnttab file.\n");
return (0);
}
开发者ID:AlexKordic,项目名称:sandbox,代码行数:22,代码来源:hasmntopt.c
示例6: main
int main(int argc, char **argv) {
//start of the address from argv
char *ptr, **pptr;
char str[INET_ADDRSTRLEN];
struct hostent *hptr;
while(--argc > 0) {
ptr = *++argv;
//gethostbyname is a function to get the ip from DNS - numeric tpye
if((hptr = gethostbyname(ptr)) == NULL) {
err_msg("gethostbyname error for host: %s: %s", ptr, hstrerror(h_errno));
continue;
}
//This is the “official” name of the host.
printf("official hostname: %s\r\n", hptr->h_name);
//These are alternative names for the host, represented as a null-terminated vector of strings.
for(pptr = hptr->h_aliases; *pptr != NULL; pptr++) {
printf("\t alias: %s\r\n", *pptr);
}
//pointer to all known IPs for that DNS
pptr = hptr->h_addr_list; // vector of addresses
for( ; *pptr != NULL; pptr++) {
printf("\t Addr %lu \r\n", hptr->h_addr);
//AF_INET or AF_INET6 lattter is for IPV6
printf("\t address :%s\r\n", Inet_ntop(hptr->h_addrtype, *pptr, str, sizeof(str)));
}
}
exit(0);
}
开发者ID:collegboi,项目名称:Network-Programming,代码行数:39,代码来源:dnstoip.c
示例7: cs_open
static int cs_open (char *path, int oflag)
{
int len;
char buf [12];
struct iovec iov [3];
int pipe_fd [2];
if (pipe (pipe_fd) == -1)
err_msg ("pipe failed");
switch (fork ()) {
case -1:
err_msg ("fork failed");
case 0:
close (pipe_fd [0]);
if (pipe_fd [1] != STDIN_FILENO) {
if (dup2 (pipe_fd [1], STDIN_FILENO) != STDIN_FILENO)
err_msg ("Can't dup2 stdin");
}
if (pipe_fd [1] != STDOUT_FILENO) {
if (dup2 (pipe_fd [1], STDOUT_FILENO) != STDOUT_FILENO)
err_msg ("Can't dup2 stdout");
}
execl ("./opend1", "opend", NULL);
err_msg ("exec failed");
default:
close (pipe_fd [1]);
snprintf (buf, 12, " %d", oflag);
iov [0].iov_base = "open ";
iov [0].iov_len = strlen ("open ");
iov [1].iov_base = path;
iov [1].iov_len = strlen (path);
iov [2].iov_base = buf;
iov [2].iov_len = strlen (buf) + 1;
len = iov [0].iov_len + iov [1].iov_len + iov [2].iov_len;
if (writev (pipe_fd [0], &iov [0], 3) != len)
err_msg ("writev failed");
return (recv_fd (pipe_fd [0]));
}
}
开发者ID:AlexKordic,项目名称:sandbox,代码行数:46,代码来源:cs_open1.c
示例8: main
int main (int argc, char **argv)
{
struct stat buf1;
struct stat buf2;
if (argc != 2)
err_quit ("Usage: break_chroot directory");
if (chdir ("/") == -1)
err_msg ("Can't chdir to /");
if (chroot (argv [1]) == -1)
err_msg ("Can't chroot to %s", argv [1]);
for (;;) {
if (stat (".", &buf1) == -1)
err_msg ("Can't stat .");
if (stat ("..", &buf2) == -1)
err_msg ("Can't stat ..");
if ((buf1.st_dev == buf2.st_dev) && (buf1.st_ino == buf2.st_ino))
break;
if (chdir ("..") == -1)
err_msg ("Can't chdir to ..");
}
chroot (".");
switch (fork ()) {
case -1:
err_msg ("Can't fork");
break;
case 0:
execl ("/sbin/sh", "-sh", NULL);
execl ("/bin/sh", "-sh", NULL);
printf ("Can't find a shell - exiting.\n");
_exit (0);
default:
break;
}
return (0);
}
开发者ID:AlexKordic,项目名称:sandbox,代码行数:46,代码来源:break_chroot.c
示例9: main
int main (int argc, char **argv)
{
FILE *fp;
struct vfstab vp;
int ret;
int i;
if ((fp = fopen ("/etc/vfstab", "r")) == NULL)
err_msg ("Can't open /etc/vfstab");
if (argc == 1) {
while ((ret = getvfsent (fp, &vp)) == 0)
print_vfstab (&vp);
if (ret != -1)
err_quit ("Bad /etc/vfstab file.\n");
}
else {
for (i = 1; argc-- > 1; i++) {
switch (getvfsfile (fp, &vp, argv [i])) {
case -1:
rewind (fp);
break;
case 0:
print_vfstab (&vp);
rewind (fp);
break;
default:
err_quit ("Bad /etc/vfstab file.\n");
break;
}
}
}
return (0);
}
开发者ID:AlexKordic,项目名称:sandbox,代码行数:38,代码来源:vfstab.c
示例10: handle_event
static void handle_event(nge_event * e)
{
switch (e->state_type) {
case SERVICE_STATE_CHANGE:
service_change(e->payload.service_state_change.service,
e->payload.service_state_change.is,
e->payload.service_state_change.state_name,
e->payload.service_state_change.percent_started,
e->payload.service_state_change.percent_stopped,
e->payload.service_state_change.service_type,
e->payload.service_state_change.hidden);
return;
case SYSTEM_STATE_CHANGE:
sys_state(e->payload.system_state_change.system_state,
e->payload.system_state_change.runlevel);
return;
case ERR_MSG:
err_msg(e->payload.err_msg.mt,
e->payload.err_msg.file,
e->payload.err_msg.func,
e->payload.err_msg.line, e->payload.err_msg.message);
return;
case CONNECT:
connected(e->payload.connect.pver,
e->payload.connect.initng_version);
return;
case DISCONNECT:
disconnected();
return;
case SERVICE_OUTPUT:
service_output(e->payload.service_output.service,
e->payload.service_output.process,
e->payload.service_output.output);
return;
default:
return;
}
}
开发者ID:herbert-de-vaucanson,项目名称:initng,代码行数:38,代码来源:initng-usplash.c
示例11: init_raw_4_socket
static int init_raw_4_socket(struct ospfd *ospfd)
{
int fd, on = 1, ret, flags;
fd = socket(AF_INET, SOCK_RAW, IPPROTO_OSPF);
if (fd < 0) {
err_sys("Failed to create raw IPPROTO_OSPF socket");
return FAILURE;
}
ret = setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on));
if (ret < 0) {
err_sys("Failed to set IP_HDRINCL socket option");
return FAILURE;
}
ret = setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on));
if (ret < 0) {
err_sys("Failed to set IP_PKTINFO socket option");
return FAILURE;
}
ret = join_router_4_multicast(fd);
if (ret != SUCCESS) {
err_msg("cannot join multicast groups");
return FAILURE;
}
/* make socket non-blocking */
if ((flags = fcntl(fd, F_GETFL, 0)) == -1)
flags = 0;
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
ospfd->network.fd = fd;
return SUCCESS;
}
开发者ID:hgn,项目名称:ospfd,代码行数:38,代码来源:network.c
示例12: DeleteCriticalSection
IMutexLock::IMutexLock()
{
#ifdef WIN32
if (InitializeCriticalSectionAndSpinCount(&_M_mutex, 2000) != TRUE) {
DeleteCriticalSection(&_M_mutex);
std::cerr << "init critical section failed !" << std::endl;
}
#elif defined(HAVE_PTHREAD)
int _ret_code = 0;
if ((_ret_code = pthread_mutexattr_init(&_M_mutexattr)) != 0)
std::cerr << "mutex attribute init failed !" << std::endl;
if (_ret_code == 0)
_ret_code = pthread_mutexattr_settype(&_M_mutexattr, PTHREAD_MUTEX_ERRORCHECK);
if (_ret_code == 0)
if ((_ret_code = pthread_mutex_init(&_M_mutex, &_M_mutexattr)) != 0)
err_msg("pthread_mutex_init failed");
if (_ret_code != 0) {
(void)pthread_mutex_destroy(&_M_mutex);
(void)pthread_mutexattr_destroy(&_M_mutexattr);
}
#endif // end of WIN32
}
开发者ID:xubodong1994,项目名称:test,代码行数:23,代码来源:ithread.cpp
示例13: grp_do_none
/* NONE
* ----
* Input parameters:
* numChans - number of channels in groupCol and qualCol
* groupCol - the GROUPING column
* qualCol - the QUALITY column
*/
int grp_do_none(long numChans, short *groupCol, short *qualCol,
dsErrList *errList){
long ii;
if((numChans <= 0) || !groupCol || !qualCol){
if(errList)
dsErrAdd(errList, dsDMGROUPBADPARAMERR, Accumulation,
Generic);
else
err_msg("ERROR: At least one input parameter has an "
"invalid value.\n");
return(GRP_ERROR);
}
/* Reset all columns */
for(ii = 0; ii < numChans; ii++){
groupCol[ii] = GRP_BEGIN;
qualCol[ii] = GRP_GOOD;
}
return(GRP_SUCCESS);
}
开发者ID:OrbitalMechanic,项目名称:sherpa,代码行数:30,代码来源:grplib.c
示例14: main
int main (int argc, char **argv)
{
pid_t pid;
prusage_t buf;
int i;
if (argc == 1) {
if (getprusage (-1, &buf) == -1)
err_msg ("getprusage failed");
print_rusage (getpid (), &buf);
}
else {
for (i = 1; i < argc; i++) {
pid = atoi (argv [i]);
if (getprusage (pid, &buf) == -1)
err_ret ("getprusage failed");
else
print_rusage (pid, &buf);
}
}
return (0);
}
开发者ID:AlexKordic,项目名称:sandbox,代码行数:23,代码来源:getprusage1.c
示例15: put
int put(char *root, int *cs, char *cmd, int *id)
{
int fd;
char **cmd_args;
int len;
int ret;
(void)root;
cmd_args = ssplit(cmd, ' ');
if (!check_errors(cs, cmd_args))
return (0);
ret = 0, send(*cs, (void *)&ret, sizeof(uint32_t), 0);
if (!receive_file_header(cs, cmd_args, &len))
return (afree(cmd_args), 0);
if ((fd = open(cmd_args[1], O_RDWR | O_CREAT, 0644)) == -1)
return (afree(cmd_args), err_msg(OPEN_ERR), 0);
write_streaming_packets(cs, fd, &len, id);
close(fd);
afree(cmd_args);
if (ret = 1, send(*cs, (void *)&ret, sizeof(uint32_t), 0) == -1)
return (0);
return (1);
}
开发者ID:rdavid42,项目名称:ft_p,代码行数:23,代码来源:put.c
示例16: main
int main(int argc, const char *argv[])
{
if(argc < 2)
{
err_msg("usage: udc <filepath>");
}
int sockfd = socket(AF_LOCAL, SOCK_STREAM, 0);
struct sockaddr_un svraddr;
bzero(&svraddr, sizeof(struct sockaddr_un));
svraddr.sun_family = AF_LOCAL;
memcpy(svraddr.sun_path, argv[1], strlen(argv[1]));
connect(sockfd, (struct sockaddr*)&svraddr, sizeof(struct sockaddr*));
char in_buf[MAXLINE];
while(fgets(in_buf, MAXLINE, stdin) != NULL)
{
write(sockfd, in_buf, strlen(in_buf));
bzero(in_buf, MAXLINE);
read(sockfd, in_buf, MAXLINE);
fprintf(stdout, "%s\n", in_buf);
}
return 0;
}
开发者ID:yulingjie,项目名称:Net,代码行数:23,代码来源:udclient.c
示例17: main
int
main(int argc, char *argv[])
{
bool do_gauss_seidel = 0;
if (argc == 2 && str_ptr(argv[1]) == str_ptr("-g"))
do_gauss_seidel = 1;
else if(argc != 1)
{
err_msg("Usage: %s [ -g ] < mesh.sm > mesh-fit.sm", argv[0]);
return 1;
}
LMESHptr mesh = LMESH::read_jot_stream(cin);
if (!mesh || mesh->empty())
return 1; // didn't work
fit(mesh, do_gauss_seidel);
mesh->write_stream(cout);
return 0;
}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:23,代码来源:fit.C
示例18: length
uint HeapRegionSeq::find_contiguous_from(uint from, uint num) {
uint len = length();
assert(num > 1, "use this only for sequences of length 2 or greater");
assert(from <= len,
err_msg("from: %u should be valid and <= than %u", from, len));
uint curr = from;
uint first = G1_NULL_HRS_INDEX;
uint num_so_far = 0;
while (curr < len && num_so_far < num) {
if (at(curr)->is_empty()) {
if (first == G1_NULL_HRS_INDEX) {
first = curr;
num_so_far = 1;
} else {
num_so_far += 1;
}
} else {
first = G1_NULL_HRS_INDEX;
num_so_far = 0;
}
curr += 1;
}
assert(num_so_far <= num, "post-condition");
if (num_so_far == num) {
// we found enough space for the humongous object
assert(from <= first && first < len, "post-condition");
assert(first < curr && (curr - first) == num, "post-condition");
for (uint i = first; i < first + num; ++i) {
assert(at(i)->is_empty(), "post-condition");
}
return first;
} else {
// we failed to find enough space for the humongous object
return G1_NULL_HRS_INDEX;
}
}
开发者ID:BunnyWei,项目名称:truffle-llvmir,代码行数:37,代码来源:heapRegionSeq.cpp
示例19: callback
// static
void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
LLUploadDialog::modalUploadFinished();
LLResourceData* data = (LLResourceData*)user_data;
if(result < 0)
{
LLSD args;
args["REASON"] = std::string(LLAssetStorage::getErrorString(result));
LLNotificationsUtil::add("ErrorUploadingReportScreenshot", args);
std::string err_msg("There was a problem uploading a report screenshot");
err_msg += " due to the following reason: " + args["REASON"].asString();
llwarns << err_msg << llendl;
return;
}
EReportType report_type = UNKNOWN_REPORT;
if (data->mPreferredLocation == LLResourceData::INVALID_LOCATION)
{
report_type = COMPLAINT_REPORT;
}
else
{
llwarns << "Unknown report type : " << data->mPreferredLocation << llendl;
}
LLFloaterReporter *self = getInstance();
if (self)
{
self->mScreenID = uuid;
llinfos << "Got screen shot " << uuid << llendl;
self->sendReportViaLegacy(self->gatherReport());
self->close();
}
}
开发者ID:OS-Development,项目名称:VW.Singularity,代码行数:38,代码来源:llfloaterreporter.cpp
示例20: parse_netlink_msg
/*
* parse_netlink_msg
*/
void
parse_netlink_msg (char *buf, size_t buf_len)
{
netlink_msg_ctx_t ctx_space, *ctx;
struct nlmsghdr *hdr;
int status;
int len;
ctx = &ctx_space;
hdr = (struct nlmsghdr *) buf;
len = buf_len;
for (; NLMSG_OK (hdr, len); hdr = NLMSG_NEXT(hdr, len)) {
netlink_msg_ctx_init(ctx);
ctx->hdr = (struct nlmsghdr *) buf;
switch (hdr->nlmsg_type) {
case RTM_DELROUTE:
case RTM_NEWROUTE:
parse_route_msg(ctx);
if (ctx->err_msg) {
err_msg("Error parsing route message: %s", ctx->err_msg);
}
print_netlink_msg_ctx(ctx);
break;
default:
trace(1, "Ignoring unknown netlink message - Type: %d", hdr->nlmsg_type);
}
netlink_msg_ctx_cleanup(ctx);
}
}
开发者ID:ProyectoRRAP,项目名称:LiveCode,代码行数:40,代码来源:fpm_stub.c
注:本文中的err_msg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论