Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

utils.h File Reference

#include <stdlib.h>
#include <time.h>
#include <libetpan.h>
#include "uudeview.h"

Include dependency graph for utils.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct  XePUtilsCharsetMapping_s
struct  XePUtilsFormat_s
union  XePUtilsInlinedData_u
struct  XePUtilsInlinedDataAny_s
struct  XePUtilsInlinedFile_s
struct  XePUtilsInlinedText_s
struct  XePUtilsPair_s
struct  XePUtilsTriplet_s

Defines

#define XEP_UTILS_SIZE_BUF_MAX   6

Typedefs

typedef XePUtilsFormat_s XePUtilsFormat
typedef XePUtilsInlinedFile_s XePUtilsInlinedFile
typedef XePUtilsInlinedText_s XePUtilsInlinedText
typedef XePUtilsInlinedDataAny_s XePUtilsInlinedDataAny
typedef XePUtilsInlinedData_u XePUtilsInlinedData
typedef XePUtilsPair_s XePUtilsPair
typedef XePUtilsTriplet_s XePUtilsTriplet
typedef XePUtilsCharsetMapping_s XePUtilsCharsetMapping

Enumerations

enum  XePUtilsEncodingType { XEP_Q_ENCODING, XEP_B_ENCODING, XEP_AUTO_ENCODING }
enum  XePUtilsOpenPGPType { XEP_OPENPGP_NONE = 0, XEP_OPENPGP_SIGNED = 1 << 0, XEP_OPENPGP_ENCRYPTED = 1 << 1 }
enum  XePUtilsInlinedDataType {
  XEP_INLINED_DATA_NONE, XEP_INLINED_DATA_UUENCODED, XEP_INLINED_DATA_YENCODED, XEP_INLINED_DATA_YENCODED2,
  XEP_INLINED_DATA_BINHEX, XEP_INLINED_DATA_TEXT, XEP_INLINED_DATA_CLEARSIGNED_TEXT, XEP_INLINED_DATA_ASCII_ARMORED_TEXT
}
enum  XePUtilsCharset {
  XEP_CHARSET_0, XEP_CHARSET_BIG5, XEP_CHARSET_EUC_JP, XEP_CHARSET_EUC_KR,
  XEP_CHARSET_EUC_TW, XEP_CHARSET_GB2312, XEP_CHARSET_ISIRI_3342, XEP_CHARSET_ISO_2022_CN,
  XEP_CHARSET_ISO_2022_CN_EXT, XEP_CHARSET_ISO_2022_JP, XEP_CHARSET_ISO_2022_JP_2, XEP_CHARSET_ISO_2022_KR,
  XEP_CHARSET_ISO_8859_1, XEP_CHARSET_ISO_8859_10, XEP_CHARSET_ISO_8859_11, XEP_CHARSET_ISO_8859_13,
  XEP_CHARSET_ISO_8859_14, XEP_CHARSET_ISO_8859_15, XEP_CHARSET_ISO_8859_16, XEP_CHARSET_ISO_8859_2,
  XEP_CHARSET_ISO_8859_3, XEP_CHARSET_ISO_8859_4, XEP_CHARSET_ISO_8859_5, XEP_CHARSET_ISO_8859_6,
  XEP_CHARSET_ISO_8859_7, XEP_CHARSET_ISO_8859_8, XEP_CHARSET_ISO_8859_8_I, XEP_CHARSET_ISO_8859_9,
  XEP_CHARSET_KOI8_R, XEP_CHARSET_KOI8_U, XEP_CHARSET_MAC_CYRILLIC, XEP_CHARSET_SHIFT_JIS,
  XEP_CHARSET_TIS_620, XEP_CHARSET_UTF8, XEP_CHARSET_VISCII, XEP_CHARSET_WINDOWS_1250,
  XEP_CHARSET_WINDOWS_1251, XEP_CHARSET_WINDOWS_1254, XEP_CHARSET_WINDOWS_1255, XEP_CHARSET_WINDOWS_1256,
  XEP_CHARSET_WINDOWS_1258
}

