uri.c File Reference

Utilities for uri handling and launching. More...

#include "rox-clib.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include "rox.h"
#include "uri.h"
#include "choices.h"
#include "basedir.h"
#include "rox_debug.h"

Functions

gchar * rox_escape_uri_path (const char *path)
const gchar * rox_hostname (void)
gchar * rox_encode_path_as_uri (const guchar *path)
gchar * rox_unescape_uri (const char *uri)
int rox_uri_launch (const char *uri)
gchar * rox_uri_get_handler (const char *scheme)
int rox_uri_launch_handler (const char *uri, gboolean block, GError **err)


Detailed Description

Utilities for uri handling and launching.

Author:
Stephen Watson
Version:
Id
uri.c,v 1.5 2007/01/29 12:41:10 stephen Exp

Function Documentation

gchar* rox_encode_path_as_uri ( const guchar *  path  ) 

Convert a local path into a file: URI with problematic characters replaced with %xx escapes.

Parameters:
[in] path to encode
Returns:
the converted URI, pass to g_free() when done.

gchar* rox_escape_uri_path ( const char *  path  ) 

Escape path for future use in URI by replacing problematic characters with a %xx escape sequence.

Parameters:
[in] path path to be escaped
Returns:
escaped path, pass to g_free() when done.

const gchar* rox_hostname ( void   ) 

Return the canonical hostname for use in drag and drop.

Returns:
host name

gchar* rox_unescape_uri ( const char *  uri  ) 

Convert a URI with %xx escapes into one without

Parameters:
[in] uri URI to be converted.
Returns:
converted URI, pass to g_free() when done.

gchar* rox_uri_get_handler ( const char *  scheme  ) 

Return the handler for URI's of the named scheme (e.g. http, file, ftp, etc.) The handler for file is always rox, otherwise it obtained from the configuration directory rox.sourceforge.net/URI.

Parameters:
[in] scheme URI scheme to get handler for (do not include trailing ':' character)
Returns:
Command to execute. The returned string may contain %s in which case it should be replaced with the URI, otherwise append the URI (after a space). Pass the string to g_free() when done. NULL is returned if no handler is defined.

int rox_uri_launch ( const char *  uri  ) 

Launch a URI. If there is a handler for the MIME type text/x-uri then that is executed with '-' as a single argument and the URI pass in on standard input. If there is no such handler then each of the following commands is tried in turn:

Parameters:
[in] uri URI to launch
Returns:
exit status of the last attempted command (0 for success).
Deprecated:
use rox_uri_launch_handler() instead.

int rox_uri_launch_handler ( const char *  uri,
gboolean  block,
GError **  err 
)

For a given URI pass it to the appropriate launcher. rox_uri_get_handler() is used to look up the launcher command which is executed.

Parameters:
[in] uri the URI to launch
[in] block if FALSE then do not wait for command to complete, otherwise block until so.
[in,out] err location to store error message when launching fails, or NULL to discard it
Returns:
When block is true the process id of the command otherwise the exit status of the command, -1 if no launcher is defined or -2 if an error occured (check err).


Generated on Sat Oct 13 17:22:46 2007 for ROX-CLib by  doxygen 1.5.0