24#include <proto/exec.h>
25#include <proto/utility.h>
28#include <proto/intuition.h>
50 NSLOG(netsurf, INFO,
"%s", message);
52 ret = TimedDosRequesterTags(
54 TDR_FormatString, message,
60 struct EasyStruct easyreq = {
61 sizeof(
struct EasyStruct),
82 STRPTR bodytext =
ASPrintf(
"\33b%s\33n\n%s",
83 utf8warning != NULL ? utf8warning : warning, detail);
87 if(bodytext) FreeVec(bodytext);
88 if(utf8warning) free(utf8warning);
100 char *utf8gadgets =
ASPrintf(
"%s|%s", utf8gadget1, utf8gadget2);
107 TDR_FormatString, utf8text,
108 TDR_GadgetString, utf8gadgets,
112 struct EasyStruct easyreq = {
113 sizeof(
struct EasyStruct),
120 res = EasyRequest(win, &easyreq, NULL);
123 if(utf8text) free(utf8text);
124 if(utf8gadgets) FreeVec(utf8gadgets);
149 if ((url == NULL) || (path_out == NULL)) {
155 if (lwc_string_caseless_isequal(scheme, corestring_lwc_file,
156 &match) != lwc_error_ok)
160 lwc_string_unref(scheme);
161 if (match ==
false) {
166 if (urlpath == NULL) {
171 lwc_string_unref(urlpath);
176 colon = strchr(
path,
':');
178 slash = strchr(
path,
'/');
182 char *tmp_path = malloc(path_len + 2);
185 strncpy(tmp_path,
path, path_len);
189 path[path_len] =
':';
190 path[path_len + 1] =
'\0';
214 char newpath[1024 + strlen(
path)];
218 if((lock = Lock(
path, SHARED_LOCK))) {
222 else strlcpy(newpath,
path,
sizeof newpath);
224 r = malloc(strlen(newpath) +
SLEN(
"file:///") + 1);
229 if((colon = strchr(newpath,
':'))) *colon =
'/';
231 strcpy(r,
"file:///");
252 ret = malloc(len + 1);
255 for (i = 0, ii = 0; i < len; i++) {
259 else if (s[i+1] ==
'n') {
292 size_t fname_len = 0;
295 if ((nelm == 0) || (nelm > 16)) {
298 if ((*str != NULL) && (size == NULL)) {
308 for (elm_idx = 0; elm_idx < nelm; elm_idx++) {
309 elm[elm_idx] = va_arg(ap,
const char *);
311 if (elm[elm_idx] == NULL) {
314 elm_len[elm_idx] = strlen(elm[elm_idx]);
315 fname_len += elm_len[elm_idx];
322 if (fname_len > *size) {
326 fname = malloc(fname_len);
333 memmove(fname, elm[0], elm_len[0]);
334 fname[elm_len[0]] = 0;
337 for (elm_idx = 1; elm_idx < nelm; elm_idx++) {
338 if (!AddPart(fname, elm[elm_idx], fname_len)) {
367 const char *leafname;
374 leafname = FilePart(
path);
375 if (leafname == NULL) {
379 fname = strdup(leafname);
386 *size = strlen(fname);
403 dname = strdup(fname);
405 sep = strrchr(dname,
'/');
414 if (stat(dname, &sb) == 0) {
416 if (S_ISDIR(sb.st_mode)) {
425 while (*sep ==
'/') {
428 while ((sep = strchr(sep,
'/')) != NULL) {
430 if (stat(dname, &sb) != 0) {
431 if (
nsmkdir(dname, S_IRWXU) != 0) {
437 if (! S_ISDIR(sb.st_mode)) {
445 while (*sep ==
'/') {
struct Window * ami_gui_get_window(struct gui_window *gw)
Get window from gui_window.
struct gui_window * ami_gui_get_active_gw(void)
Get a pointer to the gui_window which NetSurf considers to be the current/active one.
static struct gui_window * cur_gw
void ami_misc_fatal_error(const char *message)
static LONG ami_misc_req(const char *message, uint32 type)
static nserror amiga_mkdir_all(const char *fname)
Ensure that all directory elements needed to store a filename exist.
int32 amiga_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win)
static nserror amiga_vmkpath(char **str, size_t *size, size_t nelm, va_list ap)
Generate a posix path from one or more component elemnts.
nserror amiga_warn_user(const char *warning, const char *detail)
Warn the user of an event.
static nserror amiga_path_to_nsurl(const char *path, struct nsurl **url_out)
Create a nsurl from a path using amiga file handling.
static nserror amiga_nsurl_to_path(struct nsurl *url, char **path_out)
Create a path from a nsurl using amiga file handling.
static nserror amiga_basename(const char *path, char **str, size_t *size)
Get the basename of a file using posix path handling.
char * translate_escape_chars(const char *s)
returns a string with escape chars translated and string converted to local charset (based on remove_...
static struct gui_file_table file_table
struct gui_file_table * amiga_file_table
Useful interned string pointers (interface).
nserror
Enumeration of error codes.
@ NSERROR_NOSPACE
Insufficient space.
@ NSERROR_NOT_FOUND
Requested item not found.
@ NSERROR_BAD_PARAMETER
Bad Parameter.
@ NSERROR_NOT_DIRECTORY
Missing directory.
@ NSERROR_NOMEM
Memory exhaustion.
char * ami_utf8_easy(const char *string)
Interface to platform-specific graphical user interface window operations.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
NetSurf URL handling (interface).
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
lwc_string * nsurl_get_component(const nsurl *url, nsurl_component part)
Get part of a URL as a lwc_string, from a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
char * ASPrintf(const char *fmt,...)
#define DevNameFromLock(A, B, C, D)
Interface to utility string handling.
/brief function table for file and filename operations.
nserror(* mkpath)(char **str, size_t *size, size_t nemb, va_list ap)
Generate a path from one or more component elemnts.
first entry in window list
nserror url_unescape(const char *str, size_t length, size_t *length_out, char **result_out)
Convert an escaped string to plain.
Interface to URL parsing and joining operations.
Default operations table for files.
Interface to a number of general purpose functionality.
#define nsmkdir(dir, mode)
POSIX mkdir function.
#define SLEN(x)
Calculate length of constant C string.
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.