Functions

char * a_Utils_printf (char *template, XePUtilsFormat *format)
char * a_Utils_append (char *dest,...)
void a_Utils_string_unfold (char *string)
char * a_Utils_magic_data_mime_type (const char *data, size_t size)
char * a_Utils_magic_file_mime_type (const char *filename)
char * a_Utils_magic_get_charset (const char *magic_mime_type)
void a_Utils_format_size (char *buffer, size_t size)
int a_Utils_write (int fd, const char *data, size_t size)
int a_Utils_read (int fd, char **data, size_t *size)
char * a_Utils_save_temp (const char *data, size_t size)
int a_Utils_load_file (const char *filename, char **data, size_t *size)
int a_Utils_file_backup (const char *filename)
XePUtilsInlinedDataa_Utils_inlined_text_new (XePUtilsInlinedDataType type, const char *data, size_t size, const char *plain_text, size_t plain_size, int privacy_sig_status, int privacy_enc_status, void *extra)
XePUtilsInlinedDataa_Utils_inlined_file_new (XePUtilsInlinedDataType type, const char *data, size_t size, const char *filename, void *extra)
void a_Utils_inlined_list_free (clist *inlined_list)
void a_Utils_inlined_data_free (XePUtilsInlinedData *inlined_data)
int a_Utils_inlined_file_decode_as (XePUtilsInlinedData *inlined_data, const char *save_as)
char * a_Utils_uulib_decode_file (const char *filename, void(*msg_cb)(void *adata, const char *msg, int msg_type), void(*busy_cb)(void *adata, uuprogress *aprogress), void *data)
XePUtilsInlinedDataa_Utils_data_has_uuencoded (const char *data, size_t size)
XePUtilsInlinedDataa_Utils_data_has_yencoded (const char *data, size_t size)
XePUtilsInlinedDataa_Utils_data_has_yencoded2 (const char *data, size_t size)
XePUtilsInlinedDataa_Utils_data_has_binhex (const char *data, size_t size)
int a_Utils_orig_date_to_localtime (struct mailimf_date_time *date_time, struct tm *local_tm)
void * a_Utils_memmem (const void *haystack, size_t haystack_len, const void *needle, size_t needle_len)
int a_Utils_quote_text_for_reply (const char *text, size_t text_size, const char *source_charset, char **quoted_text)
char * a_Utils_create_quoted_printable (const char *text, const char *text_charset)
clist * a_Utils_parse_mailto (const char *mailto)
int a_Utils_exec_cmd (char *cmd, int fd_in, int fd_out, int fd_err, int *fd_mon, pid_t *_pid, int sync)
char * a_Utils_basename (const char *path)
char * a_Utils_magic_get_bare_mime_type (const char *mime_type)
void a_Utils_to_b_encoding (const char *s, size_t *is, char *t, size_t *it)
void a_Utils_to_q_encoding (const char *s, size_t *is, char *t, size_t *it, int is_phrase, int is_comment)
char * a_Utils_encode_8bit_header (const char *text, const char *charset, XePUtilsEncodingType encoding, int is_phrase, int is_comment)
char * a_Utils_encode_8bit_subject (const char *subject, const char *charset, XePUtilsEncodingType encoding)
int a_Utils_has_8bit (const char *text, size_t size)
clist * a_Utils_parse_body_text (const char *text, size_t size)
const char * a_Utils_inlined_data_type_as_string (XePUtilsInlinedDataType type)
int a_Utils_text_new_copy_with_rfc2822_lines (const char *text, size_t size, char **rfc2822_text, size_t *rfc2822_size)

Variables

XePUtilsCharsetMapping xetpan_charsets []


Define Documentation

#define XEP_UTILS_SIZE_BUF_MAX   6
 


