Ejemplo n.º 1
0
 //! Parse a document (by URL).
 //-----------------------------------------------------------------------
 static bool
 parse_string(const parser_type &p, const wchar_type *cur, 
              const url_type &url = url_type(), 
              const options_type &opt = options_type())
 {
   p->myDoc = xmlCtxtReadDoc(p, cur, url, "UTF-8", opt);
   return (p->myDoc != 0);
 }
Ejemplo n.º 2
0
/*
 * Store standard filename prefix
 */
static void get_prefix(void)
{
    int len;
    char *p;
    char c;

    if (!(DHCPMagic & 0x04)) {
	/* No path prefix option, derive from boot file */

	strlcpy(path_prefix, boot_file, sizeof path_prefix);
	len = strlen(path_prefix);
	p = &path_prefix[len - 1];
	
	while (len--) {
	    c = *p--;
	    c |= 0x20;
	    
	    c = (c >= '0' && c <= '9') ||
		(c >= 'a' && c <= 'z') ||
		(c == '.' || c == '-');
	    if (!c)
		break;
	};
	
	if (len < 0)
	    p --;
	
	*(p + 2) = 0;                /* Zero-terminate after delimiter */
    }

    ddprintf("TFTP prefix: %s\n", path_prefix);

    if (url_type(path_prefix) == URL_SUFFIX) {
	/*
	 * Construct a ::-style TFTP path.
	 *
	 * We may have moved out of the root directory at the time
	 * this function is invoked, but to maintain compatibility
	 * with versions of Syslinux < 5.00, path_prefix must be
	 * relative to "::".
	 */
	p = strdup(path_prefix);
	if (!p)
	    return;

	snprintf(path_prefix, sizeof path_prefix, "::%s", p);
	free(p);
    }

    chdir(path_prefix);
}
Ejemplo n.º 3
0
/*
 * chdir for PXE
 */
static int pxe_chdir(struct fs_info *fs, const char *src)
{
    /* The cwd for PXE is just a text prefix */
    enum url_type path_type = url_type(src);

    if (path_type == URL_SUFFIX)
	strlcat(fs->cwd_name, src, sizeof fs->cwd_name);
    else
	strlcpy(fs->cwd_name, src, sizeof fs->cwd_name);
    return 0;

    dprintf("cwd = \"%s\"\n", fs->cwd_name);
    return 0;
}
Ejemplo n.º 4
0
/*
 * realpath for PXE
 */
static size_t pxe_realpath(struct fs_info *fs, char *dst, const char *src,
			   size_t bufsize)
{
    return snprintf(dst, bufsize, "%s%s",
		    url_type(src) == URL_SUFFIX ? fs->cwd_name : "", src);
}