コード例 #1
0
ファイル: airtest.c プロジェクト: wtanaka/airhook
int main() {
	airhook_init(&socket,time(NULL));
	for (;;) {
		char line[1024],*command;
		fprintf(stderr,"] ");
		if (NULL == fgets(line,sizeof(line),stdin)) break;
		command = strtok(line," \n");
		if (NULL == command || !strcmp(command,"")) ;
		else if (!strcmp(command,"r")) read_packet();
		else if (!strcmp(command,"w")) write_packet();
		else if (!strcmp(command,"p")) dump_packet();
		else if (!strcmp(command,"m")) send_message();
		else if (!strcmp(command,"s")) print_status();
		else if (!strcmp(command,"d")) discard_message();
		else {
			fprintf(stderr,"invalid command: %s\n"
			"commands: r filename        -- read packet\n"
			"          w filename length -- write packet\n"
			"          p filename        -- print packet\n"
			"          m message         -- send message\n"
			"          s                 -- get status\n"
			"          s num             -- get message status\n"
			"          d num             -- discard message\n",
			command);
		}
	}

	return 0;
}
コード例 #2
0
ファイル: status.c プロジェクト: Distrotech/subversion
/* Called by status-cmd.c */
svn_error_t *
svn_cl__print_status(const char *path,
                     const svn_client_status_t *status,
                     svn_boolean_t detailed,
                     svn_boolean_t show_last_committed,
                     svn_boolean_t skip_unrecognized,
                     svn_boolean_t repos_locks,
                     unsigned int *text_conflicts,
                     unsigned int *prop_conflicts,
                     unsigned int *tree_conflicts,
                     svn_client_ctx_t *ctx,
                     apr_pool_t *pool)
{
  if (! status
      || (skip_unrecognized
          && !(status->versioned
               || status->conflicted
               || status->node_status == svn_wc_status_external))
      || (status->node_status == svn_wc_status_none
          && status->repos_node_status == svn_wc_status_none))
    return SVN_NO_ERROR;

  return print_status(svn_dirent_local_style(path, pool),
                      detailed, show_last_committed, repos_locks, status,
                      text_conflicts, prop_conflicts, tree_conflicts,
                      ctx, pool);
}
コード例 #3
0
ファイル: vme_endian.c プロジェクト: jeisch/vme
int main(int argc, char **argv)
{
	vme_bus_handle_t bus_handle;
	int rval;

	if (vme_init(&bus_handle)) {
		perror("vme_init");
		return -1;
	}

	/* If there are no arguments, print the current endian conversion
	   hardware setup, else set the requested values.
	 */
	if (1 == argc) {
		rval = print_status(bus_handle);
	} else {
		rval = set_status(bus_handle, argc, argv);
	}

	if (vme_term(bus_handle)) {
		perror("vme_term");
		rval = -1;
	}

	return rval;
}
コード例 #4
0
ファイル: broadcom.c プロジェクト: ghent360/bluez
static void read_verbose_version_info_rsp(const void *data, uint8_t size)
{
	uint8_t status = get_u8(data);
	uint8_t chip_id = get_u8(data + 1);
	uint8_t target_id = get_u8(data + 2);
	uint16_t build_base = get_le16(data + 3);
	uint16_t build_num = get_le16(data + 5);
	const char *str;

	print_status(status);
	print_field("Chip ID: %u (0x%2.2x)", chip_id, chip_id);

	switch (target_id) {
	case 254:
		str = "Invalid";
		break;
	case 255:
		str = "Undefined";
		break;
	default:
		str = "Reserved";
		break;
	}

	print_field("Build target: %s (%u)", str, target_id);
	print_field("Build baseline: %u (0x%4.4x)", build_base, build_base);
	print_field("Build number: %u (0x%4.4x)", build_num, build_num);
}
コード例 #5
0
ファイル: lwm2mclient.c プロジェクト: kftd67/wakaama
static void prv_instance_dump(lwm2m_object_t * objectP,
                              uint16_t id)
{
    int numData;
    lwm2m_tlv_t * dataArray;
    int size;
    uint8_t * buffer;
    int i;
    uint16_t res;

    numData = 0;
    res = objectP->readFunc(id, &numData, &dataArray, objectP);
    if (res != COAP_205_CONTENT)
    {
        printf("Error ");
        print_status(stdout, res);
        printf("\r\n");
        return;
    }

    dump_tlv(stdout, numData, dataArray, 0);

    size = lwm2m_tlv_serialize(numData, dataArray, &buffer);
    printf("char objectTlv[%d] = {", size);
    for (i = 0 ; i < size ; i++)
    {
        printf("0x%02X, ", buffer[i]);
    }
    printf("\b\b};\r\n");
    lwm2m_tlv_free(numData, dataArray);
    lwm2m_free(buffer);
}
コード例 #6
0
ファイル: dagman_main.cpp プロジェクト: AlanDeSmet/htcondor
// this can be called by other functions, or by DC when the schedd is
// shutdown gracefully
void main_shutdown_graceful() {
	print_status();
	dagman.dag->DumpNodeStatus( true, false );
	dagman.dag->GetJobstateLog().WriteDagmanFinished( EXIT_RESTART );
	dagman.CleanUp();
	DC_Exit( EXIT_RESTART );
}
コード例 #7
0
ファイル: print.c プロジェクト: madmarble/azaza
void print_status(struct DB *db, struct Node *node)
{
	printf("In node %d exist %d keys and values\n", node->num_vertix, node->n);
	if (node->leaf)
		printf("This node is also a leaf\n");
	else
		printf("This node is not a leaf\n");
	int i;
	for (i = 0; i < node->n; i++) {
		printf("Size of key is %d and value is %s\n", node->keys[i].size, 
			(char *)node->keys[i].data);
		printf("Size of value is %d and value is %s\n", node->values[i].size, 
			(char *)node->values[i].data);
	}

	if (!node->leaf) {
		for (i = 0; i < node->n+1; i++) {
			printf("Child %d is %d\n", i, node->children[i]);
		}
	}
	printf("\n");
	fflush(stdout);

	if (!node->leaf) {
		for (i = 0; i < node->n+1; i++) {
			struct Node *new_node = db->open_node(db, node->children[i]);
			print_status(db, new_node);
			new_node->close_node(db, new_node);
			free(new_node);
		}
	}
	return;
}
コード例 #8
0
ファイル: lab06.c プロジェクト: mattokaren/zw-schoolwork
int main(void) {
    // Declare variables
    double weight = 0.0,
           height = 0.0,
           bmi = 0.0;
    WeightStatus status = 0;
    
    // Ask for and save the value for weight.
    weight = get_weight();
    
    // Ask for and save the value for height.
    height = get_height();
    
    // Bail out if we have an invalid weight.
    if (validate_weight(weight) == 0) {
        printf("\n!!! Invalid weight. Exiting...\n");
        return 0;
    }
    
    // Bail out if we have an invalid height.
    if (validate_height(height) == 0) {
        printf("\n!!! Invalid height. Exiting...\n");
        return 0;
    }
    
    // Calculate and print the BMI.
    bmi = get_bmi(weight, height);
    print_bmi(bmi);
    
    // Decide and print the weight status.
    status = get_weight_status(bmi);
    print_status(status);
	
	return 0;
}
コード例 #9
0
void answer_status_by_id(struct gss_account account, int id, char *msg)
{
        /* cURL functionality used just to URIencode the msg */
        CURL *curl = curl_easy_init();
	if(curl) {
                char *encoded_msg = curl_easy_escape(curl, msg, strlen(msg));
		if(encoded_msg) {
		        /* margin to fit the ID is included */
                        int amount = 68+strlen(encoded_msg);
			char *send = malloc(amount);
			snprintf(send, amount, "in_reply_to_status_id=%d&source=GnuSocialShell&status=%s", id, encoded_msg);
			if (loglevel >= LOG_DEBUG) { // OK?
			        fprintf(stderr, "in_reply_to_status_id=%d&source=GnuSocialShell&status=%s\n", id, encoded_msg);
			}
			// send[sizeof(send)-1] = '\0'; // snprintf does that too
			char *xml_data = send_to_api(account, send, "statuses/update.xml");
			int xml_data_size = strlen(xml_data);
			if (FindXmlError(xml_data, strlen(xml_data)) < 0 && parseXml(xml_data, xml_data_size, "</status>", 9, NULL, 0) > 0) {
				struct status posted_status;
				posted_status = makeStatusFromRawSource(xml_data, xml_data_size);
				print_status(posted_status);
			}
			free(xml_data);
			free(send);
		        curl_free(encoded_msg);
		}
	}
}
コード例 #10
0
static void
search_complete_cb (OlLyricSourceSearchTask *task,
                    enum OlLyricSourceStatus status,
                    GList *results,
                    gpointer userdata)
{
  printf ("search complete: ");
  print_status (status);
  ol_test_expect (status == (gsize)userdata);
  if (status == OL_LYRIC_SOURCE_STATUS_SUCCESS)
  {
    if (results)
    {
      test_download (OL_LYRIC_SOURCE_CANDIDATE (results->data));
      test_download_cancel (OL_LYRIC_SOURCE_CANDIDATE (results->data));
    }
    for (; results; results = results->next)
    {
      OlLyricSourceCandidate *candidate;
      candidate = OL_LYRIC_SOURCE_CANDIDATE (results->data);
      printf ("(%s)%s - %s - %s\n",
              ol_lyric_source_candidate_get_sourceid (candidate),
              ol_lyric_source_candidate_get_title (candidate),
              ol_lyric_source_candidate_get_artist (candidate),
              ol_lyric_source_candidate_get_album (candidate));
    }
  }
  task_cnt--;
  check_quit ();
}
コード例 #11
0
ファイル: test-mailme.c プロジェクト: Cordia/dawati-shell
static void
on_account_added (MailmeTelepathy        *tp_provider,
                  MailmeTelepathyAccount *account,
                  gpointer                user_data)
{
  gchar *display_name = NULL;

  g_assert (GPOINTER_TO_INT(user_data) == 666);

  g_object_get (account, "display-name", &display_name, NULL);
  g_free(display_name);

  print_status (account);

  mailme_telepathy_account_get_inbox_async (
      account,
      on_received_inbox_open_info,
      NULL);

  g_signal_connect (account,
                    "notify::unread-count",
                    G_CALLBACK (on_account_changed),
                    NULL);

  g_signal_connect (account,
                    "notify::display-name",
                    G_CALLBACK (on_account_changed),
                    NULL);
}
コード例 #12
0
ファイル: test-mailme.c プロジェクト: Cordia/dawati-shell
static void
on_account_changed (GObject    *object,
                    GParamSpec *pspec,
                    gpointer    user_data)
{
   print_status (MAILME_TELEPATHY_ACCOUNT (object));
}
コード例 #13
0
ファイル: command.c プロジェクト: somecommand/mpc
int
cmd_status(mpd_unused  int argc, mpd_unused char **argv, struct mpd_connection *conn)
{
	if (options.verbosity >= V_DEFAULT)
		print_status(conn);
	return 0;
}
コード例 #14
0
ファイル: filecompare.c プロジェクト: jessek/colorize
static int process_cmd_line(state *s, int argc, char **argv)
{
  int i;

  while ((i=getopt(argc,argv,"tb:hV")) != -1) {
    switch(i) {

    case 't':
      s->mode |= mode_transitional;
      break;

    case 'b':
      find_block_size(s,optarg);
      break;

    case 'h':      
      usage();
      exit(EXIT_SUCCESS);

    case 'V':
      print_status ("%s", VERSION);
      exit(EXIT_SUCCESS);
      
    default:
      try_msg();
      exit(EXIT_FAILURE);
    }
  }

  return (sanity_check(s));
}
コード例 #15
0
	void accept_tcp(packet_t *packet, int packetloss, tcp_stream_t *stream)
	{
		if (!stream->userdata())
		{
			stream->set_userdata((void *)1);
			if (!stream->have_partner())
			{
				++d_single_sided;
				//printf("%s is single-sided\n", to_str(*stream).c_str());
			}
			else
				++d_full_streams;
		}
		d_packetloss += packetloss;

		if (packet)
		{
			uint64_t now = packet->ts().tv_sec;
			if (d_prev_ts + d_every < now)
			{
				printf("%ld: ", now);
				print_status();
				d_prev_ts = now;
			}
			packet->release();
		}
	}
