コード例 #1
0
ファイル: main.c プロジェクト: totzyuta/ListManager
void cmd_find(char *word)
{
  int i;
  struct profile *p;
  char s[8];  
  char birthday_str[11];
  int n=0;
  
  for(i = 0; i < profile_data_nitems; i++){
    p = &profile_data_store[i];
    sprintf(s,"%d",p->id);
    date_to_string(birthday_str,&p->birth);
    if(strcmp(s,word) == 0 ||
       strcmp(p->name,word) == 0 ||
       strcmp(birthday_str,word) == 0 ||
       strcmp(p->home,word) == 0 ||
       strcmp(p->comment,word) == 0){
        print_profile(i,p);
        printf("\n");
    }else{
      n++;
    }
  }
  if(n = profile_data_nitems){
    fprintf(stderr,"error: could not find\n\n");
  }
}
コード例 #2
0
ファイル: value.cpp プロジェクト: peelonet/laskin
  std::u32string value::to_source() const
  {
    switch (m_type)
    {
      case type::boolean:
        return m_value_boolean ? U"true" : U"false";

      case type::number:
        return number_to_string(*m_value_number);

      case type::vector:
        return vector_to_source(*m_value_vector);

      case type::string:
        return string_to_source(*m_value_string);

      case type::quote:
        return m_value_quote->to_source();

      case type::month:
        return month_to_string(m_value_month);

      case type::weekday:
        return weekday_to_string(m_value_weekday);

      case type::date:
        return date_to_string(*m_value_date);

      case type::time:
        return time_to_string(*m_value_time);
    }

    return U"";
  }
コード例 #3
0
ファイル: net_pro.c プロジェクト: kota395/np
void print_profile(struct profile *p,int i)
{//保存されているデータの表示
  char date[11];
  printf("Data No. %d\n",i);
  printf("Id     : %d\n", p->id);
  printf("Name   : %s\n", p->name);
  printf("Birth  : %s\n", date_to_string(date, &p->birthday));
  printf("Addr   : %s\n", p->home);
  printf("Com.   : %s\n", p->comment);
}
コード例 #4
0
ファイル: iso8601.c プロジェクト: smellman/pacemaker
void
log_date(int log_level, const char *prefix, ha_time_t * date_time, int flags)
{
    char *date_s = date_to_string(date_time, flags);

    do_crm_log(log_level, "%s%s%s",
               prefix ? prefix : "", prefix ? ": " : "", date_s ? date_s : "__invalid_date__");

    crm_free(date_s);
}
コード例 #5
0
ファイル: net_pro.c プロジェクト: kota395/np
int fprintf_profile_csv(struct profile *p,FILE *fp)
{//ファイルに書き込む(実装部)
  int re;
  char date[11];
  re = fprintf(fp,"%d,%s,%s,%s,%s\n",
	       p->id,
	       p->name,
	       date_to_string(date, &p->birthday),
	       p->home,
	       p->comment);
  if(re < 0)  return 1;
              return 0;
}
コード例 #6
0
ファイル: service.c プロジェクト: faddison/cs317
char *response_obj_to_string(Response resobj)
{
	char *res = "";
	
	res = status_to_string(res, resobj.status);
	res = connection_to_string(res, resobj.connection);
	res = cache_control_to_string(res, resobj.cache_control);
	res = content_length_to_string(res, resobj.content_length);
	res = content_type_to_string(res, resobj.content_type);
	res = date_to_string(res, resobj.date);
	res = body_to_string(res, resobj.body);
	
	return res;
}
コード例 #7
0
ファイル: net_pro.c プロジェクト: kota395/np
int find_strcmp(struct profile *p, char *word)
{//データの検索(比較部)
  char date[11], year[7], month[5], day[5], n[11];
  sprintf(n, "%d", p->id);
  if (strcmp(n, word) == 0 ||
      strcmp(p->name, word) == 0 ||
      strcmp(date_to_string(date, &p->birthday), word) == 0 ||
      strcmp(find_birth_year (year,  &p->birthday), word) == 0 ||
      strcmp(find_birth_month(month, &p->birthday), word) == 0 ||
      strcmp(find_birth_day  (day,   &p->birthday), word) == 0 ||
      strcmp(p->home, word) == 0 ||
      strcmp(p->comment, word) == 0
      )  return 0;
  else  return 1;
}