NetSurf
|
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/utility.h>
#include <proto/intuition.h>
#include "utils/utils.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/file.h"
#include "utils/messages.h"
#include "utils/nsurl.h"
#include "utils/url.h"
#include "netsurf/window.h"
#include "amiga/gui.h"
#include "amiga/misc.h"
#include "amiga/utf8.h"
Go to the source code of this file.
Functions | |
static LONG | ami_misc_req (const char *message, uint32 type) |
void | ami_misc_fatal_error (const char *message) |
nserror | amiga_warn_user (const char *warning, const char *detail) |
Warn the user of an event. More... | |
int32 | amiga_warn_user_multi (const char *body, const char *opt1, const char *opt2, struct Window *win) |
static nserror | amiga_nsurl_to_path (struct nsurl *url, char **path_out) |
Create a path from a nsurl using amiga file handling. More... | |
static nserror | amiga_path_to_nsurl (const char *path, struct nsurl **url_out) |
Create a nsurl from a path using amiga file handling. More... | |
char * | translate_escape_chars (const char *s) |
returns a string with escape chars translated and string converted to local charset (based on remove_underscores from utils.c) More... | |
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. More... | |
static nserror | amiga_basename (const char *path, char **str, size_t *size) |
Get the basename of a file using posix path handling. More... | |
static nserror | amiga_mkdir_all (const char *fname) |
Ensure that all directory elements needed to store a filename exist. More... | |
Variables | |
static struct gui_file_table | file_table |
struct gui_file_table * | amiga_file_table = &file_table |
void ami_misc_fatal_error | ( | const char * | message | ) |
Definition at line 73 of file misc.c.
References ami_misc_req(), and TDRIMAGE_ERROR.
Referenced by ami_gui_get_user_dir(), ami_gui_resources_open(), and main().
|
static |
Definition at line 45 of file misc.c.
References ami_gui_get_active_gw(), ami_gui_get_window(), cur_gw, messages_get(), NSLOG, and type.
Referenced by ami_misc_fatal_error(), and amiga_warn_user().
|
static |
Get the basename of a file using posix path handling.
This gets the last element of a path and returns it.
[in] | path | The path to extract the name from. |
[in,out] | str | Pointer to string pointer if this is NULL enough storage will be allocated for the path element. |
[in,out] | size | The size of the space available if str not NULL on input and set to the total output length on output. |
Definition at line 365 of file misc.c.
References NSERROR_BAD_PARAMETER, NSERROR_NOMEM, NSERROR_OK, and path().
|
static |
Ensure that all directory elements needed to store a filename exist.
fname | The filename to ensure the path to exists. |
Definition at line 397 of file misc.c.
References NSERROR_NOT_DIRECTORY, NSERROR_NOT_FOUND, NSERROR_OK, and nsmkdir.
Create a path from a nsurl using amiga file handling.
[in] | url | The url to encode. |
[out] | path_out | A string containing the result path which should be freed by the caller. |
Definition at line 138 of file misc.c.
References NSERROR_BAD_PARAMETER, NSERROR_NOMEM, NSERROR_OK, nsurl_get_component(), NSURL_PATH, NSURL_SCHEME, path(), and url_unescape().
Create a nsurl from a path using amiga file handling.
Perform the necessary operations on a path to generate a nsurl.
[in] | path | The path to convert. |
[out] | url_out | pointer to recive the nsurl, The returned url must be unreferenced by the caller. |
Definition at line 210 of file misc.c.
References DevNameFromLock, DN_FULLPATH, NSERROR_NOMEM, nsurl_create(), path(), and SLEN.
|
static |
Generate a posix path from one or more component elemnts.
If a string is allocated it must be freed by the caller.
[in,out] | str | pointer to string pointer if this is NULL enough storage will be allocated for the complete path. |
[in,out] | size | The size of the space available if str not NULL on input and if not NULL set to the total output length on output. |
[in] | nelm | The number of elements. |
[in] | ap | The elements of the path as string pointers. |
Definition at line 286 of file misc.c.
References NSERROR_BAD_PARAMETER, NSERROR_NOMEM, NSERROR_NOSPACE, and NSERROR_OK.
nserror amiga_warn_user | ( | const char * | warning, |
const char * | detail | ||
) |
Warn the user of an event.
[in] | warning | A warning looked up in the message translation table |
[in] | detail | Additional text to be displayed or NULL. |
Definition at line 79 of file misc.c.
References ami_misc_req(), ami_utf8_easy(), ASPrintf(), messages_get(), NSERROR_OK, and TDRIMAGE_WARNING.
Referenced by ami_bitmap_get_generic(), ami_cw_mouse_pos(), ami_cw_redraw(), ami_cw_redraw_rect(), ami_cw_window_size(), ami_do_redraw(), ami_do_redraw_limits(), ami_file_open(), ami_font_open(), ami_gui_event(), ami_gui_new_blank_tab(), ami_gui_scroll_internal(), ami_handle_applib(), ami_handle_appmsg(), ami_mouse_to_ns_coords(), ami_ns_rect_to_ibox(), ami_plot_ra_alloc(), ami_print(), ami_refresh_window(), ami_switch_tab(), ami_text_box_at_point(), ami_theme_init(), ami_throbber_update(), gui_download_window_done(), gui_download_window_error(), gui_init2(), gui_window_create(), gui_window_get_dimensions(), gui_window_place_caret(), gui_window_set_icon(), gui_window_set_scroll(), gui_window_stop_throbber(), gui_window_update_extent(), HOOKF(), and RXHOOKF().
int32 amiga_warn_user_multi | ( | const char * | body, |
const char * | opt1, | ||
const char * | opt2, | ||
struct Window * | win | ||
) |
Definition at line 93 of file misc.c.
References ami_utf8_easy(), ASPrintf(), messages_get(), and TDRIMAGE_WARNING.
Referenced by ami_download_check_overwrite(), and ami_gui_close_tabs().
char * translate_escape_chars | ( | const char * | s | ) |
returns a string with escape chars translated and string converted to local charset (based on remove_underscores from utils.c)
Definition at line 246 of file misc.c.
References ami_utf8_easy().
Referenced by gui_window_create().
struct gui_file_table* amiga_file_table = &file_table |
|
static |