Typedef Documentation

typedef struct XePUtilsCharsetMapping_s XePUtilsCharsetMapping
 

A structure mapping a charset identifier to its string representation

typedef struct XePUtilsFormat_s XePUtilsFormat
 

typedef union XePUtilsInlinedData_u XePUtilsInlinedData
 

typedef struct XePUtilsInlinedDataAny_s XePUtilsInlinedDataAny
 

typedef struct XePUtilsInlinedFile_s XePUtilsInlinedFile
 

typedef struct XePUtilsInlinedText_s XePUtilsInlinedText
 

typedef struct XePUtilsPair_s XePUtilsPair
 

typedef struct XePUtilsTriplet_s XePUtilsTriplet
 


Enumeration Type Documentation

enum XePUtilsCharset
 

Enumeration values:
XEP_CHARSET_0 
XEP_CHARSET_BIG5 
XEP_CHARSET_EUC_JP 
XEP_CHARSET_EUC_KR 
XEP_CHARSET_EUC_TW 
XEP_CHARSET_GB2312 
XEP_CHARSET_ISIRI_3342 
XEP_CHARSET_ISO_2022_CN 
XEP_CHARSET_ISO_2022_CN_EXT 
XEP_CHARSET_ISO_2022_JP 
XEP_CHARSET_ISO_2022_JP_2 
XEP_CHARSET_ISO_2022_KR 
XEP_CHARSET_ISO_8859_1 
XEP_CHARSET_ISO_8859_10 
XEP_CHARSET_ISO_8859_11 
XEP_CHARSET_ISO_8859_13 
XEP_CHARSET_ISO_8859_14 
XEP_CHARSET_ISO_8859_15 
XEP_CHARSET_ISO_8859_16 
XEP_CHARSET_ISO_8859_2 
XEP_CHARSET_ISO_8859_3 
XEP_CHARSET_ISO_8859_4 
XEP_CHARSET_ISO_8859_5 
XEP_CHARSET_ISO_8859_6 
XEP_CHARSET_ISO_8859_7 
XEP_CHARSET_ISO_8859_8 
XEP_CHARSET_ISO_8859_8_I 
XEP_CHARSET_ISO_8859_9 
XEP_CHARSET_KOI8_R 
XEP_CHARSET_KOI8_U 
XEP_CHARSET_MAC_CYRILLIC 
XEP_CHARSET_SHIFT_JIS 
XEP_CHARSET_TIS_620 
XEP_CHARSET_UTF8 
XEP_CHARSET_VISCII 
XEP_CHARSET_WINDOWS_1250 
XEP_CHARSET_WINDOWS_1251 
XEP_CHARSET_WINDOWS_1254 
XEP_CHARSET_WINDOWS_1255 
XEP_CHARSET_WINDOWS_1256 
XEP_CHARSET_WINDOWS_1258 

enum XePUtilsEncodingType
 

Enumeration values:
XEP_Q_ENCODING 
XEP_B_ENCODING 
XEP_AUTO_ENCODING 

enum XePUtilsInlinedDataType
 

Enumeration values:
XEP_INLINED_DATA_NONE 
XEP_INLINED_DATA_UUENCODED 
XEP_INLINED_DATA_YENCODED 
XEP_INLINED_DATA_YENCODED2 
XEP_INLINED_DATA_BINHEX 
XEP_INLINED_DATA_TEXT 
XEP_INLINED_DATA_CLEARSIGNED_TEXT 
XEP_INLINED_DATA_ASCII_ARMORED_TEXT 

enum XePUtilsOpenPGPType
 

Enumeration values:
XEP_OPENPGP_NONE 
XEP_OPENPGP_SIGNED 
XEP_OPENPGP_ENCRYPTED 


Function Documentation

char* a_Utils_append char *  dest,
... 
 

Append a NULL terminated list of strings to the first one

Parameters:
dest the string that will be extended
... the NULL terminated list of strings to append to dest
Returns:
the pointer to the new string