コード例 #16
0
ファイル: signal_handler.c プロジェクト: rooi-oog/STM32_PID
G_MODULE_EXPORT
void rst_btn_clicked_cb (GtkButton *button, gpointer unused)
{	
	serial_port_send_reset ();
	go_zero_btn_clicked_cb (NULL, NULL);
	print_status ("OK");
}
コード例 #17
0
ファイル: prober.c プロジェクト: schoentoon/mcstatus-miner
void readcb(struct bufferevent* conn, void* arg) {
  char buffer[BUFSIZ];
  bzero(buffer, sizeof(buffer));
  size_t len = bufferevent_read(conn, buffer, sizeof(buffer));
  char* start_json = NULL;
  size_t i;
  for (i = 0; i < len; i++) {
    if (buffer[i] == '{') {
      start_json = &buffer[i];
      break;
    }
  }
  if (start_json != NULL) {
    char buf[BUFSIZ];
    size_t j;
    struct server* server = arg;
    struct server_status status;
    DEBUG(255, "raw json: %s", start_json);
    json_t* json = json_loads(start_json, 0, NULL);
    status.server = server;
    json_t* json_description = json_object_get(json, "description");
    if (json_description)
      status.motd = (char*) json_string_value(json_description);
    json_t* json_version = json_object_get(json, "version");
    if (json_version) {
      json_t* version_name = json_object_get(json_version, "name");
      if (version_name)
        status.version = (char*) json_string_value(version_name);
    }
    json_t* json_players = json_object_get(json, "players");
    if (json_players) {
      json_t* max = json_object_get(json_players, "max");
      if (max)
        status.maxplayers = json_integer_value(max);
      json_t* online = json_object_get(json_players, "online");
      if (online)
        status.numplayers = json_integer_value(online);
      if (server->players) {
        json_t* json_sample = json_object_get(json_players, "sample");
        if (json_sample) {
          for (i = 0; i < json_array_size(json_sample); i++) {
            json_t* player = json_array_get(json_sample, i);
            if (player) {
              for (j = 0; server->players[j]; j++) {
                if (print_player(&status, player, server->players[j], buf, sizeof(buf)))
                  printf("%s\n", buf);
              }
            }
          }
        }
      }
    }
    for (j = 0; server->format[j]; j++) {
      if (print_status(&status, server->format[j], buf, sizeof(buf)))
        printf("%s\n", buf);
    }
    json_decref(json);
  }
  eventcb(conn, BEV_FINISHED, arg);
};
コード例 #18
0
ファイル: main.c プロジェクト: fujii/myd-3.4-plus
void display(MYD myd, int index, int n_match, int scroll) {
    int i;
    int x, y;

    term_clear();
    print_prompt(edit.text, edit.cursor);

    term_move(0, 1);
    x = 0;
    y = 1;

    i = scroll;

    while(i < n_match) {
        /*  単語の表示  */
        display_word(myd_key(myd, index+i), &x, &y);

        if(y >= term_height - 1)
            break;

        /* 意味の表示  */
        display_mean(myd_text(myd, index+i), &x, &y);

        i ++;

        if(y >= term_height - 1)
            break;
    }

    print_status(myd, n_match);
}
コード例 #19
0
void send_status(struct gss_account account, char *msg)
{
        /* cURL functionality used just to URIencode the msg */
        CURL *curl = curl_easy_init();
	if(curl) {
                char *encoded_msg = curl_easy_escape(curl, msg, strlen(msg));
		if(encoded_msg) {
                        int amount = 31+strlen(encoded_msg);
			char *send = malloc(amount);
			snprintf(send, amount, "source=GnuSocialShell&status=%s", encoded_msg);
			if (loglevel >= LOG_DEBUG) { // OK?
			        fprintf(stderr, "source=GnuSocialShell&status=%s", encoded_msg);
			}
			char *xml_data = send_to_api(account, send, "statuses/update.xml");
			int xml_data_size = strlen(xml_data);
			if (FindXmlError(xml_data, strlen(xml_data)) < 0 && parseXml(xml_data, xml_data_size, "</status>", 9, NULL, 0) > 0) {
				struct status posted_status;
				posted_status = makeStatusFromRawSource(xml_data, xml_data_size);
				print_status(posted_status);
			}
			free(xml_data);
			free(send);
			curl_free(encoded_msg);
		}
	}
}
コード例 #20
0
ファイル: lwm2mclient.c プロジェクト: tknv/wakaama
static void prv_add(char * buffer,
                    void * user_data)
{
    lwm2m_context_t * lwm2mH = (lwm2m_context_t *)user_data;
    lwm2m_object_t * objectP;
    int res;

    objectP = get_test_object();
    if (objectP == NULL)
    {
        fprintf(stdout, "Creating object 1024 failed.\r\n");
        return;
    }
    res = lwm2m_add_object(lwm2mH, objectP);
    if (res != 0)
    {
        fprintf(stdout, "Adding object 1024 failed: ");
        print_status(stdout, res);
        fprintf(stdout, "\r\n");
    }
    else
    {
        fprintf(stdout, "Object 1024 added.\r\n");
    }
    return;
}
コード例 #21
0
ファイル: broadcom.c プロジェクト: ghent360/bluez
static void read_controller_features_rsp(const void *data, uint8_t size)
{
	uint8_t status = get_u8(data);

	print_status(status);
	print_features(data + 1);
}
コード例 #22
0
ファイル: signal_handler.c プロジェクト: rooi-oog/STM32_PID
G_MODULE_EXPORT
void chart_btn_clicked_cb ()
{
	gint32 *buf;
	guint32 size;
	
	if (!serial_port_get_feedback (&buf, &size)) {
		print_status ("Serial port timeout");
		return;
	}	
		
	chart_apply_data (GET_VALUE (GET_OBJECT ("setpoint_adj")), buf, size);			
	print_status ("OK");		
	gtk_widget_queue_draw (chart_da);
	
	g_free (buf);	
}
コード例 #23
0
ファイル: badblocks.c プロジェクト: DebdutBiswas/WinFLASHTool
static void alarm_intr(int alnum EXT2FS_ATTR((unused)))
{
	signal (SIGALRM, alarm_intr);
	alarm(1);
	if (!num_blocks)
		return;
	print_status();
}
コード例 #24
0
ファイル: broadcom.c プロジェクト: ghent360/bluez
static void read_uart_clock_setting_rsp(const void *data, uint8_t size)
{
	uint8_t status = get_u8(data);
	uint8_t clock = get_u8(data + 1);

	print_status(status);
	print_clock_setting(clock);
}
コード例 #25
0
ファイル: broadcom.c プロジェクト: ghent360/bluez
static void read_ram_rsp(const void *data, uint8_t size)
{
	uint8_t status = get_u8(data);

	print_status(status);

	packet_hexdump(data + 1, size - 1);
}
コード例 #26
0
ファイル: sig.c プロジェクト: OpenVPN/openvpn
static void
process_sigusr2(const struct context *c)
{
    struct status_output *so = status_open(NULL, 0, M_INFO, NULL, 0);
    print_status(c, so);
    status_close(so);
    signal_reset(c->sig);
}
コード例 #27
0
ファイル: dagman_main.cpp プロジェクト: AlanDeSmet/htcondor
void ExitSuccess() {
	print_status();
	dagman.dag->DumpNodeStatus( false, false );
	dagman.dag->GetJobstateLog().WriteDagmanFinished( EXIT_OKAY );
	tolerant_unlink( lockFileName ); 
	dagman.CleanUp();
	DC_Exit( EXIT_OKAY );
}
コード例 #28
0
ファイル: Daenerys.c プロジェクト: Einath/AProg_Practices
void print_sol(solution_step sol[PLACES+2]){
  int i; 

  print_header(); 
  for(i=0; i<(PLACES+2); i++)
    print_status(sol[i]);

}
コード例 #29
0
ファイル: elf64.c プロジェクト: joe9/barrelfish
static inline void
eabort(char a,
       char b)
{
    print_status(a, b);
    while (1)
        ;
}
コード例 #30
0
ファイル: tuple_server.c プロジェクト: ChrisX34/stuff
static void print_thread_func(void *varg)
{
  while (1)
  {
    print_status();
    usleep(1000);
  }
}