示例#1
0
static char *
path_suffix(char *path)
{
    char *leaf = pathleaf(path);
    char *type = strchr(leaf, '.');
    if (type == 0)
	type = skip_string(leaf);
    return type;
}
示例#2
0
/*
 * Test for directories that we don't try to scan
 */
static int
ignore_dir(char *path)
{
    if (!a_opt && *pathleaf(path) == '.'
	&& sameleaf(path, sccs_dir((char *) 0, path))) {
	if (!quiet)
	    PRINTF("...skip %s\n", path);
	return TRUE;
    }
    return FALSE;
}
示例#3
0
/******************************************************************************
 * Returns a pointer to a pathname's leaf iff it is the root directory        *
 ******************************************************************************/
char *
is_vms_rootdir(char *path)
{
    char *type;
    if ((type = is_vms_dirtype(path)) != 0) {
	char *leaf = pathleaf(path);
	size_t len = (type - leaf);
	if (len == sizeof(RootDir) - 1
	    && !strncmp(leaf, RootDir, len))
	    return leaf;
    }
    return 0;
}
示例#4
0
文件: npopen.c 项目: ricksladkey/vile
static void
exec_sh_c(char *cmd)
{
    static char bin_sh[] = "/bin/sh";
    char *sh, *shname;
    int i;

#ifndef NOFILE
# define NOFILE 20
#endif
    /* Make sure there are no upper inherited file descriptors */
    for (i = 3; i < NOFILE; i++)
        (void) close(i);

    sh = user_SHELL();
    if (isEmpty(sh)) {
        sh = bin_sh;
        shname = pathleaf(sh);
    } else {
        shname = last_slash(sh);
        if (shname == NULL) {
            shname = sh;
        } else {
            shname++;
            if (*shname == EOS)
                shname = sh;
        }
    }

    if (cmd) {
#if SYS_OS2_EMX
        /*
         * OS/2 EMX accepts forward and backward slashes
         * interchangeably except in one special case -
         * invoking the OS/2 cmd.exe program for syntax
         * filters.  That accepts only backslashes if we put a
         * ".exe" suffix on the pathname.
         */
        for (i = 0; ispath(cmd[i]); i++)
            if (cmd[i] == '/')
                cmd[i] = '\\';
#endif
        (void) execlp(sh, shname, SHELL_C, cmd, (void *) 0);
    } else {
        (void) execlp(sh, shname, (void *) 0);
    }
    IGNORE_RC(write(2, "exec failed\r\n", (size_t) 14));
    exit(-1);
}