char* a_Utils_basename const char *  path  ) 
 

Return the basename of a pathname

Parameters:
path 
Returns:
a newly allocated string containing the basename of the path. The basename is the part of the path after the final path separator. In the spirit of basename(3): A trailing path separator is not counted as part of the pathname. If path does not contain the path separator, it will return a copy of the path. If path is the single path separator string, the basename will return a copy of it. If path is the NULL pointer, or an empty string, then it will return the "." string Contrary to basename(3), this function does not alter the given path, and it always returns an allocated string.

char* a_Utils_create_quoted_printable const char *  text,
const char *  text_charset
 

Create a quoted printable string from a string encoded in some charset

Parameters:
text the text from which the quoted printable string is to be created
text_charset the character set of the original text
Returns:
a newly allocated string containing the same text but encoded using the quoted printable scheme

XePUtilsInlinedData* a_Utils_data_has_binhex const char *  data,
size_t  size
 

Check if in-memory data contains a BinHex 4.0 encoded data Scan the data for a valid "(This file must be converted with BinHex 4.0)" line followed by a stream of characters delimited by ':'. Each line must by of length 64 but the last one which size must be >= 2 and <= 65 including the trailing ':'.

Parameters:
data the in-memory data to be checked
size the length of the data
Returns:
a XePUtilsInlinedData structure describing the encoded file if found, or NULL if no encoded file was found.

Here is the call graph for this function:

XePUtilsInlinedData* a_Utils_data_has_uuencoded const char *  data,
size_t  size
 

Check if in-memory data contains a uuencoded or xxencoded data Scan the data for a valid "begin 000 filename" line

Parameters:
data the in-memory data to be checked
size the length of the data
Returns:
a XePUtilsInlinedData structure describing the encoded file if found, or NULL if no encoded file was found.

Here is the call graph for this function:

XePUtilsInlinedData* a_Utils_data_has_yencoded const char *  data,
size_t  size
 

Check if in-memory data contains a yEncoded data

Parameters:
data the in-memory data to be checked
size the length of the data
Returns:
a XePUtilsInlinedData structure describing the encoded file if found, or NULL if no encoded file was found.

XePUtilsInlinedData* a_Utils_data_has_yencoded2 const char *  data,
size_t  size
 

Check if in-memory data contains a yEnc2 encoded data Scan the data for a valid "=ybegin2 " line

Parameters:
data the in-memory data to be checked
len the length of the data
uu_start the address of a pointer that will point to the start of the encoded block
uu_size the size of the encoded block
Returns:
the filename of the encoded data, or NULL if no encoded data is recognised.

char* a_Utils_encode_8bit_header const char *  text,
const char *  charset,
XePUtilsEncodingType  encoding,
int  is_phrase,
int  is_comment
 

Encode a header that consist of non US-ASCII characters using the scheme proposed by RFC 2047 BUG: Currently, there is no limitation on the length of the result string even though RFC 2047 says we should not overcome the 76 limit and RFC 822/2822 the 998 limit

Parameters:
text the text to be converted
charset the charset (the MIME name of the charset as registered by IANA) of the text
q_encoding whether to use the Q encoding (1) or the B encoding (0)
is_comment whether we are encoding a comment (only relevant for the Q encoding)
is_phrase whether we are encoding a phrase (only relevant for the Q encoding)
Returns:
a newly allocated string containing the encoded text, or NULL if one text is NULL, or if a memory allocation failed. Returns a copy of the original string if charset is NULL or the original text is the empty string "".

Here is the call graph for this function:

char* a_Utils_encode_8bit_subject const char *  subject,
const char *  charset,
XePUtilsEncodingType  encoding
 

Encode a subject that contains 8bit bytes. If the subject is pure 7bit, return a copy of it.

