当前位置: 首页>>代码示例>>C++>>正文


C++ print_msg函数代码示例

本文整理汇总了C++中print_msg函数的典型用法代码示例。如果您正苦于以下问题:C++ print_msg函数的具体用法?C++ print_msg怎么用?C++ print_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了print_msg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: roster_handler

static void
roster_handler(int x, struct xmpp *xmpp)
{
    struct xml_data *d;
    char *jid, *name, *sub;
    for (d = xml_node_data(xml_node_find(x, "query", &xmpp->xml.mem),
                           &xmpp->xml.mem);
            d;
            d = xml_data_next(d, &xmpp->xml.mem)) {
        if (d->type != XML_NODE)
            continue;
        jid = xml_node_find_attr(d->value, "jid", &xmpp->xml.mem);
        name = xml_node_find_attr(d->value, "name", &xmpp->xml.mem);
        sub = xml_node_find_attr(d->value, "subscription", &xmpp->xml.mem);
        print_msg("* %s - %s - [%s]\n", name ? name : "", jid, sub);
    }
    print_msg("End of roster\n");
    for (d = xml_node_data(xml_node_find(x, "query", &xmpp->xml.mem),
                           &xmpp->xml.mem);
            d;
            d = xml_data_next(d, &xmpp->xml.mem)) {
        if (d->type != XML_NODE)
            continue;
        jid = xml_node_find_attr(d->value, "jid", &xmpp->xml.mem);
        if (jid)
            xmpp_printf(xmpp, "<presence type='probe' to='%s'/>", jid);
    }
}
开发者ID:gravicappa,项目名称:libxmpps,代码行数:28,代码来源:sjc.c

示例2: roster_hook

static int
roster_hook(int x, struct xmpp *xmpp)
{
  struct xml_data *d;
  char *jid, *name, *sub;

  for (d = xml_node_data(xml_node_find(x, "query", &xmpp->xml.mem),
                         &xmpp->xml.mem);
       d; d = xml_data_next(d, &xmpp->xml.mem)) {
    if (d->type != XML_NODE)
      continue;
    jid = xml_node_find_attr(d->value, "jid", &xmpp->xml.mem);
    name = xml_node_find_attr(d->value, "name", &xmpp->xml.mem);
    sub = xml_node_find_attr(d->value, "subscription", &xmpp->xml.mem);
    print_msg(0, "", "* %s - %s - [%s]\n", name ? name : "", jid, sub);
  }
  print_msg(0, "", "End of /R list.\n");
  for (d = xml_node_data(xml_node_find(x, "query", &xmpp->xml.mem),
                         &xmpp->xml.mem);
       d; d = xml_data_next(d, &xmpp->xml.mem)) {
    if (d->type != XML_NODE)
      continue;
    jid = xml_node_find_attr(d->value, "jid", &xmpp->xml.mem);
    request_presence(xmpp, jid);
  }
  return 0;
}
开发者ID:placek,项目名称:ji,代码行数:27,代码来源:ji.c

示例3: main

int main(void)
{
  void print_msg(char *);

  print_msg("hello");
  print_msg("world\n");
}
开发者ID:ychmrsk,项目名称:unixtp,代码行数:7,代码来源:hello_single.c

示例4: give_exp

void give_exp(player_info_t * player, const int amount)
{
    char line[MSGLEN];

    if (player->level >= PLAYER_MAXLEVEL)
        return;

    player->exp += amount;

    while (player->exp >= experience_to_level(player->level))
    {
        player->level += 1;

        attron(A_REVERSE | A_BLINK | A_BOLD | COLOR_PAIR(color_green));
        print_msg("You have gained a level!!");
        attrset(0);
        wait();

        snprintf(line, MSGLEN,
                 "You are now level %d.", player->level);
        print_msg(line);
        wait();
        clear_msg();

        player->mob->attr[ATTR_HP] += 10 + 2 * player->level;
        player->mob->attr[ATTR_MINDAM] += 1;
        player->mob->attr[ATTR_ATTACK] += 5;
        player->mob->attr[ATTR_DODGE] += 5;
    }

    return;
}
开发者ID:happyponyland,项目名称:smallrl,代码行数:32,代码来源:player.c

示例5: writev

ssize_t
writev(int fd, const struct iovec *vector, int count) 
{
  ssize_t retval;

#ifdef X_BUF
  print_trace ("%*swritev(%d, {", indent, "", fd);
  for (int i=0; i<count; i++) {
    print_msg ("{\"%s\", %d}%s", 
	       vector[i].iov_base, 
	       vector[i].iov_len,
	       i==count-1 ? "" : ", ");
  }
  print_msg ("}, %d)=...\n", count);
#else
  print_trace ("%*swritev(%d, %p, %d)=...\n", indent, "",
	       fd, vector, count);
#endif
  indent+=2;

  /* call the real writev function */
  retval = real_writev (fd, vector, count);

  indent-=2;
  print_trace ("%*swritev(%d, %p, %d)=%d\n", indent, "", 
	       fd, vector, count, retval);

  return retval;
}
开发者ID:tdumitra,项目名称:syscall-interceptor,代码行数:29,代码来源:modified_fun.cpp

