navit  0.5.3-trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
util.h File Reference
#include <ctype.h>
#include "config.h"

Go to the source code of this file.

Functions

void strtoupper (char *dest, const char *src)
 
void strtolower (char *dest, const char *src)
 
unsigned int uint_sqrt (unsigned int n)
 Fast compute of square root for unsigned ints. More...
 
int navit_utf8_strcasecmp (const char *s1, const char *s2)
 
GListg_hash_to_list (GHashTable *h)
 
GListg_hash_to_list_keys (GHashTable *h)
 
gchar * g_strconcat_printf (gchar *buffer, gchar *fmt,...)
 
unsigned int iso8601_to_secs (char *iso8601)
 Converts an ISO 8601-style time string into epoch time. More...
 
char * current_to_iso8601 (void)
 Outputs local system time in ISO 8601 format. More...
 
char * shell_escape (char *arg)
 
struct spawn_process_infospawn_process (char **argv)
 
int spawn_process_check_status (struct spawn_process_info *pi, int block)
 
void spawn_process_info_free (struct spawn_process_info *pi)
 
void spawn_process_init (void)
 
void get_compass_direction (char *buffer, int angle, int mode)
 Get printable compass direction from an angle. More...
 

Function Documentation

char* current_to_iso8601 ( void  )

Outputs local system time in ISO 8601 format.

Returns
Time in ISO 8601 format

Referenced by main(), vehicle_demo_position_attr_get(), and vehicle_log_gpx().

GList* g_hash_to_list ( GHashTable *  h)

References hash_callback().

Referenced by graphics_free().

GList* g_hash_to_list_keys ( GHashTable *  h)

References hash_callback_key().

void get_compass_direction ( char *  buffer,
int  angle,
int  mode 
)

Get printable compass direction from an angle.

This function supports three different modes:

In mode 0, the angle in degrees is output as a string.

In mode 1, the angle is output as a cardinal direction (N, SE etc.).

In mode 2, the angle is output in analog clock notation (6 o'clock).

Parameters
bufferBuffer to hold the result string (up to 5 characters, including the terminating null character, may be required)
angleThe angle to convert
modeThe conversion mode, see description

Referenced by gui_internal_cmd_pois_item(), and model_poi().

unsigned int iso8601_to_secs ( char *  iso8601)

Converts an ISO 8601-style time string into epoch time.

Parameters
iso8601Time in ISO 8601 format.
Returns
The number of seconds elapsed since January 1, 1970, 00:00:00 UTC.

References startup::pos.

Referenced by navit_layout_switch(), osd_text_format_attr(), and tracking_update().

int navit_utf8_strcasecmp ( const char *  s1,
const char *  s2 
)

References dbg, and lvl_debug.

Referenced by contains_suffix(), and search_list_get_result().

char* shell_escape ( char *  arg)

Escape and quote string for shell

Parameters
inarg string to escape
Returns
escaped string

Referenced by spawn_process_compose_cmdline().

struct spawn_process_info* spawn_process ( char **  argv)

Call external program

Parameters
inargv NULL terminated list of parameters, zeroeth argument is program name
Returns
0 - success, >0 - return code, -1 - error

References dbg, exit, lvl_debug, lvl_error, spawn_process_info::pid, spawn_process_compose_cmdline(), and spawn_process_info::status.

Referenced by navit_cmd_spawn(), and speechd_say().

int spawn_process_check_status ( struct spawn_process_info pi,
int  block 
)

Check external program status

Parameters
in*pi pointer to spawn_process_info structure
inblock =0 do not block =1 block until child terminated
Returns
-1 - still running, >=0 program exited, =255 trminated abnormally or wasn't run at all.

References dbg, lvl_debug, lvl_error, spawn_process_info::pid, and spawn_process_info::status.

Referenced by speechd_say().

void spawn_process_info_free ( struct spawn_process_info pi)
void spawn_process_init ( void  )

Referenced by main_init().

void strtolower ( char *  dest,
const char *  src 
)
void strtoupper ( char *  dest,
const char *  src 
)

Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

unsigned int uint_sqrt ( unsigned int  n)

Fast compute of square root for unsigned ints.

Parameters
nThe input number
Returns
sqrt(n)

References p.

Referenced by draw_shape(), and square_shape_str().