Parameters:
subject the subject to be eventually encoded
charset the character set used in subject
encoding one of XEP_Q_ENCODING, XEP_B_ENCODING or XEP_AUTO_ENCODING
Returns:
a newly allocated string that is the copy of subject if the subject contained only 7bit bytes, or an encoded string representing the subject, or NULL if subject is NULL or if a memory allocation failed.

Here is the call graph for this function:

int a_Utils_exec_cmd char *  cmd,
int  fd_in,
int  fd_out,
int  fd_err,
int *  fd_mon,
pid_t *  _pid,
int  sync
 

Execute a shell command Uses the double fork technique

Parameters:
cmd the shell command
cmd the command to be executed by /bin/sh -c
fd_in the standard input for the command (-1 for stdin)
fd_out the standard output for the command (-1 for stdout)
fd_err the standard error for the command (-1 for stderr) fd_mon a place where to store the file descriptor used to monitor the child execution. This file descriptor will receive one integer representing the exit status of the command as returned by waitpid
pid a place to store the pid of the child process. To kill it, use its negative value to kill the group instead.
sync non zero to run in synchroneous mode where the command is monitored
Returns:
process id of the child process.

int a_Utils_file_backup const char *  filename  ) 
 

Create a backup of a file The file is renamed by appending to its name the suffix ".bak" This function reports success if the file does not exist.

Parameters:
filename the name of the file to be backup'ed.
Returns:
0 on success

void a_Utils_format_size char *  buffer,
size_t  size
 

Format a size into a readable string with an adhoc unit Maximum supported size: 9999 Yotta bytes.. 9999*2^70.

Parameters:
buffer a user provided buffer which must be able to hold at least 6 bytes including ending NULL byte.
size the size to convert.

int a_Utils_has_8bit const char *  text,
size_t  size
 

Check if the string contains 8bit bytes

Parameters:
text the string to check. Must be non NULL
size the number of bytes to check. If size == 0, check the whole string.
Returns:
0 if only 7bits bytes were found, 1 if 8bit bytes were found.

void a_Utils_inlined_data_free XePUtilsInlinedData inlined_data  ) 
 

Free the data structure representing an inlined file

Parameters:
inlined_data a pointer to a XePUtilsInlinedData structure

const char* a_Utils_inlined_data_type_as_string XePUtilsInlinedDataType  type  ) 
 

Return the inlined data type as a human-readable string

Parameters:
type the inlined data type
Returns:
a human-readable string describing the inlined data type

int a_Utils_inlined_file_decode_as XePUtilsInlinedData inlined_data,
const char *  save_as
 

Decode and save uuencoded data from a XePUtilsUUData structure

Parameters:
uudata the XePUtilsUUData structure containing the data
save_as the name of the resultant file
Returns:
0 on success and -1 on error

Here is the call graph for this function:

XePUtilsInlinedData* a_Utils_inlined_file_new XePUtilsInlinedDataType  type,
const char *  data,
size_t  size,
const char *  filename,
void *  extra
 

Create a structure containing the encoded and inlined file

Parameters:
type the type of the encoding
filename the filename of the encoded data. The name is copied.
data the data to be stored. The data is copied and will be freed by a_Utils_inlined_file_free()
size the size of the data
extra extra data for user convenience
Returns:
a newly allocated structure containing the encoded and inlined file

void a_Utils_inlined_list_free clist *  inlined_list  ) 
 

Free a list of XePUtilsInlinedData

Parameters:
inlined_list the non NULL clist of XePUtilsInlinedData structures to free

Here is the call graph for this function:

XePUtilsInlinedData* a_Utils_inlined_text_new XePUtilsInlinedDataType  type,
const char *  data,
size_t  size,
const char *  plain_text,
size_t  plain_size,
int  privacy_sig_status,
int  privacy_enc_status,
void *  extra
 

int a_Utils_load_file const char *  filename,
char **  data,
size_t *  size
 

Load file into memory

