示例#1
0
文件: util.c 项目: kjk/qemacs
void canonize_path(char *buf, int buf_size, const char *path)
{
    const char *p;
    /* check for URL protocol or windows drive */
    /* CG: should not skip DIR_SEP_CHAR */
    p = strchr(path, ':');
    if (p) {
        if ((p - path) == 1) {
#if 0
            /* windows drive : we canonize only the following path */
            buf[0] = p[-1];
            buf[1] = p[1];
            /* CG: this will not work for non current drives */
            canonize_path1(buf + 2, buf_size - 2, p);
#endif
            canonize_path1(buf, buf_size, path);
        } else {
            /* URL: it is already canonized */
            pstrcpy(buf, buf_size, path);
        }
    } else {
        /* simple unix path */
        canonize_path1(buf, buf_size, path);
    }
}
示例#2
0
文件: util.c 项目: shanecelis/qemacs
void canonize_path(char *buf, int buf_size, const char *path)
{
    const char *p;
    /* check for URL protocol or windows drive */
    p = strchr(path, ':');
    if (p) {
        if ((p - path) == 1) {
            /* windows drive : we canonize only the following path */
            buf[0] = p[0];
            buf[1] = p[1];
            canonize_path1(buf + 2, buf_size - 2, p);
        } else {
            /* URL: it is already canonized */
            pstrcpy(buf, buf_size, path);
        }
    } else {
        /* simple unix path */
        canonize_path1(buf, buf_size, path);
    }
}