當前位置: 首頁>>代碼示例>>C++>>正文


C++ CHECK_ARGS函數代碼示例

本文整理匯總了C++中CHECK_ARGS函數的典型用法代碼示例。如果您正苦於以下問題:C++ CHECK_ARGS函數的具體用法?C++ CHECK_ARGS怎麽用?C++ CHECK_ARGS使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CHECK_ARGS函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: main

int main(int args, char **argv) {
    RegexIsFunny *regexTest = new RegexIsFunny();
    float quantity[4];
    float price[5];

    if (!CHECK_ARGS(args)) {
        std::cerr << "NOT ENOUGH ARGS" << std::endl;
        exit (84);
    }

    for (int i = 1; i < 5; ++i) {
        quantity[i - 1] = regexTest->checkQuantity(argv[i]);
    }

    for (int i = 5; i < 10; ++i) {
        price[i - 5] = regexTest->checkPrice(argv[i]);
    }

    Simplex toto(price, quantity);
    toto.algorithm();
    toto.display_result(price);
    delete regexTest;
    
    return 0;
}
開發者ID:Ankirama,項目名稱:Epitech,代碼行數:25,代碼來源:main.cpp

示例2: process_stdout_read

/**
   process_stdout_read : 'process -> buf:string -> pos:int -> len:int -> int
   <doc>
   Read up to [len] bytes in [buf] starting at [pos] from the process stdout.
   Returns the number of bytes readed this way. Raise an exception if this
   process stdout is closed and no more data is available for reading.

        For hxcpp, the input buffer is in bytes, not characters
   </doc>
**/
static value process_stdout_read( value vp, value str, value pos, value len ) {
   CHECK_ARGS();
   gc_enter_blocking();
#   ifdef NEKO_WINDOWS
   {
      DWORD nbytes;
      if( !ReadFile(p->oread,buffer_data(buf)+val_int(pos),val_int(len),&nbytes,NULL) )
      {
         gc_exit_blocking();
         return alloc_null();
      }
      gc_exit_blocking();
      return alloc_int(nbytes);
   }
#   else
   int nbytes = read(p->oread,buffer_data(buf) + val_int(pos),val_int(len));
   if( nbytes <= 0 )
   {
      gc_exit_blocking();
      alloc_null();
   }
   gc_exit_blocking();
   return alloc_int(nbytes);
#   endif
}
開發者ID:delahee,項目名稱:hxlibc,代碼行數:35,代碼來源:Process.cpp

示例3: set_counterfile

/* usage: CounterFile path */
MODRET set_counterfile(cmd_rec *cmd) {
  config_rec *c;
  const char *path;

  CHECK_ARGS(cmd, 1);
  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL|CONF_ANON|CONF_DIR);

  path = cmd->argv[1];
  if (*path != '/') {
    CONF_ERROR(cmd, "must be an absolute path");
  }

  /* In theory, we could open a filehandle on the configured path right
   * here, and fail if the file couldn't be created/opened.  Then we
   * could just stash that filehandle in the cmd_rec.  Easy.
   *
   * However, that would mean that we would have open descriptors for
   * vhosts to which the client may not connect.  We would also need to
   * use pr_fs_get_usable_fd() so that these filehandles don't use the wrong
   * fds.  Instead, then, we wait to open the filehandles in sess_init(),
   * where we know vhost to which the client connected.
   */

  c = add_config_param_str(cmd->argv[0], 1, path);
  c->flags |= CF_MERGEDOWN;

  return PR_HANDLED(cmd);
}
開發者ID:Castaglia,項目名稱:proftpd-mod_counter,代碼行數:29,代碼來源:mod_counter.c

示例4: info_mach_thread_command

static void
info_mach_thread_command (char *args, int from_tty)
{
  union
  {
    struct thread_basic_info basic;
  } thread_info_data;

  thread_t thread;
  kern_return_t result;
  unsigned int info_count;

  CHECK_ARGS (_("Thread"), args);
  sscanf (args, "0x%x", &thread);

  printf_unfiltered (_("THREAD_BASIC_INFO\n"));
  info_count = THREAD_BASIC_INFO_COUNT;
  result = thread_info (thread,
			THREAD_BASIC_INFO,
			(thread_info_t) & thread_info_data.basic,
			&info_count);
  MACH_CHECK_ERROR (result);

#if 0
  PRINT_FIELD (&thread_info_data.basic, user_time);
  PRINT_FIELD (&thread_info_data.basic, system_time);
#endif
  PRINT_FIELD (&thread_info_data.basic, cpu_usage);
  PRINT_FIELD (&thread_info_data.basic, run_state);
  PRINT_FIELD (&thread_info_data.basic, flags);
  PRINT_FIELD (&thread_info_data.basic, suspend_count);
  PRINT_FIELD (&thread_info_data.basic, sleep_time);
}
開發者ID:kraj,項目名稱:binutils-gdb,代碼行數:33,代碼來源:darwin-nat-info.c

示例5: info_mach_ports_command

static void
info_mach_ports_command (char *args, int from_tty)
{
  port_name_array_t port_names_data;
  port_type_array_t port_types_data;
  unsigned int name_count, type_count;
  kern_return_t result;
  int index;
  task_t task;

  CHECK_ARGS ("Task", args);
  sscanf (args, "0x%x", &task);

  result = port_names (task,
                       &port_names_data,
                       &name_count, &port_types_data, &type_count);
  MACH_CHECK_ERROR (result);

  CHECK_FATAL (name_count == type_count);

  printf_unfiltered ("Ports for task %#x:\n", task);
  for (index = 0; index < name_count; ++index)
    {
      printf_unfiltered ("port name: %#x, type %#x\n",
                         port_names_data[index], port_types_data[index]);
    }

  vm_deallocate (task_self (), (vm_address_t) port_names_data,
                 (name_count * sizeof (mach_port_t)));
  vm_deallocate (task_self (), (vm_address_t) port_types_data,
                 (type_count * sizeof (mach_port_type_t)));
}
開發者ID:HoMeCracKeR,項目名稱:gdb-ng,代碼行數:32,代碼來源:macosx-nat-info.c

示例6: set_memcacheconnectfailures

/* usage: MemcacheConnectFailures count */
MODRET set_memcacheconnectfailures(cmd_rec *cmd) {
  char *ptr = NULL;
  config_rec *c;
  uint64_t count = 0;

  CHECK_ARGS(cmd, 1);
  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL);

#ifdef HAVE_STRTOULL
  count = strtoull(cmd->argv[1], &ptr, 10);
#else
  count = strtoul(cmd->argv[1], &ptr, 10);
#endif /* HAVE_STRTOULL */

  if (ptr &&
      *ptr) {
    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "bad connect failures parameter: ",
      cmd->argv[1], NULL));
  }

  c = add_config_param(cmd->argv[0], 1, NULL);
  c->argv[0] = palloc(c->pool, sizeof(uint64_t));
  *((uint64_t *) c->argv[0]) = count;

  return PR_HANDLED(cmd);
}
開發者ID:laoflch,項目名稱:proftpd,代碼行數:27,代碼來源:mod_memcache.c

示例7: set_countermaxreaderswriters

/* usage:
 *  CounterMaxReaders max
 *  CounterMaxWriters max
 */
MODRET set_countermaxreaderswriters(cmd_rec *cmd) {
  int count;
  config_rec *c;

  CHECK_ARGS(cmd, 1);
  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL|CONF_ANON|CONF_DIR);

  /* A count of zero means that an unlimited number of readers (or writers),
   * as is the default without this module, is in effect.
   */

  count = atoi(cmd->argv[1]);
  if (count < 0 ||
      count > INT_MAX) {
    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "invalid number: ", cmd->argv[1],
      NULL));
  }

  c = add_config_param(cmd->argv[0], 1, NULL);
  c->argv[0] = pcalloc(c->pool, sizeof(int));
  *((int *) c->argv[0]) = count;
  c->flags |= CF_MERGEDOWN;

  return PR_HANDLED(cmd);
}
開發者ID:Castaglia,項目名稱:proftpd-mod_counter,代碼行數:29,代碼來源:mod_counter.c

示例8: set_modulepath

/* usage: ModulePath path */
MODRET set_modulepath(cmd_rec *cmd) {
  int res;
  struct stat st;

  CHECK_ARGS(cmd, 1);
  CHECK_CONF(cmd, CONF_ROOT);

  if (pr_fs_valid_path(cmd->argv[1]) < 0)
    CONF_ERROR(cmd, "must be an absolute path");

  /* Make sure that the configured path is not world-writeable. */
  res = pr_fsio_stat(cmd->argv[1], &st);
  if (res < 0)
    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "error checking '",
      cmd->argv[1], "': ", strerror(errno), NULL)); 

  if (!S_ISDIR(st.st_mode))
    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, cmd->argv[1], " is not a directory",
      NULL));

  if (st.st_mode & S_IWOTH)
    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, cmd->argv[1], " is world-writable",
      NULL));

  if (lt_dlsetsearchpath(cmd->argv[1]) < 0)
    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "error setting module path: ",
      lt_dlerror(), NULL));

  dso_module_path = pstrdup(dso_pool, cmd->argv[1]);
  return PR_HANDLED(cmd);
}
開發者ID:Distrotech,項目名稱:proftpd,代碼行數:32,代碼來源:mod_dso.c

示例9: set_modulectrlsacls

/* usage: ModuleControlsACLs actions|all allow|deny user|group list */
MODRET set_modulectrlsacls(cmd_rec *cmd) {
#ifdef PR_USE_CTRLS
  char *bad_action = NULL, **actions = NULL;

  CHECK_ARGS(cmd, 4);
  CHECK_CONF(cmd, CONF_ROOT);

  actions = ctrls_parse_acl(cmd->tmp_pool, cmd->argv[1]);

  if (strcmp(cmd->argv[2], "allow") != 0 &&
      strcmp(cmd->argv[2], "deny") != 0)
    CONF_ERROR(cmd, "second parameter must be 'allow' or 'deny'");

  if (strcmp(cmd->argv[3], "user") != 0 &&
      strcmp(cmd->argv[3], "group") != 0)
    CONF_ERROR(cmd, "third parameter must be 'user' or 'group'");

  bad_action = pr_ctrls_set_module_acls(dso_acttab, dso_pool, actions,
    cmd->argv[2], cmd->argv[3], cmd->argv[4]);
  if (bad_action != NULL)
    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, ": unknown action: '",
      bad_action, "'", NULL));

  return PR_HANDLED(cmd);
#else
  CONF_ERROR(cmd, "requires Controls support (--enable-ctrls)");
#endif
}
開發者ID:Distrotech,項目名稱:proftpd,代碼行數:29,代碼來源:mod_dso.c

示例10: set_tcpservicename

/* usage: TCPServiceName <name> */
MODRET set_tcpservicename(cmd_rec *cmd) {
  CHECK_ARGS(cmd, 1);
  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL);

  add_config_param_str(cmd->argv[0], 1, cmd->argv[1]);
  return HANDLED(cmd);
}
開發者ID:OPSF,項目名稱:uClinux,代碼行數:8,代碼來源:mod_wrap.c

示例11: info_mach_task_command