Parameters:
filename the name of the file to load
data a pointer to a pointer that will point to the loaded data
size a pointer to a size_t that will hold the size of the data
Returns:
0 on success, -1 on failure

Here is the call graph for this function:

char* a_Utils_magic_data_mime_type const char *  data,
size_t  size
 

Guess the mime type of in-memory data using libmagic

Parameters:
data the data to be checked
len the length of the data
Returns:
the mime type as recognised by libmagic or application/octet-stream if not recognised. TODO: Add a charset result because libmagic can detect it too.

char* a_Utils_magic_file_mime_type const char *  filename  ) 
 

Guess the mime type of a filedata using libmagic

Parameters:
filename name of the file to be checked
len the length of the data
Returns:
the mime type as recognised by libmagic or application/octet-stream if not recognised. TODO: Add a charset result because libmagic can detect it too.

char* a_Utils_magic_get_bare_mime_type const char *  mime_type  ) 
 

Strip unwanted info provided by libmagic in the mime type: E.g. when libmagic returns "text/plain, English", this function will return the bare MIME type ("text/plain")

Parameters:
mime_type the MIME type string returned by libmagic (e.g. a_Utils_magic_(file|data)_mime_type())
Returns:
a newly allocated string containing the bare MIME type, or NULL if mime_type is NULL, or if a memory allocation failed.

char* a_Utils_magic_get_charset const char *  magic_mime_type  ) 
 

Extract the charset part of a magic mime type

Parameters:
magic_mime_type the string that can contain "charset="
Returns:
a newly allocated string copied from magic_mime_type between the end of "charset=" and the next semi-colon or the end of the string

void* a_Utils_memmem const void *  haystack,
size_t  haystack_len,
const void *  needle,
size_t  needle_len
 

Find an array of chars in a block of memory. This is equivalent in function to GNU's memmem and will use it if available at compile time

int a_Utils_orig_date_to_localtime struct mailimf_date_time *  date_time,
struct tm *  local_tm
 

Convert a message original date to a local time

Parameters:
date_time the message's original date field
local_tm the result. It is also used for intermediary computation
Returns:
0 on success, -1 on failure Not reentrant because it uses localtime and not localtime_r

clist* a_Utils_parse_body_text const char *  text,
size_t  size
 

Parse a body text and return a structured description This function parses a text and detect text parts and inlined attachments. Text parts which are signed/encrypted are detected

Parameters:
text the text to analyze
size the size of the text to analyse
Returns:
a clist of XePUtilsTextObject

Here is the call graph for this function:

clist* a_Utils_parse_mailto const char *  mailto  ) 
 

Parse a mailto URL scheme and return a list of header/value pairs

Parameters:
mailto the mailto URL
Returns:
a clist of XePUtilsPair

char* a_Utils_printf char *  template,
XePUtilsFormat format
 

Format a string using a template Tokens are prefixed with '%'

Parameters:
template the string containing the tokens
format a XePUtilsFormat structure containing the token definition and their values
Returns:
an allocated string formatted according to
Parameters:
template and
format 

int a_Utils_quote_text_for_reply const char *  text,
size_t  text_size,
const char *  source_charset,
char **  quoted_text
 

Quote a text for reply TODO: This functions uses the global user preference to quote the text.

Parameters:
text text to be quoted for reply
text_size the size of the text
source_charset character set of the original text
quoted_text will point to the quoted text (NULL terminated string)
Returns:
0 on success and -1 on error

int a_Utils_read int  fd,
char **  data,
size_t *  size
 

Read data from a file descriptor. The file descriptor must be a file from the file system because it preallocates a buffer with a size taken from the result of fstat.

Parameters:
fd the file descriptor from which data will be read
data a pointer to a pointer that will hold the read data.
size a pointer to the size placeholder.
Returns:
0 on success, -1 on error

char* a_Utils_save_temp const char *  data,
size_t  size
 

Save data in a temporary file