示例6: select_format

static int
select_format (const char * optstr, int dir)
{
/*
 * Handling of the -f command line option (force input format).
 *
 * Empty or "?" shows the supported format names.
 */
  int i;

  if ((!strcmp(optstr, "?")) || (*optstr == '\0'))
    {
      print_msg (STARTM, "\nSupported format names are:\n\n");
      for (i = 0; format_a[i].name != NULL; i++)
        if (dir & format_a[i].dir)
          print_msg (CONTM, "%s ", format_a[i].name);
      print_msg (ENDM, "\n");
      exit (0);
    }

  for (i = 0; format_a[i].name != NULL; i++)
    if ((format_a[i].dir & dir) && (!strcasecmp(format_a[i].name, optstr)))
      return format_a[i].fmt;

  print_msg (ERRORM, "Unsupported format name '%s'!\n", optstr);
  exit (E_USAGE);
}
开发者ID:Open-Sound-System,项目名称:Open-Sound-System,代码行数:27,代码来源:ossplay.c

示例7: select_container

static fctypes_t
select_container (const char * optstr)
{
/*
 * Handling of the -F command line option (force container format).
 *
 * Empty or "?" shows the supported container format names.
 */
  int i;

  if ((!strcmp(optstr, "?")) || (*optstr == '\0'))
    {
      print_msg (STARTM, "\nSupported container format names are:\n\n");
      for (i = 0; container_a[i].name != NULL; i++)
        print_msg (CONTM, "%s ", container_a[i].name);
      print_msg (ENDM, "\n");
      exit (0);
    }

  for (i = 0; container_a[i].name != NULL; i++)
    if (!strcasecmp(container_a[i].name, optstr))
      return container_a[i].type;

  print_msg (ERRORM, "Unsupported container format name '%s'!\n", optstr);
  exit (E_USAGE);
}
开发者ID:Open-Sound-System,项目名称:Open-Sound-System,代码行数:26,代码来源:ossplay.c

示例8: free

void free(void* p, heap* h) 
{
    // Exit gracefully for null pointers.
    if (p == NULL)
        return;

    // Get the header and footer associated with this pointer.
    header *head = (header*) ((u32int) p - sizeof (header));
    footer *foot = (footer*) ((u32int) head + head->size - sizeof (footer));

    // Sanity checks.
    if(!(head->magic == HEAP_MAGIC && foot->magic == HEAP_MAGIC))
    {
        print_msg("Memory error\n");
        return;
    }

    // Make us a hole.
    head->is_hole = 1;

    // Do we want to add this head into the 'free holes' index?
    char do_add = 1;

    // Unify left
    // If the thing immediately to the left of us is a foot...
    footer *test_foot = (footer*) ((u32int) head - sizeof (footer));
    if (test_foot->magic == HEAP_MAGIC && test_foot->head->is_hole) {
        u32int cache_size = head->size; // Cache our current size.
        head = test_foot->head; // Rewrite our head with the new one.
        foot->head = head; // Rewrite our foot to point to the new head.
        head->size += cache_size; // Change the size.
        do_add = 0; // Since this head is already in the index, we don't want to add it again.
    }

    // Unify right
    // If the thing immediately to the right of us is a head...
    header *test_head = (header*) ((u32int) foot + sizeof (footer));
    if (test_head->magic == HEAP_MAGIC && test_head->is_hole) {
        head->size += test_head->size; // Increase our size.
        test_foot = (footer*) ((u32int) test_head + // Rewrite it's foot to point to our head.
                test_head->size - sizeof (footer));
        test_foot->head = head;
        // Find and remove this head from the index.
        u32int iterator = 0;
        while ((iterator < h->index.size) && (lookup_ordered_array(iterator, &h->index) != (u32int) test_head))
            iterator++;

        // Make sure we actually found the item.
        if(iterator >= h->index.size)
        {
            print_msg("Iterator behind heap size");
            return;
        }
        // Remove it.
        remove_ordered_array(iterator, &h->index);
    }

    if (do_add == 1)
        insert_ordered_array((u32int) head, &h->index);
}
开发者ID:adrianboguszewski,项目名称:RowanBerryOS,代码行数:60,代码来源:heap.c

示例9: do_contact_input_string

