/* * This file is part of NetSurf, http://netsurf.sourceforge.net/ * Licensed under the GNU General Public License, * http://www.opensource.org/licenses/gpl-license * Copyright 2004 John M Bell */ #include #include /* for __riscosify */ #include /* possibly just have accessor methods in utils.c */ #include "oslib/osfile.h" #include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/css/css.h" #include "netsurf/render/form.h" #include "netsurf/render/layout.h" #include "netsurf/riscos/save_complete.h" #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" /** \todo Save out CSS. */ #ifdef WITH_SAVE_COMPLETE char* get_filename(char * url); /* this is temporary. */ const char * const SAVE_PATH = ".savetest."; const char * const OBJ_DIR = "_files"; /** \todo this will probably want to take a filename */ void save_complete(struct content *c) { struct box *box; char *fname = 0, *spath, *ofname; unsigned int i; if (c->type != CONTENT_HTML) { return; } fname = get_filename(c->data.html.base_url); if (!fname) { /* no path -> exit */ return; } spath = xcalloc(strlen(SAVE_PATH)+strlen(OBJ_DIR)+strlen(fname)+50, sizeof(char)); sprintf(spath, "%s%s%s", SAVE_PATH, fname, OBJ_DIR); xosfile_create_dir(spath, 77); /* save stylesheets, ignoring the base sheet and