Parameters:
data the data to be saved
len the length of the data to save
Returns:
the filename of the saved data on succes, NULL otherwise TODO: Currently the working directory is used for saving, this must be changed

Here is the call graph for this function:

void a_Utils_string_unfold char *  string  ) 
 

FIXME: this function should be called 'clear_crlf'

int a_Utils_text_new_copy_with_rfc2822_lines const char *  text,
size_t  size,
char **  rfc2822_text,
size_t *  rfc2822_size
 

Ensure line endings are
and break lines larger than 998 chars

Parameters:
text 
size 
rfc2822_text the newly created text with canonical line breaks and no line longer than SMTP_MAX_LINE_LEN (998) rfc2822_text must be freed with mmap_string_unref();
rfc2822_size size of new text
Returns:
0 on success, -1 if mmap_string fails

void a_Utils_to_b_encoding const char *  s,
size_t *  is,
char *  t,
size_t *  it
 

Encode the next 3 bytes of a string into 4 base64 bytes When the function encounters the end of string, it does the padding as described in RFC 2045 and trailing '=' are added to the output. The target string must be allocated in a way that it can hold the next 4 bytes.

Parameters:
s the source string. A non NULL string.
is a pointer to the index from which conversion starts. The byte from the string s at offset is must be non NUL. The index will be incremented accordingly and will point the next byte to encode
t the target buffer. This must be an already allocated buffer.
it a pointer to the index at which the result will be written. The target buffer must be addressable from t + it to t + it + 3 inclusive. The index will be incremented accordingly by 4.

void a_Utils_to_q_encoding const char *  s,
size_t *  is,
char *  t,
size_t *  it,
int  is_phrase,
int  is_comment
 

Encode the next byte of a string into quoted-printable This version encodes all non mail-safe characters as defined in RFC 2047 and encodes according to RFC 2045. The output is suitable for inclusion in field body (RFC 2047). The non-encoded characters are the alphanumerical ones (a-z, A-Z, 0-9) and some mail-safe characters ('*', '+', '-', '/') plus some others that are encoded only if in a 'phrase' (is_phrase set) ("'", ".", "," ":") plus some others that are encoded only if in a phrase or in a 'comment' (is_comment set) ('(' and ')'). The NUL character is encoded to =00. The alphabetic hex digits are in capital.

Parameters:
s the string to be encoded. It must be non NULL.
is a pointer to the index that points to the byte to encode. The index will be incremented by one, thus pointing to the next to be encoded byte.
t the buffer that will contain the encoded data.
it a pointer to the index that points to where the encoded data will be written in the buffer t. The user must ensure that sufficiently memory was allocated as it is possible that the bytes t[it] to t[it + 2] are written. The index is incremented accordingly and will point to the end of the just encoded data.
is_comment whether the parenthesis should be encoded (e.g. when we are encoding a the content of a comment)
is_phrase whether we must encode some special characters that must not be present unencoded in a phrase (RFC 822/2822). These characters are "'" "." "," ":" "(" and ")".

char* a_Utils_uulib_decode_file const char *  filename,
void(*  msg_cb)(void *adata, const char *msg, int msg_type),
void(*  busy_cb)(void *adata, uuprogress *aprogress),
void *  data
 

Decode a file using UUDeview library (uulib)

Parameters:
filename the file containing data to be decoded
msg_cb a callback to be called during decoding process to issue diagnostic messages
busy_cb a callback to be called from time to time during long jobs
data pointer to data to be passed to the callbacks
Returns:
the file name of the decoded data

int a_Utils_write int  fd,
const char *  data,
size_t  size
 

Write data to a file descriptor

Parameters:
fd the file descriptor which will get the data
data the data to save
size its size
Returns:
0 on success, -1 on error


Variable Documentation

XePUtilsCharsetMapping xetpan_charsets[]
 


Generated on Wed Oct 22 15:57:08 2003 for XetPan by doxygen 1.3.2