• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ die2函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: vsf_log_init

void
vsf_log_init(struct vsf_session* p_sess)
{
  int retval;
  if (tunable_syslog_enable || tunable_tcp_wrappers)
  {
    vsf_sysutil_openlog();
  }
  if (!tunable_xferlog_enable && !tunable_dual_log_enable)
  {
    return;
  }
  if (tunable_dual_log_enable || tunable_xferlog_std_format)
  {
    retval = vsf_sysutil_create_or_open_file(tunable_xferlog_file, 0600);
    if (vsf_sysutil_retval_is_error(retval))
    {
      die2("failed to open xferlog log file:", tunable_xferlog_file);
    }
    p_sess->xferlog_fd = retval;
  }
  if (tunable_dual_log_enable || !tunable_xferlog_std_format)
  {
    if (!tunable_syslog_enable)
    {
      retval = vsf_sysutil_create_or_open_file(tunable_vsftpd_log_file, 0600);
      if (vsf_sysutil_retval_is_error(retval))
      {
        die2("failed to open vsftpd log file:", tunable_vsftpd_log_file);
      }
      p_sess->vsftpd_log_fd = retval;
    }
  }
}
开发者ID:kitsune-dsu,项目名称:kitsune-vsftpd,代码行数:34,代码来源:logging.c


示例2: add_sha

/*
 *  Add udig to set of seen udigs.
 */
static void
add_sha(char *sha)
{
	unsigned int hash;
	struct element *u;

	hash = djb((unsigned char *)sha, 40) % HASH_TABLE_SIZE;
	u = table[hash];
	while (u) {
		/*
		 *  UDig already seen, so this is not a set.
		 */
		if (strcmp(u->sha, sha) == 0)
			exit(1);
		u = u->next;
	}
	/*
	 *  SHA not found, so allocate a new one.
	 */
	u = malloc(sizeof *u);
	if (u == NULL)
		die2("malloc(element) failed", strerror(errno));
	u->sha = malloc(strlen(sha) + 1);
	if (u->sha == NULL)
		die2("malloc(sha) failed", strerror(errno));
	strcpy(u->sha, sha);
	u->next = 0;

	if (table[hash])
		u->next = table[hash];
	table[hash] = u;
}
开发者ID:jmscott,项目名称:setspace,代码行数:35,代码来源:is-udig-sha-set.c


示例3: read_data

static void
read_data (
  const char *data_file_type[],
  const char *data_file_name[]
)
{
  FILE *f;

  for (; data_file_name[0] && data_file_type[0];
       data_file_name++, data_file_type++)
    {
      fprintf (stderr, "Reading `%s'\n", data_file_name[0]);
      if (!(f = fopen (data_file_name[0], "rt")))
	die2 ("error: cannot open `%s' for reading", data_file_name[0]);

      if (!strcmp (data_file_type[0], "UnicodeData.txt"))
	read_unicode_data_txt (f);
      else if (!strcmp (data_file_type[0], "ArabicShaping.txt"))
	read_arabic_shaping_txt (f);
      else
	die2 ("error: unknown data-file type %s", data_file_type[0]);

      fclose (f);
    }

}
开发者ID:Ced2911,项目名称:xmplayer,代码行数:26,代码来源:gen-joining-type-tab.c


示例4: main

int
main (
  int argc,
  char *argv[]
)
{
  int niter = NUM_ITER;

  /* Parse the command line */
  argv[0] = appname;
  while (1)
    {
      int option_index = 0, c;
      static struct option long_options[] = {
	{"help", 0, 0, 'h'},
	{"version", 0, 0, 'V'},
	{"niter", 0, 0, 'n'},
	{0, 0, 0, 0}
      };

      c = getopt_long (argc, argv, "hVn:", long_options, &option_index);
      if (c == -1)
	break;

      switch (c)
	{
	case 0:
	  break;
	case 'h':
	  help ();
	  break;
	case 'V':
	  version ();
	  break;
	case 'n':
	  niter = atoi (optarg);
	  if (niter <= 0)
	    die2 ("invalid number of iterations `%s'\n", optarg);
	  break;
	case ':':
	case '?':
	  die2 (NULL, NULL);
	  break;
	default:
	  break;
	}
    }

  printf ("* Without explicit marks:\n");
  benchmark (TEST_STRING, niter);
  printf ("\n");
  printf ("* With explicit marks:\n");
  benchmark (TEST_STRING_EXPLICIT, niter);

  return 0;
}
开发者ID:LouisRenWeiWei,项目名称:fribidi,代码行数:56,代码来源:fribidi-benchmark.c


