コード例 #1
0
ファイル: browse.c プロジェクト: OS2World/APP-SERVER-opennap
static char *
my_basename (char *d, int dsize, /* const */ char *s)
{
    s = last_slash (s);
    strncpy (d, s + 1, dsize - 1);
    d[dsize - 1] = 0;
    return d;
}
コード例 #2
0
ファイル: browse.c プロジェクト: OS2World/APP-SERVER-opennap
static char *
dirname (char *d, int dsize, /* const */ char *s)
{
    char   *p;

    strncpy (d, s, dsize - 1);
    d[dsize - 1] = 0;
    p = last_slash (d);
    *p = 0;
    return d;
}
コード例 #3
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);
}
コード例 #4
0
ファイル: debug_linux.c プロジェクト: Fechinator/FechdaKernel
void
debug_outputf(const char *level,
	      const char *flow,
	      const char *module,
	      const char *file,
	      int line, const char *func, const char *format, ...)
{
	if (debug_filter(level, flow, module, file, func)) {
		va_list args;

		printk("%s %s %s:%d ", level, module, last_slash(file), line);
		va_start(args, format);
		vprintk(format, args);
		va_end(args);
		printk("\n");
	}
}