本文整理汇总了C++中ISDOT函数的典型用法代码示例。如果您正苦于以下问题:C++ ISDOT函数的具体用法?C++ ISDOT怎么用?C++ ISDOT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ISDOT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: determine_path_error
static NTSTATUS determine_path_error(const char *name,
bool allow_wcard_last_component)
{
const char *p;
if (!allow_wcard_last_component) {
/* Error code within a pathname. */
return NT_STATUS_OBJECT_PATH_NOT_FOUND;
}
/* We're terminating here so we
* can be a little slower and get
* the error code right. Windows
* treats the last part of the pathname
* separately I think, so if the last
* component is a wildcard then we treat
* this ./ as "end of component" */
p = strchr(name, '/');
if (!p && (ms_has_wild(name) || ISDOT(name))) {
/* Error code at the end of a pathname. */
return NT_STATUS_OBJECT_NAME_INVALID;
} else {
/* Error code within a pathname. */
return NT_STATUS_OBJECT_PATH_NOT_FOUND;
}
}
开发者ID:srimalik,项目名称:samba,代码行数:28,代码来源:filename.c
示例2: checkdot
static void
checkdot(char **argv)
{
char *p, **save, **t;
int complained;
complained = 0;
for (t = argv; *t;) {
/* strip trailing slashes */
p = strrchr(*t, '\0');
while (--p > *t && *p == '/')
*p = '\0';
/* extract basename */
if ((p = strrchr(*t, '/')) != NULL)
++p;
else
p = *t;
if (ISDOT(p)) {
if (!complained++)
warnx("\".\" and \"..\" may not be removed");
eval = 1;
for (save = t; (t[0] = t[1]) != NULL; ++t)
continue;
t = save;
} else
++t;
}
}
开发者ID:0111abhi,项目名称:platform_system_core,代码行数:30,代码来源:rm.c
示例3: test_mask
static void test_mask(int argc, char *argv[],
TALLOC_CTX *mem_ctx,
struct smbcli_state *cli)
{
char *mask, *file;
int l1, l2, i, l;
int mc_len = strlen(maskchars);
int fc_len = strlen(filechars);
smbcli_mkdir(cli->tree, "\\masktest");
smbcli_unlink(cli->tree, "\\masktest\\*");
if (argc >= 2) {
while (argc >= 2) {
mask = talloc_strdup(mem_ctx, "\\masktest\\");
file = talloc_strdup(mem_ctx, "\\masktest\\");
mask = talloc_strdup_append(mask, argv[0]);
file = talloc_strdup_append(file, argv[1]);
testpair(mem_ctx, cli, mask, file);
argv += 2;
argc -= 2;
}
goto finished;
}
while (1) {
l1 = 1 + random() % max_length;
l2 = 1 + random() % max_length;
mask = talloc_strdup(mem_ctx, "\\masktest\\");
file = talloc_strdup(mem_ctx, "\\masktest\\");
mask = talloc_realloc_size(mem_ctx, mask, strlen(mask)+l1+1);
file = talloc_realloc_size(mem_ctx, file, strlen(file)+l2+1);
l = strlen(mask);
for (i=0;i<l1;i++) {
mask[i+l] = maskchars[random() % mc_len];
}
mask[l+l1] = 0;
for (i=0;i<l2;i++) {
file[i+l] = filechars[random() % fc_len];
}
file[l+l2] = 0;
if (ISDOT(file+l) || ISDOTDOT(file+l) || ISDOTDOT(mask+l)) {
continue;
}
if (strspn(file+l, ".") == strlen(file+l)) continue;
testpair(mem_ctx, cli, mask, file);
if (NumLoops && (--NumLoops == 0))
break;
}
finished:
smbcli_rmdir(cli->tree, "\\masktest");
talloc_free(mem_ctx);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:59,代码来源:masktest.c
示例4: read_cgmem_stats
void
read_cgmem_stats(struct module *mod)
{
DIR *dir;
char path[128];
char line[LEN_128];
FILE *memfd;
struct dirent *ent; /* dirent handle */
n_group = 0;
memset(cgmem_groups, 0, CGMEM_GROUP_SIZE * MAX_GROUP);
if ((dir = opendir(CGMEM_PATH)) == NULL) {
return;
}
while ((ent = readdir(dir))) {
if (ent->d_type == DT_DIR && !ISDOT(ent->d_name)) { //for each group
memcpy(&cgmem_groups[n_group].group_name, ent->d_name, strlen(ent->d_name)+1);
snprintf(path, 128, "%s/%s/memory.stat", CGMEM_PATH, ent->d_name);
if ((memfd = fopen(path, "r")) == NULL) {
closedir(dir);
return;
}
while (fgets(line, 128, memfd) != NULL) {
if (!strncmp(line, "cache", 5)) {
sscanf(line + 5, "%lu", &cgmem_groups[n_group].cache);
} else if (!strncmp(line, "rss", 3)) {
sscanf(line + 3, "%lu", &cgmem_groups[n_group].rss);
} else if (!strncmp(line, "swap", 4)) {
sscanf(line + 4, "%lu", &cgmem_groups[n_group].swap);
} else if (!strncmp(line, "inactive_anon", 13)) {
sscanf(line + 13, "%lu", &cgmem_groups[n_group].inanon);
} else if (!strncmp(line, "active_anon", 11)) {
sscanf(line + 11, "%lu", &cgmem_groups[n_group].acanon);
} else if (!strncmp(line, "inactive_file", 13)) {
sscanf(line + 13, "%lu", &cgmem_groups[n_group].infile);
} else if (!strncmp(line, "active_file", 11)) {
sscanf(line + 11, "%lu", &cgmem_groups[n_group].acfile);
}
}
fclose(memfd);
n_group ++;
}
}
closedir(dir);
print_cgmem_stats(mod);
}
开发者ID:atixing,项目名称:tsar,代码行数:57,代码来源:mod_cgmem.c
示例5: get_real_filename
int get_real_filename(connection_struct *conn, const char *path,
const char *name, TALLOC_CTX *mem_ctx,
char **found_name)
{
struct smb_Dir *cur_dir;
const char *dname;
bool mangled;
char *unmangled_name = NULL;
long curpos;
/* open the directory */
if (!(cur_dir = OpenDir(talloc_tos(), conn, path, NULL, 0))) {
DEBUG(3,("scan dir didn't open dir [%s]\n",path));
TALLOC_FREE(unmangled_name);
return -1;
}
/* now scan for matching names */
curpos = 0;
while ((dname = ReadDirName(cur_dir, &curpos, NULL))) {
/* Is it dot or dot dot. */
if (ISDOT(dname) || ISDOTDOT(dname)) {
continue;
}
/*
* At this point dname is the unmangled name.
* name is either mangled or not, depending on the state
* of the "mangled" variable. JRA.
*/
/*
* Check mangled name against mangled name, or unmangled name
* against unmangled name.
*/
if ((mangled && mangled_equal(name,dname,conn->params)) ||
fname_equal(name, dname, conn->case_sensitive)) {
/* we've found the file, change it's name and return */
*found_name = talloc_strdup(mem_ctx, dname);
TALLOC_FREE(unmangled_name);
TALLOC_FREE(cur_dir);
if (!*found_name) {
errno = ENOMEM;
return -1;
}
return 0;
}
}
TALLOC_FREE(unmangled_name);
TALLOC_FREE(cur_dir);
errno = ENOENT;
return -1;
}
开发者ID:gojdic,项目名称:samba,代码行数:56,代码来源:filename.c
示例6: can_set_delete_on_close
NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode)
{
/*
* Only allow delete on close for writable files.
*/
if ((dosmode & FILE_ATTRIBUTE_READONLY) &&
!lp_delete_readonly(SNUM(fsp->conn))) {
DEBUG(10,("can_set_delete_on_close: file %s delete on close "
"flag set but file attribute is readonly.\n",
fsp_str_dbg(fsp)));
return NT_STATUS_CANNOT_DELETE;
}
/*
* Only allow delete on close for writable shares.
*/
if (!CAN_WRITE(fsp->conn)) {
DEBUG(10,("can_set_delete_on_close: file %s delete on "
"close flag set but write access denied on share.\n",
fsp_str_dbg(fsp)));
return NT_STATUS_ACCESS_DENIED;
}
/*
* Only allow delete on close for files/directories opened with delete
* intent.
*/
if (!(fsp->access_mask & DELETE_ACCESS)) {
DEBUG(10,("can_set_delete_on_close: file %s delete on "
"close flag set but delete access denied.\n",
fsp_str_dbg(fsp)));
return NT_STATUS_ACCESS_DENIED;
}
/* Don't allow delete on close for non-empty directories. */
if (fsp->is_directory) {
SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name));
/* Or the root of a share. */
if (ISDOT(fsp->fsp_name->base_name)) {
DEBUG(10,("can_set_delete_on_close: can't set delete on "
"close for the root of a share.\n"));
return NT_STATUS_ACCESS_DENIED;
}
return can_delete_directory(fsp->conn,
fsp->fsp_name->base_name);
}
return NT_STATUS_OK;
}
开发者ID:srimalik,项目名称:samba,代码行数:54,代码来源:file_access.c
示例7: reg_match_one
static bool reg_match_one(struct smbcli_state *cli, const char *pattern, const char *file)
{
/* oh what a weird world this is */
if (old_list && strcmp(pattern, "*.*") == 0) return true;
if (ISDOT(pattern)) return false;
if (ISDOTDOT(file)) file = ".";
return ms_fnmatch(pattern, file, cli->transport->negotiate.protocol)==0;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:11,代码来源:masktest.c
示例8: check_veto_path
NTSTATUS check_veto_path(connection_struct *conn, const char *name)
{
if (IS_VETO_PATH(conn, name)) {
/* Is it not dot or dot dot. */
if (!(ISDOT(name) || ISDOTDOT(name))) {
DEBUG(5,("check_veto_path: file path name %s vetoed\n",
name));
return map_nt_error_from_unix(ENOENT);
}
}
return NT_STATUS_OK;
}
开发者ID:srimalik,项目名称:samba,代码行数:12,代码来源:filename.c
示例9: fts_stat
static unsigned short
fts_stat(FTS *sp, FTSENT *p)
{
FTSENT *t;
dev_t dev;
ino_t ino;
struct stat *sbp;
/* If user needs stat info, stat buffer already allocated. */
sbp = p->fts_statp;
if (lstat(p->fts_accpath, sbp)) {
p->fts_errno = errno;
memset(sbp, 0, sizeof(struct stat));
return (FTS_NS);
}
if (S_ISDIR(sbp->st_mode)) {
/*
* Set the device/inode. Used to find cycles and check for
* crossing mount points. Also remember the link count, used
* in fts_build to limit the number of stat calls. It is
* understood that these fields are only referenced if fts_info
* is set to FTS_D.
*/
dev = p->fts_dev = sbp->st_dev;
ino = p->fts_ino = sbp->st_ino;
p->fts_nlink = sbp->st_nlink;
if (ISDOT(p->fts_name))
return (FTS_DOT);
/*
* Cycle detection is done by brute force when the directory
* is first encountered. If the tree gets deep enough or the
* number of symbolic links to directories is high enough,
* something faster might be worthwhile.
*/
for (t = p->fts_parent;
t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
if (ino == t->fts_ino && dev == t->fts_dev) {
p->fts_cycle = t;
return (FTS_DC);
}
return (FTS_D);
}
if (S_ISLNK(sbp->st_mode))
return (FTS_SL);
if (S_ISREG(sbp->st_mode))
return (FTS_F);
return (FTS_DEFAULT);
}
开发者ID:fgken,项目名称:netbsd-src,代码行数:52,代码来源:compat_fts.c
示例10: pvfs_list_seek
/*
seek to the given name
*/
NTSTATUS pvfs_list_seek(struct pvfs_dir *dir, const char *name, off_t *ofs)
{
struct dirent *de;
int i;
dir->end_of_search = False;
if (ISDOT(name)) {
dir->offset = DIR_OFFSET_DOTDOT;
*ofs = dir->offset;
return NT_STATUS_OK;
}
if (ISDOTDOT(name)) {
dir->offset = DIR_OFFSET_BASE;
*ofs = dir->offset;
return NT_STATUS_OK;
}
for (i=dir->name_cache_index;i>=0;i--) {
struct name_cache_entry *e = &dir->name_cache[i];
if (e->name && strcasecmp_m(name, e->name) == 0) {
*ofs = e->offset;
return NT_STATUS_OK;
}
}
for (i=NAME_CACHE_SIZE-1;i>dir->name_cache_index;i--) {
struct name_cache_entry *e = &dir->name_cache[i];
if (e->name && strcasecmp_m(name, e->name) == 0) {
*ofs = e->offset;
return NT_STATUS_OK;
}
}
rewinddir(dir->dir);
while ((de = readdir(dir->dir))) {
if (strcasecmp_m(name, de->d_name) == 0) {
dir->offset = telldir(dir->dir) + DIR_OFFSET_BASE;
*ofs = dir->offset;
return NT_STATUS_OK;
}
}
dir->end_of_search = True;
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:51,代码来源:pvfs_dirlist.c
示例11: listfn
static void listfn(struct clilist_file_info *f, const char *s, void *state)
{
struct masktest_state *m = (struct masktest_state *)state;
if (ISDOT(f->name)) {
resultp[0] = '+';
} else if (ISDOTDOT(f->name)) {
resultp[1] = '+';
} else {
resultp[2] = '+';
}
last_hit.long_name = talloc_strdup(m->mem_ctx, f->name);
last_hit.short_name = talloc_strdup(m->mem_ctx, f->short_name);
f_info_hit = true;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:16,代码来源:masktest.c
示例12: pvfs_directory_empty
/*
see if a directory is empty
*/
BOOL pvfs_directory_empty(struct pvfs_state *pvfs, struct pvfs_filename *name)
{
struct dirent *de;
DIR *dir = opendir(name->full_name);
if (dir == NULL) {
return True;
}
while ((de = readdir(dir))) {
if (!ISDOT(de->d_name) && !ISDOTDOT(de->d_name)) {
closedir(dir);
return False;
}
}
closedir(dir);
return True;
}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:21,代码来源:pvfs_dirlist.c
示例13: torture_deltree
/*
callback function for torture_deltree()
*/
static void delete_fn(struct clilist_file_info *finfo, const char *name, void *state)
{
struct delete_state *dstate = (struct delete_state *)state;
char *s, *n;
if (ISDOT(finfo->name) || ISDOTDOT(finfo->name)) {
return;
}
n = strdup(name);
n[strlen(n)-1] = 0;
asprintf(&s, "%s%s", n, finfo->name);
if (finfo->attrib & FILE_ATTRIBUTE_READONLY) {
if (NT_STATUS_IS_ERR(smbcli_setatr(dstate->tree, s, 0, 0))) {
DEBUG(2,("Failed to remove READONLY on %s - %s\n",
s, smbcli_errstr(dstate->tree)));
}
}
if (finfo->attrib & FILE_ATTRIBUTE_DIRECTORY) {
char *s2;
asprintf(&s2, "%s\\*", s);
smbcli_unlink(dstate->tree, s2);
smbcli_list(dstate->tree, s2,
FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM,
delete_fn, state);
free(s2);
if (NT_STATUS_IS_ERR(smbcli_rmdir(dstate->tree, s))) {
DEBUG(2,("Failed to delete %s - %s\n",
s, smbcli_errstr(dstate->tree)));
dstate->failed = true;
}
dstate->total_deleted++;
} else {
if (NT_STATUS_IS_ERR(smbcli_unlink(dstate->tree, s))) {
DEBUG(2,("Failed to delete %s - %s\n",
s, smbcli_errstr(dstate->tree)));
dstate->failed = true;
}
dstate->total_deleted++;
}
free(s);
free(n);
}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:47,代码来源:clideltree.c
示例14: gen_name
static void gen_name(char *name)
{
const char *chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-$~...";
uint_t max_idx = strlen(chars);
uint_t len;
int i;
char *p;
fstrcpy(name, "\\mangle_test\\");
p = name + strlen(name);
len = 1 + random() % NAME_LENGTH;
for (i=0;i<len;i++) {
p[i] = chars[random() % max_idx];
}
p[i] = 0;
if (ISDOT(p) || ISDOTDOT(p)) {
p[0] = '_';
}
/* have a high probability of a common lead char */
if (random() % 2 == 0) {
p[0] = 'A';
}
/* and a medium probability of a common lead string */
if (random() % 10 == 0) {
strncpy(p, "ABCDE", 5);
}
/* and a high probability of a good extension length */
if (random() % 2 == 0) {
char *s = strrchr(p, '.');
if (s) {
s[4] = 0;
}
}
}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:41,代码来源:mangle_test.c
示例15: checkdot
checkdot(char **argv)
#endif
{
char *p, **save, **t;
int complained;
complained = 0;
for (t = argv; *t;) {
if ((p = strrchr(*t, '/')) != NULL)
++p;
else
p = *t;
if (ISDOT(p)) {
if (!complained++)
warnx("\".\" and \"..\" may not be removed");
eval = 1;
for (save = t; (t[0] = t[1]) != NULL; ++t);
t = save;
} else
++t;
}
}
开发者ID:GnoConsortium,项目名称:gno,代码行数:22,代码来源:rm.c
示例16: checkdot
void
checkdot(char **argv)
{
char *p, **save, **t;
int complained;
struct stat sb, root;
stat("/", &root);
complained = 0;
for (t = argv; *t;) {
if (lstat(*t, &sb) == 0 &&
root.st_ino == sb.st_ino && root.st_dev == sb.st_dev) {
if (!complained++)
warnx("\"/\" may not be removed");
goto skip;
}
/* strip trailing slashes */
p = strrchr(*t, '\0');
while (--p > *t && *p == '/')
*p = '\0';
/* extract basename */
if ((p = strrchr(*t, '/')) != NULL)
++p;
else
p = *t;
if (ISDOT(p)) {
if (!complained++)
warnx("\".\" and \"..\" may not be removed");
skip:
eval = 1;
for (save = t; (t[0] = t[1]) != NULL; ++t)
continue;
t = save;
} else
++t;
}
}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:39,代码来源:rm.c
示例17: checkdot
static void
checkdot(char **argv)
{
char *p, **save, **t;
int complained;
complained = 0;
for (t = argv; *t;) {
#ifdef HAVE_DOS_PATHS
const char *tmp = p = *t;
while (*tmp) {
switch (*tmp) {
case '/':
case '\\':
case ':':
p = (char *)tmp + 1;
break;
}
tmp++;
}
#else
if ((p = strrchr(*t, '/')) != NULL)
++p;
else
p = *t;
#endif
if (ISDOT(p)) {
if (!complained++)
fprintf(stderr, "%s: \".\" and \"..\" may not be removed\n", argv0);
eval = 1;
for (save = t; (t[0] = t[1]) != NULL; ++t)
continue;
t = save;
} else
++t;
}
}
开发者ID:dezelin,项目名称:kBuild,代码行数:37,代码来源:rm.c
示例18: recursive_delete
/*
recursively delete a directory tree
*/
static void recursive_delete(const char *path)
{
DIR *dir;
struct dirent *de;
dir = opendir(path);
if (!dir) {
return;
}
for (de=readdir(dir);de;de=readdir(dir)) {
char *fname;
struct stat st;
if (ISDOT(de->d_name) || ISDOTDOT(de->d_name)) {
continue;
}
fname = talloc_asprintf(path, "%s/%s", path, de->d_name);
if (stat(fname, &st) != 0) {
continue;
}
if (S_ISDIR(st.st_mode)) {
recursive_delete(fname);
talloc_free(fname);
continue;
}
if (unlink(fname) != 0) {
DEBUG(0,("Unabled to delete '%s' - %s\n",
fname, strerror(errno)));
smb_panic("unable to cleanup tmp files");
}
talloc_free(fname);
}
closedir(dir);
}
开发者ID:rti7743,项目名称:samba,代码行数:39,代码来源:server.c
示例19: talloc_array
/**
* Obtain list of init functions from the modules in the specified
* directory
*/
static init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
{
DIR *dir;
struct dirent *entry;
char *filename;
int success = 0;
init_module_fn *ret = talloc_array(mem_ctx, init_module_fn, 2);
ret[0] = NULL;
dir = opendir(path);
if (dir == NULL) {
talloc_free(ret);
return NULL;
}
while((entry = readdir(dir))) {
if (ISDOT(entry->d_name) || ISDOTDOT(entry->d_name))
continue;
filename = talloc_asprintf(mem_ctx, "%s/%s", path, entry->d_name);
ret[success] = load_module(filename, true, NULL);
if (ret[success]) {
ret = talloc_realloc(mem_ctx, ret, init_module_fn, success+2);
success++;
ret[success] = NULL;
}
talloc_free(filename);
}
closedir(dir);
return ret;
}
开发者ID:sprymak,项目名称:samba,代码行数:40,代码来源:modules.c
示例20: recursive_rmdir
bool recursive_rmdir(TALLOC_CTX *ctx,
connection_struct *conn,
struct smb_filename *smb_dname)
{
const char *dname = NULL;
char *talloced = NULL;
bool ret = True;
long offset = 0;
SMB_STRUCT_STAT st;
struct smb_Dir *dir_hnd;
SMB_ASSERT(!is_ntfs_stream_smb_fname(smb_dname));
dir_hnd = OpenDir(talloc_tos(), conn, smb_dname->base_name, NULL, 0);
if(dir_hnd == NULL)
return False;
while((dname = ReadDirName(dir_hnd, &offset, &st, &talloced))) {
struct smb_filename *smb_dname_full = NULL;
char *fullname = NULL;
bool do_break = true;
if (ISDOT(dname) || ISDOTDOT(dname)) {
TALLOC_FREE(talloced);
continue;
}
if (!is_visible_file(conn, smb_dname->base_name, dname, &st,
false)) {
TALLOC_FREE(talloced);
continue;
}
/* Construct the full name. */
fullname = talloc_asprintf(ctx,
"%s/%s",
smb_dname->base_name,
dname);
if (!fullname) {
errno = ENOMEM;
goto err_break;
}
smb_dname_full = synthetic_smb_fname(talloc_tos(), fullname,
NULL, NULL);
if (smb_dname_full == NULL) {
errno = ENOMEM;
goto err_break;
}
if(SMB_VFS_LSTAT(conn, smb_dname_full) != 0) {
goto err_break;
}
if(smb_dname_full->st.st_ex_mode & S_IFDIR) {
if(!recursive_rmdir(ctx, conn, smb_dname_full)) {
goto err_break;
}
if(SMB_VFS_RMDIR(conn,
smb_dname_full->base_name) != 0) {
goto err_break;
}
} else if(SMB_VFS_UNLINK(conn, smb_dname_full) != 0) {
goto err_break;
}
/* Successful iteration. */
do_break = false;
err_break:
TALLOC_FREE(smb_dname_full);
TALLOC_FREE(fullname);
TALLOC_FREE(talloced);
if (do_break) {
ret = false;
break;
}
}
TALLOC_FREE(dir_hnd);
return ret;
}
开发者ID:vormetriclabs,项目名称:samba,代码行数:81,代码来源:close.c
注:本文中的ISDOT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论