static void
do_contact_input_string(struct xmpp *xmpp, struct contact *u, char *s)
{
  struct command *cmd;

  if (s[0] == 0)
    return;

  if (s[0] != '/') {
    if (u->jid[0])
      send_message(xmpp, u->type, u->jid, s);
    else
      xmpp_printf(xmpp, "%S", s);
    if (strcmp(u->type, "groupchat"))
      print_msg(0, u->jid, "<%s> %s\n", me, s);
    return;
  }
  for (cmd = commands; cmd->c; ++cmd)
    if (cmd->c == s[1] && cmd->fn != 0) {
      cmd->fn(xmpp, u, s);
      break;
    }
  if (!cmd->c) {
    send_message(xmpp, u->type, u->jid, s);
    if (strcmp(u->type, "groupchat"))
      print_msg(0, u->jid, "<%s> %s\n", me, s);
  }
}
开发者ID:placek,项目名称:ji,代码行数:28,代码来源:ji.c

示例10: parse_val

/* Returns pointer to a statically allocated buffer or NULL on error */
static const char *
parse_val(const char *str)
{
	static char buf[VAL_LEN_MAX + 1];
	char *p = buf;
	int quote = (*str++ == '"') ? 2 : 1;
	int slash = 0;

	/* parse all in currect quotes */
	while(*str != '\0' && quote != 0)
	{
		if(slash == 1)
		{
			*p++ = *str++;
			slash = 0;
		}
		else if(*str == '\\')
		{
			slash = 1;
		}
		else if(*str == '\'' && quote == 0)
		{
			quote = 1;
		}
		else if(*str == '\'' && quote == 1)
		{
			quote = 0;
		}
		else if(*str == '"' && quote == 0)
		{
			quote = 2;
		}
		else if(*str == '"' && quote == 2)
		{
			quote = 0;
		}
		else
		{
			*p++ = *str;
		}
		str++;
	}

	/* report an error if input is invalid */
	if(*str != '\0' || quote != 0)
	{
		if(quote != 0)
			print_msg(1, "Incorrect value", "unclosed quote");
		else
			print_msg(1, "Incorrect value", "trailing characters");
		return NULL;
	}

	*p = '\0';
	return buf;
}
开发者ID:sklnd,项目名称:vifm,代码行数:57,代码来源:variables.c

示例11: conv_mac_to_dos

void conv_mac_to_dos (void)
{
  gint CurrentPage, res;
  
  CurrentPage = gtk_notebook_get_current_page (GTK_NOTEBOOK(MainNotebook));
  res = replace_all (CurrentPage, TRUE, FALSE, 0, "\r", "\r\n");
  if (!res)
    print_msg ("This file is already DOS formated...");
  else
    print_msg ("File converted from MAC to DOS Format...");
}
开发者ID:dimkr,项目名称:beaver,代码行数:11,代码来源:tools.c

示例12: parse_message

void
parse_message(unsigned char type, char *buf, int size)
{
    char *msgt;
    int i;
    struct iocblk *iocp;
    struct buffer *bp = Pty.inbuff;


    print_msg(type, (unsigned char *) buf, size);

    if (size > 0) {
	switch (Pty.state) {
	case PTY_CLOSED:
	case PTY_OPERRONLY:
	    SET_EVENT(EV_UP, EV_UPOPEN, 0, 0);
	    break;
	}
    }
    else if (size == -1) {
	sysmessage(MSG_WARNING, "PARSE: Message data size == -1 \n");
	return;
    }

    switch (type) {
    case M_DATA:
# ifdef TSR_MEASURE
	devreads++;
	devrbytes += size;
# endif
	if (size == 0) {
	    SET_EVENT(EV_UP, EV_UPCLOSE, 0, 0);
	}
	else {
	    COPY_TO_BUFFER(bp, buf, size);
	    SET_EVENT(EV_UP, EV_UPDATA, 0, 0);
	}
	break;

    case M_IOCTL:
	iocp = (struct iocblk *) &buf[0];
	parse_ioctl(iocp->ioc_cmd, (void *) &buf[sizeof(struct iocblk)]);
	break;

    case M_FLUSH:
	parse_msgflush((int) buf[0]);
	break;

    default:
	sysmessage(MSG_DEBUG, "Unsupported stream message: %d\n", type);
	print_msg(type, (unsigned char *) buf, size);
	break;
    }
}
开发者ID:maquefel,项目名称:cyclades-serial-code,代码行数:54,代码来源:hpux-dev.c

示例13: init_save

int init_save(char *file)
{
    int fd=-1;
    fd=open(file,O_RDWR | O_CREAT | O_TRUNC | O_LARGEFILE);
    if(fd==-1)
    {
        print_msg("[%s,%d]", __FILE__, __LINE__);
        exit(-1);
    }
    print_msg("open write file ok\n");
    return fd;
}
开发者ID:zhousc,项目名称:project_name,代码行数:12,代码来源:sheet.c