示例5: main

int main(int argc, char* argv[])
{
  const char* bitstr;
  const char* polystr;
  int bits;
  int digits;
  uint64 poly;
  const char* suffix;
  int columns;
  char* end;
  int i;
  const char* name;
  int reflected;

  if (argc != 5) {
    msg3("usage: ", program, " NAME BITS POLY [normal|reflected]");
    return 1;
  }

  name = argv[1];

  bitstr = argv[2];
  bits = strtol(bitstr, &end, 0);
  if (*end != 0) die2(1, "Invalid bits value: ", bitstr);
  if (bits <= 0 || bits > 64) die1(1, "bits must be between 1 and 64");
  digits = (bits + 3) / 4;
  if (bits > 32) suffix = "ULL,";
  else if (bits > 16) suffix = "UL,";
  else suffix = "U,";
  columns = calc_columns(bits, suffix);

  polystr = argv[3];
  poly = strtoull(polystr, &end, 0);
  if (*end != 0) die2(1, "Invalid poly value: ", polystr);

  reflected = 0;
  if (strcasecmp(argv[4], "reflected") == 0)
    reflected = 1;
  else if (strcasecmp(argv[4], "normal") != 0)
    die2(1, "Must be either 'normal' or 'reflected': ", argv[4]);

  gentab(bits, poly, reflected);

  obuf_put3s(&outbuf, "#include \"", name, ".h\"\n\n");
  obuf_put5s(&outbuf, "const uint", bitstr, " ", name,
	     "_table[256] = {\n");
  for (i = 0; i < 256; ++i) {
    int column = i % columns;
    if (column == 0)
      obuf_puts(&outbuf, "  ");
    obuf_puts(&outbuf, "0x");
    if (bits > 32) {
      obuf_putxw(&outbuf, crctab[i]>>32, digits-8, '0');
      obuf_putxw(&outbuf, crctab[i] & 0xffffffffUL, 8, '0');
    }
    else
开发者ID:bruceg,项目名称:bglibs,代码行数:56,代码来源:crc-gentab.c


示例6: session_init

static void
session_init(struct vsf_session* p_sess)
{
  /* Get the addresses of the control connection */
  vsf_sysutil_getpeername(VSFTP_COMMAND_FD, &p_sess->p_remote_addr);
  vsf_sysutil_getsockname(VSFTP_COMMAND_FD, &p_sess->p_local_addr);
  /* If anonymous mode is active, fetch the uid of the anonymous user */
  if (tunable_anonymous_enable)
  {
    const struct vsf_sysutil_user* p_user = 0;
    if (tunable_ftp_username)
    {
      p_user = vsf_sysutil_getpwnam(tunable_ftp_username);
    }
    if (p_user == 0)
    {
      die2("vsftpd: cannot locate user specified in 'ftp_username':",
           tunable_ftp_username);
    }
    p_sess->anon_ftp_uid = vsf_sysutil_user_getuid(p_user);
  }
  if (tunable_guest_enable)
  {
    const struct vsf_sysutil_user* p_user = 0;
    if (tunable_guest_username)
    {
      p_user = vsf_sysutil_getpwnam(tunable_guest_username);
    }
    if (p_user == 0)
    {
      die2("vsftpd: cannot locate user specified in 'guest_username':",
           tunable_guest_username);
    }
    p_sess->guest_user_uid = vsf_sysutil_user_getuid(p_user);
  }
  if (tunable_chown_uploads)
  {
    const struct vsf_sysutil_user* p_user = 0;
    if (tunable_chown_username)
    {
      p_user = vsf_sysutil_getpwnam(tunable_chown_username);
    }
    if (p_user == 0)
    {
      die2("vsftpd: cannot locate user specified in 'chown_username':",
           tunable_chown_username);
    }
    p_sess->anon_upload_chown_uid = vsf_sysutil_user_getuid(p_user);
  }
}
开发者ID:nikatshun,项目名称:asuswrt-merlin,代码行数:50,代码来源:main.c


示例7: qemu_paio_init

int qemu_paio_init(struct qemu_paioinit *aioinit)
{
    int ret;

    ret = pthread_attr_init(&attr);
    if (ret) die2(ret, "pthread_attr_init");

    ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
    if (ret) die2(ret, "pthread_attr_setdetachstate");

    TAILQ_INIT(&request_list);

    return 0;
}
开发者ID:flamenca,项目名称:winqemu,代码行数:14,代码来源:posix-aio-compat.c


示例8: main

int
main (
  int argc,
  const char **argv
)
{
  const char *data_file_type = "BidiMirroring.txt";

  if (argc < 3)
    die2 ("usage:\n  " appname " max-lookups /path/to/%s [junk...]",
	  data_file_type);

  {
    int max_depth = atoi (argv[1]);
    const char *data_file_name = argv[2];

    if (max_depth < 2)
      die ("invalid depth");

    init ();
    read_data (data_file_type, data_file_name);
    gen_mirroring_tab (max_depth, data_file_type);
  }

  return 0;
}
开发者ID:01org,项目名称:android-bluez-glib,代码行数:26,代码来源:gen-mirroring-tab.c


示例9: cond_timedwait

static int cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
                           struct timespec *ts)
{
    int ret = pthread_cond_timedwait(cond, mutex, ts);
    if (ret && ret != ETIMEDOUT) die2(ret, "pthread_cond_timedwait");
    return ret;
}
开发者ID:flamenca,项目名称:winqemu,代码行数:7,代码来源:posix-aio-compat.c


示例10: drop_all_privs

static void
drop_all_privs(void)
{
  struct mystr user_str = INIT_MYSTR;
  struct mystr dir_str = INIT_MYSTR;
  int option = VSF_SECUTIL_OPTION_CHROOT | VSF_SECUTIL_OPTION_NO_PROCS;
  if (!tunable_ssl_enable)
  {
    /* Unfortunately, can only enable this if we can be sure of not using SSL.
     * In the SSL case, we'll need to receive data transfer file descriptors.
     */
    option |= VSF_SECUTIL_OPTION_NO_FDS;
  }
  str_alloc_text(&user_str, tunable_nopriv_user);
  str_alloc_text(&dir_str, tunable_secure_chroot_dir);
  /* Be kind: give good error message if the secure dir is missing */
  {
    struct vsf_sysutil_statbuf* p_statbuf = 0;
    if (vsf_sysutil_retval_is_error(str_lstat(&dir_str, &p_statbuf)))
    {
      die2("vsftpd: not found: directory given in 'secure_chroot_dir':",
           tunable_secure_chroot_dir);
    }
    vsf_sysutil_free(p_statbuf);
  }
  vsf_secutil_change_credentials(&user_str, &dir_str, 0, 0, option);
  str_free(&user_str);
  str_free(&dir_str);
}
开发者ID:DarkAyron,项目名称:dragonsunited_minecraft_installer,代码行数:29,代码来源:twoprocess.c


示例11: vsf_two_process_start

void
vsf_two_process_start(struct vsf_session* p_sess)
{
  /* Create the comms channel between privileged parent and no-priv child */
  priv_sock_init(p_sess);
  vsf_sysutil_install_async_sighandler(kVSFSysUtilSigCHLD, handle_sigchld);
  {
    int newpid = vsf_sysutil_fork();
    if (newpid != 0)
    {
      /* Parent - go into pre-login parent process mode */
      while (1)
      {
        process_login_req(p_sess);
      }
    }
  }
  /* Child process - time to lose as much privilege as possible and do the
   * login processing
   */
  if (tunable_local_enable && tunable_userlist_enable)
  {
    int retval = str_fileread(&p_sess->userlist_str, tunable_userlist_file,
                              VSFTP_CONF_FILE_MAX);
    if (vsf_sysutil_retval_is_error(retval))
    {
      die2("cannot open user list file:", tunable_userlist_file);
    }
  }
  drop_all_privs();
  init_connection(p_sess);
  /* NOTREACHED */
}
开发者ID:kitsune-dsu,项目名称:kitsune-vsftpd,代码行数:33,代码来源:twoprocess.c


示例12: calculate_chdir_dir

static void
calculate_chdir_dir(int anon, struct mystr* p_chroot_str,
                    struct mystr* p_chdir_str,
                    const struct mystr* p_user_str)
{
  if (anon && tunable_anon_root)
  {
    str_alloc_text(p_chroot_str, tunable_anon_root);
  }
  else if (!anon && tunable_local_root)
  {
    str_alloc_text(p_chroot_str, tunable_local_root);
  }
  /* If enabled, the chroot() location embedded in the HOMEDIR takes
   * precedence.
   */
  if (!anon && tunable_passwd_chroot_enable)
  {
    struct mystr homedir_str = INIT_MYSTR;
    const struct vsf_sysutil_user* p_user = str_getpwnam(p_user_str);
    struct str_locate_result loc_result;
    if (p_user == 0)
    {
      die2("cannot locate user entry:", str_getbuf(p_user_str));
    }
    str_alloc_text(&homedir_str, vsf_sysutil_user_get_homedir(p_user));
    loc_result = str_locate_text(&homedir_str, "/./");
    if (loc_result.found)
    {
      str_split_text(&homedir_str, p_chdir_str, "/./");
      str_copy(p_chroot_str, &homedir_str);
    }
    str_free(&homedir_str);
  }
}
开发者ID:kitsune-dsu,项目名称:kitsune-vsftpd,代码行数:35,代码来源:twoprocess.c


示例13: read_data

static void
read_data (
  const char *data_file_type,
  const char *data_file_name
)
{
  FILE *f;

  fprintf (stderr, "Reading `%s'\n", data_file_name);
  if (!(f = fopen (data_file_name, "rt")))
    die2 ("error: cannot open `%s' for reading", data_file_name);

  if (!strcmp (data_file_type, "BidiMirroring.txt"))
    read_bidi_mirroring_txt (f);
  else
    die2 ("error: unknown data-file-type %s", data_file_type);

  fclose (f);
}
开发者ID:01org,项目名称:android-bluez-glib,代码行数:19,代码来源:gen-mirroring-tab.c


示例14: read_data

static void
read_data (
  const char *data_file_type,
  const char *data_file_name
)
{
  FILE *f;

  if (!(f = fopen (data_file_name, "rt")))
    die2 ("error: cannot open `%s' for reading", data_file_name);

  if (!strcmp (data_file_type, "UnicodeData.txt"))
    read_unicode_data_txt (f);
  else if (!strcmp (data_file_type, "DerivedBidiClass.txt"))
    read_derived_bidi_class_txt (f);
  else
    die2 ("error: unknown data-file type %s", data_file_type);

  fclose (f);
}
开发者ID:behdad,项目名称:fribidi,代码行数:20,代码来源:gen-bidi-type-tab.c


示例15: parse_age

void parse_age(const char* s, const cli_option* o)
{
  char* end;
  time_t* n;
  if ((n = realloc((char*)opt_ages, (opt_age_count+1) * sizeof *n)) == 0)
    oom();
  n[opt_age_count] = strtoul(s, &end, 0);
  if (*end != 0) die2(111, "Specified age is not a number: ", s);
  ++opt_age_count;
  opt_ages = n;
  (void)o;
}
开发者ID:bruceg,项目名称:qmail-notify,代码行数:12,代码来源:qmail-notify.c


示例16: get_type

static char
get_type (
  const char *s
)
{
  unsigned int i;

  for (i = 0; i < type_names_count; i++)
    if (!strcmp (s, type_names[i].name))
      return type_names[i].key;
  die2 ("bidi type name `%s' not found", s);
  return 0;
}
开发者ID:behdad,项目名称:fribidi,代码行数:13,代码来源:gen-bidi-type-tab.c


示例17: _read

static int
_read(char *buf, int size)
{
	int nbytes;

again:
	nbytes = read(0, buf, size);
	if (nbytes >= 0)
		return nbytes;
	if (errno == EINTR)
		goto again;
	die2("read() failed", strerror(errno));
	/*NOTREACHED*/
	return -1;		/*  silence compiler */
}
开发者ID:jmscott,项目名称:setspace,代码行数:15,代码来源:is-udig-sha-set.c


示例18: read_data

static int
read_data (
  const char *data_file_type,
  const char *data_file_name
)
{
  FILE *f;
  int status;

  fprintf (stderr, "Reading `%s'\n", data_file_name);
  if (!(f = fopen (data_file_name, "rt")))
    die2 ("error: cannot open `%s' for reading", data_file_name);

  status = read_file (f);

  fclose (f);

  return status;
}
开发者ID:Paxxi,项目名称:fribidi,代码行数:19,代码来源:gen-unicode-version.c


示例19: main

int main(int argc, char** argv)
{
  int i;
  unsigned long v;
  char num[FMT_ULONG_LEN];

  switch (argc) {
  case 4:
    i = cvm_client_authenticate_password(argv[1], argv[2], argv[3], 0, 1);
    break;
  case 5:
    i = cvm_client_authenticate_password(argv[1], argv[2], argv[3], argv[4], 1);
    break;
  default:
    die2(1, "Incorrect usage.", usage);
    return 1;
  }
  
  if (i) {
    num[fmt_udec(num, i)] = 0;
    msg5("Authentication failed, error #", num, " (",
	 (i < cvm_nerr) ? cvm_errlist[i] : "Unknown error code", ")");
    if (cvm_client_fact_uint(CVM_FACT_OUTOFSCOPE, &v) == 0)
      u("out of scope:     ", v);
    return i;
  }

  s("user name:        ", cvm_fact_username);
  u("user ID:          ", cvm_fact_userid);
  u("group ID:         ", cvm_fact_groupid);
  s("real name:        ", cvm_fact_realname);
  s("directory:        ", cvm_fact_directory);
  s("shell:            ", cvm_fact_shell);
  s("group name:       ", cvm_fact_groupname);
  s("system user name: ", cvm_fact_sys_username);
  s("system directory: ", cvm_fact_sys_directory);
  s("domain:           ", cvm_fact_domain);
  s("mailbox path:     ", cvm_fact_mailbox);
  while (cvm_client_fact_uint(CVM_FACT_SUPP_GROUPID, &v) == 0)
    u("supp. group ID:   ", v);
  return 0;
}
开发者ID:bruceg,项目名称:cvm,代码行数:42,代码来源:cvm-testclient.c


示例20: drop_all_privs

static void
drop_all_privs(void)
{
  struct mystr user_str = INIT_MYSTR;
  struct mystr dir_str = INIT_MYSTR;
  str_alloc_text(&user_str, tunable_nopriv_user);
  str_alloc_text(&dir_str, tunable_secure_chroot_dir);
  /* Be kind: give good error message if the secure dir is missing */
  {
    struct vsf_sysutil_statbuf* p_statbuf = 0;
    if (vsf_sysutil_retval_is_error(str_lstat(&dir_str, &p_statbuf)))
    {
      die2("vsftpd: not found: directory given in 'secure_chroot_dir':",
           tunable_secure_chroot_dir);
    }
    vsf_sysutil_free(p_statbuf);
  }
  vsf_secutil_change_credentials(&user_str, &dir_str, 0, 0,
                                 VSF_SECUTIL_OPTION_CHROOT);
  str_free(&user_str);
  str_free(&dir_str);
}
开发者ID:kitsune-dsu,项目名称:kitsune-vsftpd,代码行数:22,代码来源:twoprocess.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ die_codec函数代码示例发布时间:2022-05-30
下一篇:
C++ didReceiveResponse函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap