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

C++ pstrcat函数代码示例

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

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



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

示例1: match_version

static int match_version(pool *p, const char *pattern_str, char **error) {
#ifdef PR_USE_REGEX
  pr_regex_t *pre;
  int res;

  pre = pr_regexp_alloc(&ifversion_module);

  res = pr_regexp_compile(pre, pattern_str, REG_EXTENDED|REG_NOSUB|REG_ICASE);
  if (res != 0) {
    char errstr[256];

    memset(errstr, '\0', sizeof(errstr));
    pr_regexp_error(res, pre, errstr, sizeof(errstr)-1);

    pr_regexp_free(NULL, pre);
    *error = pstrcat(p, "unable to compile pattern '", pattern_str, "': ",
      errstr, NULL);

    return 0;
  }

  res = pr_regexp_exec(pre, pr_version_get_str(), 0, NULL, 0, 0, 0);
  if (res != 0) {
    *error = pstrcat(p, "server version '", pr_version_get_str(),
      "' failed to match pattern '", pattern_str, "'", NULL);
  }

  pr_regexp_free(NULL, pre);
  return (res == 0 ? 1 : 0);

#else
  *error = pstrdup(p, "system does not support POSIX regular expressions");
  return 0;
#endif /* regex support */
}
开发者ID:Nubisa,项目名称:JXPanel,代码行数:35,代码来源:mod_ifversion.c


示例2: 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


示例3: fgets

static char *myfgets(char *s, int n, FILE *stream)
{
    char *LString1;
    char *LString2;
    char *temp;
    pstring String;
    pstring NewString;
    int i;

    fgets(s,n,stream);
    while ((LString1 = strchr(s,'%')) != NULL) {
        if (!(LString2 = strchr(LString1+1,'%'))) break;
        *LString2 = '\0';
        pstrcpy(String,LString1+1);
        i = 0;
        while(*sbuffer[i]!='\0') {
            if (strncmp(sbuffer[i],String,strlen(String))==0)
            {
                pstrcpy(String,sbuffer[i]);
                if ((temp = strchr(String,'=')) != NULL) ++temp;
                pstrcpy(String,temp);
                break;
            }
            i++;
        }
        *LString1 = '\0';
        pstrcpy(NewString,s);
        pstrcat(NewString,String);
        pstrcat(NewString,LString2+1);
        pstrcpy(s, NewString);
    }
    return(s);
}
开发者ID:b3rnik,项目名称:dsl-n55u-bender,代码行数:33,代码来源:make_printerdef.c


示例4: do_tar

static void do_tar(file_info *finfo)
{
	pstring rname;

	if (strequal(finfo->name,"..") || strequal(finfo->name,"."))
		return;

	/* Is it on the exclude list ? */
	if (!tar_excl && clipn) {
		pstring exclaim;

		DEBUG(5, ("Excl: strlen(cur_dir) = %d\n", (int)strlen(cur_dir)));

		pstrcpy(exclaim, cur_dir);
		*(exclaim+strlen(exclaim)-1)='\0';

		pstrcat(exclaim, "\\");
		pstrcat(exclaim, finfo->name);

		DEBUG(5, ("...tar_re_search: %d\n", tar_re_search));

		if ((!tar_re_search && clipfind(cliplist, clipn, exclaim)) ||
#ifdef HAVE_REGEX_H
				(tar_re_search && !regexec(preg, exclaim, 0, NULL, 0))) {
#else
				(tar_re_search && mask_match_list(exclaim, cliplist, clipn, True))) {
#endif
			DEBUG(3,("Skipping file %s\n", exclaim));
			return;
		}
	}
开发者ID:niubl,项目名称:camera_project,代码行数:31,代码来源:clitar.c


示例5: tilde_expand

/* If the path has the home directory in it, replace it with a tilde. */
int tilde_expand(char *buf, int buf_size, const char *path1)
{
    char path[MAX_FILENAME_SIZE];
    char *homedir;
    int ret = 0;
    if (!is_abs_path(path1)) {
        if (*path1 == '~') {
            if (path1[1] == '\0' || path1[1] == '/') {
                homedir = getenv("HOME");
                if (homedir) {
                    pstrcpy(path, sizeof(path), homedir);
#ifdef CONFIG_WIN32
                    path_win_to_unix(path);
#endif
                    remove_slash(path);
                    pstrcat(path, sizeof(path), path1 + 1);
                    path1 = path;
                }
            } else {
                /* CG: should get info from getpwnam */
                pstrcpy(path, sizeof(path), "/home/");
                pstrcat(path, sizeof(path), path1 + 1);
                path1 = path;
            }
            ret = 1;
        }
    }
    pstrcpy(buf, buf_size, path1);
    return ret;
}
开发者ID:shanecelis,项目名称:qemacs,代码行数:31,代码来源:util.c


示例6: pstrcat

static const char *describe_eacces_file(pool *p, const char *path, int flags) {
  if (flags & EXPLAIN_PATH_FL_WANT_SEARCH) {
    return pstrcat(p, "file '", path, "' is not searchable by the user", NULL);
  }

  return pstrcat(p, "directory containing '", path,
    "' is not writable by the user", NULL);
}
开发者ID:Castaglia,项目名称:proftpd-mod_explain,代码行数:8,代码来源:path.c


示例7: SNUM

/****************************************************************************
Build the print command in the supplied buffer. This means getting the
print command for the service and inserting the printer name and the
print file name. Return NULL on error, else the passed buffer pointer.
****************************************************************************/
static char *build_print_command(int cnum, char *command, char *syscmd, char *filename1)
{
  int snum = SNUM(cnum);
  char *tstr;
  pstring filename;
  
  /* get the print command for the service. */
  tstr = command;
  if (!syscmd || !tstr) {
    DEBUG(0,("No print command for service `%s'\n", SERVICE(snum)));
    return (NULL);
  }

  /* copy the command into the buffer for extensive meddling. */
  StrnCpy(syscmd, tstr, sizeof(pstring) - 1);
  
  /* look for "%s" in the string. If there is no %s, we cannot print. */   
  if (!strstr(syscmd, "%s") && !strstr(syscmd, "%f")) {
    DEBUG(2,("WARNING! No placeholder for the filename in the print command for service %s!\n", SERVICE(snum)));
  }
  
  if (strstr(syscmd,"%s")) {
    int iOffset = PTR_DIFF(strstr(syscmd, "%s"),syscmd);
    
    /* construct the full path for the filename, shouldn't be necessary unless
       the subshell causes a "cd" to be executed.
       Only use the full path if there isn't a / preceding the %s */
    if (iOffset==0 || syscmd[iOffset-1] != '/') {
      StrnCpy(filename,Connections[cnum].connectpath,sizeof(filename)-1);
      trim_string(filename,"","/");
      pstrcat(filename,"/");
      pstrcat(filename,filename1);
    }
    else
      pstrcpy(filename,filename1);
    
    string_sub(syscmd, "%s", filename);
  }
  
  string_sub(syscmd, "%f", filename1);
  
  /* Does the service have a printername? If not, make a fake and empty    */
  /* printer name. That way a %p is treated sanely if no printer */
  /* name was specified to replace it. This eventuality is logged.         */
  tstr = PRINTERNAME(snum);
  if (tstr == NULL || tstr[0] == '\0') {
    DEBUG(3,( "No printer name - using %s.\n", SERVICE(snum)));
    tstr = SERVICE(snum);
  }
  
  string_sub(syscmd, "%p", tstr);
  
  standard_sub(cnum,syscmd);
  
  return (syscmd);
}
开发者ID:earthGavinLee,项目名称:hg556a_source,代码行数:61,代码来源:printing.c


示例8: cmd_mount

/****************************************************************************
mount smbfs
****************************************************************************/
static void cmd_mount(char *inbuf,char *outbuf)
{
	pstring mpoint;
	pstring share_name;
	pstring mount_command;
	fstring buf;
	int retval;
	char mount_point[MAXPATHLEN+1];

	if (!next_token(NULL, mpoint, NULL))
	{
		DEBUG(0,("You must supply a mount point\n"));
		return;
	}

	memset(mount_point, 0, sizeof(mount_point));

	if (realpath(mpoint, mount_point) == NULL)
	{
		DEBUG(0, ("Could not resolve mount point\n"));
		return;
	}

	/*
	 * Build the service name to report on the Unix side,
	 * converting '\' to '/' and ' ' to '_'.
	 */
	pstrcpy(share_name, service);  
	string_replace(share_name, '\\', '/');
	string_replace(share_name, ' ', '_');

	slprintf(mount_command, sizeof(mount_command)-1,"smbmnt %s -s %s", mount_point, share_name);

	while(next_token(NULL, buf, NULL))
	{
		pstrcat(mount_command, " ");
		pstrcat(mount_command, buf);
	}

	DEBUG(3, ("mount command: %s\n", mount_command));

	/*
	 * Create the background process before trying the mount.
	 * (We delay closing files to allow diagnostic messages.)
	 */
	daemonize();

	/* The parent has exited here, the child handles the connection: */
	if ((retval = system(mount_command)) != 0)
	{
		DEBUG(0,("mount failed\n"));
		exit(1);
	}
	send_fs_socket(mount_point, inbuf, outbuf);
}	
开发者ID:earthGavinLee,项目名称:hg556a_source,代码行数:58,代码来源:smbmount.c


示例9: set_schema_version

static int set_schema_version(pool *p, const char *schema_name,
    unsigned int schema_version) {
  int res, xerrno = 0;
  const char *stmt, *errstr = NULL;
  array_header *results;

  /* CREATE TABLE $schema_name.schema_version (
   *   schema TEXT NOT NULL PRIMARY KEY,
   *   version INTEGER NOT NULL
   * );
   */
  stmt = pstrcat(p, "CREATE TABLE IF NOT EXISTS ", schema_name, ".schema_version (schema TEXT NOT NULL PRIMARY KEY, version INTEGER NOT NULL);", NULL);
  res = proxy_db_exec_stmt(p, stmt, &errstr);
  if (res < 0) {
    (void) pr_log_debug(DEBUG3, MOD_PROXY_VERSION
      ": error executing statement '%s': %s", stmt, errstr);
    errno = EPERM;
    return -1;
  }

  stmt = pstrcat(p, "INSERT INTO ", schema_name, ".schema_version (schema, version) VALUES (?, ?);", NULL);
  res = proxy_db_prepare_stmt(p, stmt);
  if (res < 0) {
    xerrno = errno;

    (void) pr_log_debug(DEBUG3, MOD_PROXY_VERSION
      ": error preparing statement '%s': %s", stmt, strerror(xerrno));
    errno = xerrno;
    return -1;
  }

  res = proxy_db_bind_stmt(p, stmt, 1, PROXY_DB_BIND_TYPE_TEXT,
    (void *) schema_name);
  if (res < 0) {
    return -1;
  }

  res = proxy_db_bind_stmt(p, stmt, 2, PROXY_DB_BIND_TYPE_INT,
    (void *) &schema_version);
  if (res < 0) {
    return -1;
  }

  results = proxy_db_exec_prepared_stmt(p, stmt, &errstr);
  if (results == NULL) {
    (void) pr_log_debug(DEBUG3, MOD_PROXY_VERSION
      ": error executing statement '%s': %s", stmt,
      errstr ? errstr : strerror(errno));
    errno = EPERM;
    return -1;
  }

  return 0;
}
开发者ID:brownvin81,项目名称:proftpd-mod_proxy,代码行数:54,代码来源:db.c


示例10: compare_version

static int compare_version(pool *p, char *version_str, char **error) {
  char *server_version_str;
  unsigned int version_status = 0, server_version_status = 0;
  unsigned int version[3] = { 0, 0, 0 }, server_version[3] = { 0, 0, 0 };
  int res;

  res = parse_version(version_str, version, &version_status);
  if (res < 0) {
    *error = pstrcat(p, "badly formatted configured version '", version_str,
      "'", NULL);
    return -1;
  }

  server_version_str = pstrdup(p, pr_version_get_str());
  res = parse_version(server_version_str, server_version,
    &server_version_status);
  if (res < 0) {
    *error = pstrcat(p, "badly formatted server version '", server_version_str,
      "'", NULL);
    return -1;
  }

  *error = NULL;

  if (server_version[0] > version[0]) {
    return 1;

  } else if (server_version[0] < version[0]) {
    return -1;

  } else if (server_version[1] > version[1]) {
    return 1;

  } else if (server_version[1] < version[1]) {
    return -1;

  } else if (server_version[2] > version[2]) {
    return 1;

  } else if (server_version[2] < version[2]) {
    return -1;

  } else if (server_version_status > version_status) {
    return 1;

  } else if (server_version_status < version_status) {
    return -1;
  }

  /* Appear to be the same versions. */
  return 0;
}
开发者ID:Nubisa,项目名称:JXPanel,代码行数:52,代码来源:mod_ifversion.c


示例11: fstrcpy

static char *reg_test(char *pattern, char *file)
{
	static fstring ret;
	pstring rpattern;
	regex_t preg;

	pattern = 1+strrchr(pattern,'\\');
	file = 1+strrchr(file,'\\');

	fstrcpy(ret,"---");

	if (strcmp(file,"..") == 0) file = ".";
	if (strcmp(pattern,".") == 0) return ret;

	if (strcmp(pattern,"") == 0) {
		ret[2] = '+';
		return ret;
	}

	pstrcpy(rpattern,"^");
	pstrcat(rpattern, pattern);

	all_string_sub(rpattern,".", "[.]", 0);
	all_string_sub(rpattern,"?", ".{1}", 0);
	all_string_sub(rpattern,"*", ".*", 0);
	all_string_sub(rpattern+strlen(rpattern)-1,">", "([^.]?|[.]?$)", 0);
	all_string_sub(rpattern,">", "[^.]?", 0);

	all_string_sub(rpattern,"<[.]", ".*[.]", 0);
	all_string_sub(rpattern,"<\"", "(.*[.]|.*$)", 0);
	all_string_sub(rpattern,"<", "([^.]*|[^.]*[.]|[.][^.]*|[.].*[.])", 0);
	if (strlen(pattern)>1) {
		all_string_sub(rpattern+strlen(rpattern)-1,"\"", "[.]?", 0);
	}
	all_string_sub(rpattern,"\"", "([.]|$)", 0);
	pstrcat(rpattern,"$");

	/* printf("pattern=[%s] rpattern=[%s]\n", pattern, rpattern); */

	regcomp(&preg, rpattern, REG_ICASE|REG_NOSUB|REG_EXTENDED);
	if (regexec(&preg, ".", 0, NULL, 0) == 0) {
		ret[0] = '+';
		ret[1] = '+';
	}
	if (regexec(&preg, file, 0, NULL, 0) == 0) {
		ret[2] = '+';
	}
	regfree(&preg);

	return ret;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:51,代码来源:masktest.c


示例12: av_mallocz

rwpipe *rwpipe_open( int argc, char *argv[] )
{
    rwpipe *this = av_mallocz( sizeof( rwpipe ) );

    if ( this != NULL )
    {
        int input[ 2 ];
        int output[ 2 ];

        pipe( input );
        pipe( output );

        this->pid = fork();

        if ( this->pid == 0 )
        {
#define COMMAND_SIZE 10240
            char *command = av_mallocz( COMMAND_SIZE );
            int i;

            strcpy( command, "" );
            for ( i = 0; i < argc; i ++ )
            {
                pstrcat( command, COMMAND_SIZE, argv[ i ] );
                pstrcat( command, COMMAND_SIZE, " " );
            }

            dup2( output[ 0 ], STDIN_FILENO );
            dup2( input[ 1 ], STDOUT_FILENO );

            close( input[ 0 ] );
            close( input[ 1 ] );
            close( output[ 0 ] );
            close( output[ 1 ] );

            execl("/bin/sh", "sh", "-c", command, NULL );
            exit( 255 );
        }
        else
        {
            close( input[ 1 ] );
            close( output[ 0 ] );

            this->reader = fdopen( input[ 0 ], "r" );
            this->writer = fdopen( output[ 1 ], "w" );
        }
    }

    return this;
}
开发者ID:foogywoo,项目名称:drone,代码行数:50,代码来源:ppm.c


示例13: lookup_entry

/*
   Lockup an entry in a file
   Return all the lines between the entry and the next one or the end of file
   An entry is something between braces.
*/
static void lookup_entry(FILE *fichier,char *chaine)
{
    int found=0,pointeur=0,i=0;
    char *temp,*temp2;

    temp=(char *)malloc(sizeof(pstring));
    temp2=(char *)malloc(sizeof(pstring));

    if(temp == NULL || temp2 == NULL) {
        fprintf(stderr,"lookup_entry: malloc fail !\n");
        exit(1);
    }

    *buffer[0]='\0';

    pstrcpy(temp2,"[");
    pstrcat(temp2,chaine);
    pstrcat(temp2,"]");

    rewind(fichier);
#ifdef DEBUGIT
    fprintf(stderr,"\tLooking for %s\n",chaine);
#endif

    while (!feof(fichier) && found==0) {
        *temp='\0';
        myfgets(temp,255,fichier);
        if (strncmp(temp,temp2,strlen(temp2))==0) found=1;
    }


    while (!feof(fichier) && found==1) {
        *temp='\0';
        myfgets(temp,255,fichier);
        if (*temp=='[') {
            found=2;
            *buffer[pointeur]='\0';
        }
        else {
            pstrcpy(buffer[pointeur],temp);
            i=strlen(buffer[pointeur])-1;
            while (buffer[pointeur][i]=='\r' || buffer[pointeur][i]=='\n')
                buffer[pointeur][i--]='\0';
            pointeur++;
        }
    }
#ifdef DEBUGIT
    fprintf(stderr,"\t\tFound %d entries\n",pointeur-1);
#endif
}
开发者ID:b3rnik,项目名称:dsl-n55u-bender,代码行数:55,代码来源:make_printerdef.c


示例14: url_add_option

/* add option to url of the form:
   "http://host:port/path?option1=val1&option2=val2... */
static void url_add_option(char *buf, int buf_size, const char *fmt, ...)
{
    char buf1[1024];
    va_list ap;

    va_start(ap, fmt);
    if (strchr(buf, '?'))
        pstrcat(buf, buf_size, "&");
    else
        pstrcat(buf, buf_size, "?");
    vsnprintf(buf1, sizeof(buf1), fmt, ap);
    pstrcat(buf, buf_size, buf1);
    va_end(ap);
}
开发者ID:OpenSageTV,项目名称:mplayer-sage9orig,代码行数:16,代码来源:rtpproto.c


示例15: 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


示例16: dump_core

/**************************************************************************** **
 prepare to dump a core file - carefully!
 **************************************************************************** */
static BOOL dump_core(void)
{
  char *p;
  pstring dname;
  pstrcpy( dname, debugf );
  if ((p=strrchr(dname,'/')))
    *p=0;
  pstrcat( dname, "/corefiles" );
  mkdir( dname, 0700 );
  sys_chown( dname, getuid(), getgid() );
  chmod( dname, 0700 );
  if ( chdir(dname) )
    return( False );
  umask( ~(0700) );

#ifdef HAVE_GETRLIMIT
#ifdef RLIMIT_CORE
  {
    struct rlimit rlp;
    getrlimit( RLIMIT_CORE, &rlp );
    rlp.rlim_cur = MAX( 4*1024*1024, rlp.rlim_cur );
    setrlimit( RLIMIT_CORE, &rlp );
    getrlimit( RLIMIT_CORE, &rlp );
    DEBUG( 3, ( "Core limits now %d %d\n", (int)rlp.rlim_cur, (int)rlp.rlim_max ) );
  }
#endif
#endif


  DEBUG(0,("Dumping core in %s\n",dname));
  abort();
  return( True );
} /* dump_core */
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:36,代码来源:nmbd.c


示例17: vmdk_write_cid

static int vmdk_write_cid(BlockDriverState *bs, uint32_t cid)
{
    char desc[DESC_SIZE], tmp_desc[DESC_SIZE];
    char *p_name, *tmp_str;
    BDRVVmdkState *s = bs->opaque;
    int ret;

    ret = bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE);
    if (ret < 0) {
        return ret;
    }

    desc[DESC_SIZE - 1] = '\0';
    tmp_str = strstr(desc, "parentCID");
    if (tmp_str == NULL) {
        return -EINVAL;
    }

    pstrcpy(tmp_desc, sizeof(tmp_desc), tmp_str);
    p_name = strstr(desc, "CID");
    if (p_name != NULL) {
        p_name += sizeof("CID");
        snprintf(p_name, sizeof(desc) - (p_name - desc), "%x\n", cid);
        pstrcat(desc, sizeof(desc), tmp_desc);
    }

    ret = bdrv_pwrite_sync(bs->file, s->desc_offset, desc, DESC_SIZE);
    if (ret < 0) {
        return ret;
    }

    return 0;
}
开发者ID:AVEx-6502,项目名称:qemu-6502,代码行数:33,代码来源:vmdk.c


示例18: 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


示例19: 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


示例20: set_memcacheoptions

/* usage: MemcacheOptions opt1 opt2 ... */
MODRET set_memcacheoptions(cmd_rec *cmd) {
  config_rec *c = NULL;
  register unsigned int i = 0;
  unsigned long opts = 0UL;

  if (cmd->argc-1 == 0) {
    CONF_ERROR(cmd, "wrong number of parameters");
  }

  CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL);

  c = add_config_param(cmd->argv[0], 1, NULL);

  for (i = 1; i < cmd->argc; i++) {
    if (strcmp(cmd->argv[i], "NoBinaryProtocol") == 0) {
      opts |= PR_MEMCACHE_FL_NO_BINARY_PROTOCOL;

    } else if (strcmp(cmd->argv[i], "NoRandomReplicaReads") == 0) {
      opts |= PR_MEMCACHE_FL_NO_RANDOM_REPLICA_READ;

    } else {
      CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, ": unknown MemcacheOption '",
        cmd->argv[i], "'", NULL));
    }
  }

  c->argv[0] = pcalloc(c->pool, sizeof(unsigned long));
  *((unsigned long *) c->argv[0]) = opts;

  return PR_HANDLED(cmd);
}
开发者ID:laoflch,项目名称:proftpd,代码行数:32,代码来源:mod_memcache.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pstrcpy函数代码示例发布时间:2022-05-30
下一篇:
C++ pstorage_init函数代码示例发布时间: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