static void
info_mach_task_command (char *args, int from_tty)
{
  union
  {
    struct task_basic_info basic;
    struct task_events_info events;
    struct task_thread_times_info thread_times;
  } task_info_data;

  kern_return_t result;
  unsigned int info_count;
  task_t task;

  CHECK_ARGS ("Task", args);
  sscanf (args, "0x%x", &task);

  printf_unfiltered ("TASK_BASIC_INFO:\n");
  info_count = TASK_BASIC_INFO_COUNT;
  result = task_info (task,
                      TASK_BASIC_INFO,
                      (task_info_t) & task_info_data.basic, &info_count);
  MACH_CHECK_ERROR (result);

  PRINT_FIELD (&task_info_data.basic, suspend_count);
  PRINT_FIELD (&task_info_data.basic, virtual_size);
  PRINT_FIELD (&task_info_data.basic, resident_size);
#if 0
  PRINT_FIELD (&task_info_data.basic, user_time);
  PRINT_FIELD (&task_info_data.basic, system_time);
  printf_unfiltered ("\nTASK_EVENTS_INFO:\n");
  info_count = TASK_EVENTS_INFO_COUNT;
  result = task_info (task,
                      TASK_EVENTS_INFO,
                      (task_info_t) & task_info_data.events, &info_count);
  MACH_CHECK_ERROR (result);

  PRINT_FIELD (&task_info_data.events, faults);
  PRINT_FIELD (&task_info_data.events, zero_fills);
  PRINT_FIELD (&task_info_data.events, reactivations);
  PRINT_FIELD (&task_info_data.events, pageins);
  PRINT_FIELD (&task_info_data.events, cow_faults);
  PRINT_FIELD (&task_info_data.events, messages_sent);
  PRINT_FIELD (&task_info_data.events, messages_received);
#endif
  printf_unfiltered ("\nTASK_THREAD_TIMES_INFO:\n");
  info_count = TASK_THREAD_TIMES_INFO_COUNT;
  result = task_info (task,
                      TASK_THREAD_TIMES_INFO,
                      (task_info_t) & task_info_data.thread_times,
                      &info_count);
  MACH_CHECK_ERROR (result);

#if 0
  PRINT_FIELD (&task_info_data.thread_times, user_time);
  PRINT_FIELD (&task_info_data.thread_times, system_time);
#endif
}
開發者ID:HoMeCracKeR,項目名稱:gdb-ng,代碼行數:58,代碼來源:macosx-nat-info.c

示例12: info_mach_port_command

static void
info_mach_port_command (char *args, int from_tty)
{
  task_t task;
  mach_port_t port;

  CHECK_ARGS ("Task and port", args);
  sscanf (args, "0x%x 0x%x", &task, &port);

  macosx_debug_port_info (task, port);
}
開發者ID:HoMeCracKeR,項目名稱:gdb-ng,代碼行數:11,代碼來源:macosx-nat-info.c

示例13: set_counterlog

/* usage: CounterLog path|"none" */
MODRET set_counterlog(cmd_rec *cmd) {
  CHECK_ARGS(cmd, 1);
  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL);

  if (pr_fs_valid_path(cmd->argv[1]) < 0) {
    CONF_ERROR(cmd, "must be an absolute path");
  }

  add_config_param_str(cmd->argv[0], 1, cmd->argv[1]);
  return PR_HANDLED(cmd);
}
開發者ID:Castaglia,項目名稱:proftpd-mod_counter,代碼行數:12,代碼來源:mod_counter.c

示例14: set_dynmasqrefresh

/* usage: DynMasqRefresh <seconds> */
MODRET set_dynmasqrefresh(cmd_rec *cmd) {
    CHECK_CONF(cmd, CONF_ROOT);
    CHECK_ARGS(cmd, 1);

    dynmasq_timer_interval = atoi(cmd->argv[1]);
    if (dynmasq_timer_interval < 1)
        CONF_ERROR(cmd, pstrcat(cmd->tmp_pool,
                                "must be greater than zero: '", cmd->argv[1], "'", NULL));

    return PR_HANDLED(cmd);
}
開發者ID:predever,項目名稱:proftpd,代碼行數:12,代碼來源:mod_dynmasq.c

示例15: set_loadmodule

/* usage: LoadModule module */
MODRET set_loadmodule(cmd_rec *cmd) {

  CHECK_ARGS(cmd, 1);
  CHECK_CONF(cmd, CONF_ROOT);

  if (dso_load_module(cmd->argv[1]) < 0)
    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "error loading module '",
      cmd->argv[1], "': ", strerror(errno), NULL));

  return PR_HANDLED(cmd);
}
開發者ID:Distrotech,項目名稱:proftpd,代碼行數:12,代碼來源:mod_dso.c


注:本文中的CHECK_ARGS函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。