示例14: print_usage

static void print_usage()
{
  print_msg(
    "Usage:\n"
    "    esmerge <video-file> <audio-file> <output-file>\n"
    "\n"
    );
  REPORT_VERSION("esmerge");
  print_msg(
    "\n"
    "  Merge the contents of two Elementary Stream (ES) files, one containing\n"
    "  video data, and the other audio, to produce an output file containing\n"
    "  Transport Stream (TS).\n"
    "\n"
    "Files:\n"
    "  <video-file>  is the ES file containing video.\n"
    "  <audio-file>  is the ES file containing audio.\n"
    "  <output-file> is the resultant TS file.\n"
    "\n"
    "Switches:\n"
    "  -err stdout       Write error messages to standard output (the default)\n"
    "  -err stderr       Write error messages to standard error (Unix traditional)\n"
    "  -quiet, -q        Only output error messages.\n"
    "  -verbose, -v      Output information about each audio/video frame.\n"
    "  -x                Output diagnostic information.\n"
    "\n"
    "  -h264             The video stream is H.264 (the default)\n"
    "  -avs              The video stream is AVS\n"
    "\n"
    "  -vidrate <hz>     Video frame rate in Hz - defaults to 25Hz.\n"
    "\n"
    "  -rate <hz>        Audio sample rate in Hertz - defaults to 44100, i.e., 44.1KHz.\n"
    "  -cd               Equivalent to -rate 44100 (CD rate), the default.\n"
    "  -dat              Equivalent to -rate 48000 (DAT rate).\n"
    "\n"
    "  -adts             The audio stream is ADTS (the default)\n"
    "  -l2               The audio stream is MPEG layer 2 audio\n"
    "  -mp2adts          The audio stream is MPEG-2 style ADTS regardless of ID bit\n"
    "  -mp4adts          The audio stream is MPEG-4 style ADTS regardless of ID bit\n"
    "  -ac3              The audio stream is Dolby AC-3 in ATSC\n"
    "\n"
    "  -patpmtfreq <f>    PAT and PMT will be inserted every <f> video frames. \n"
    "                     by default, f = 0 and PAT/PMT are inserted only at  \n"
    "                     the start of the output stream.\n"
    "\n"
    "Limitations\n"
    "===========\n"
    "For the moment, the video input must be H.264 or AVS, and the audio input\n"
    "ADTS, AC-3 ATSC or MPEG layer 2. Also, the audio is assumed to have a\n"
    "constant number of samples per frame.\n"
    );
}
开发者ID:OpenQCam,项目名称:qcam,代码行数:52,代码来源:esmerge.c

示例15: while

/* size must be >=2. No checks for s=NULL, size<2 or stream=NULL.  B.A. */
char *fgets_new(struct prog_info *pi, char *s, int size, FILE *stream)
{
	int c;
	char *ptr=s;
	do {
		if((c=fgetc(stream))==EOF || IS_ENDLINE(c)) 	// Terminate at chr$ 10,12,13,0 and EOF
			break;
        /*
        ** concatenate lines terminated with \ only...
        */
        if (c == '\\')
        {
            /* only newline and cr may follow... */
            if((c=fgetc(stream))==EOF)
                break;

            if(!IS_ENDLINE(c)) 	            // Terminate at chr$ 10,12,13,0 and EOF
            {
                *ptr++ = '\\';              // no concatenation, insert it
            }
            else
            {
                // mit be additional LF (DOS)
                c=fgetc(stream);
                if (IS_ENDLINE(c))
                    c=fgetc(stream);

                if (c == EOF)
                    break;
            }
        }

		*ptr++=c;
	} while(--size);
	if((c==EOF) && (ptr==s))				// EOF and no chars read -> that's all folks
		return NULL;
	if(!size) {
		print_msg(pi, MSGTYPE_ERROR, "Line to long");
		return NULL;
	}
	*ptr=0;
	if(c==12)						// Check for Formfeed (Bug [1462886])
		print_msg(pi, MSGTYPE_WARNING, "Found Formfeed char. Please remove it.");
	if(c==13) { 						// Check for CR LF sequence (DOS/ Windows line termination)
		if((c=fgetc(stream)) != 10) {
			ungetc(c,stream);
			print_msg(pi, MSGTYPE_WARNING, "Found CR (0x0d) without LF (0x0a). Please add a LF.");
		} 
	}
	return s;
}
开发者ID:mnemnion,项目名称:imp,代码行数:52,代码来源:parser.c


注:本文中的print_msg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。