本文整理汇总了C++中ISDOT函数的典型用法代码示例。如果您正苦于以下问题:C++ ISDOT函数的具体用法?C++ ISDOT怎么用?C++ ISDOT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ISDOT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
}
示例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;
}
}