Oracle iPlanet Web Proxy Server 4.0.14 NSAPI Developer's Guide

U

USE_NSAPI_VERSION

To request a particular version of NSAPI, define the USE_NSAPI_VERSION macro before including the nsapi.h header file. The requested NSAPI version is encoded by multiplying the major version number by 100 and then adding this to the minor version number. For example, the following code requests NSAPI 3.2 features:

#define USE_NSAPI_VERSION 302 /* We want NSAPI 3.2 (Web Server 6.1) */
#include "nsapi.h"

To develop a plug-in that is compatible across multiple server versions, define USE_NSAPI_VERSION to the highest NSAPI version supported by all of the target server versions.

The following table lists server versions and the highest NSAPI version supported by each:

Table 4–2 NSAPI Versions Supported by Different Servers

Server Version 

NSAPI Version 

Sun iPlanet Web Server 4.1 

3.0 

Sun iPlanet Web Server 6.0 

3.1 

Netscape Enterprise Server 6.0 

3.1 

Netscape Enterprise Server 6.1 

3.1 

Sun ONE Application Server 7.0 

3.1 

Sun Java System Web Server 6.1 

3.2 

Oracle iPlanet Web Server 7.0.9 

3.3 

iPlanet Web Proxy Server 4 

3.3 

Do not request a version of NSAPI higher than the highest version supported by the nsapi.h header that the plug-in is being compiled against. Additionally, to use USE_NSAPI_VERSION, you must compile against an nsapi.h header file that supports NSAPI 3.3 or higher.

Syntax

int USE_NSAPI_VERSION

Example

The following code can be used when building a plug-in designed to work with Proxy Server 4:

#define USE_NSAPI_VERSION 303 /* We want NSAPI 3.3 (Proxy Server 4) */
#include "nsapi.h"

See Also

NSAPI_RUNTIME_VERSION, NSAPI_VERSION

util_can_exec

UNIX Only

The util_can_exec function checks that a specified file can be executed, returning either a 1 (executable) or a 0. The function checks whether the file can be executed by the user with the given user and group ID.

Use this function before executing a program using the exec system call.

Syntax

int util_can_exec(struct stat *finfo, uid_t uid, gid_t gid);

Returns

1 if the file is executable, or 0 if the file is not executable.

Parameters

stat *finfo is the stat structure associated with a file.

uid_t uid is the UNIX user ID.

gid_t gid is the UNIX group ID. Together with uid, this value determines the permissions of the UNIX user.

See Also

util_env_create, util_getline, util_hostname

util_chdir2path

The util_chdir2path function changes the current directory to a specified directory where you will access a file.

When running under Windows, use a critical section to ensure that more than one thread does not call this function at the same time.

Using util_chdir2path makes file access a little quicker because this function does not require a full path.

Syntax

int util_chdir2path(char *path);

Returns

0 if the directory was changed, or -1 if the directory could not be changed.

Parameters

char *path is the name of a directory.

The parameter must be a writable string because the string is not permanently modified.

util_cookie_find

The util_cookie_find function finds a specific cookie in a cookie string and returns its value.

Syntax

char *util_cookie_find(char *cookie, char *name);

Returns

If successful, returns a pointer to the NULL-terminated value of the cookie. Otherwise, returns NULL. This function modifies the cookie string parameter by NULL-terminating the name and value.

Parameters

char *cookie is the value of the Cookie: request header.

char *name is the name of the cookie whose value is to be retrieved.

util_does_process_exist

The util_does_process_exist function verifies that a given process ID is that of an executing process.

Syntax

#include <libproxy/util.h>
int util_does_process_exist (int pid)

Returns

Parameters

int pid is the process ID to be tested.

See Also

util_url_fix_host name, util_uri_check

util_env_create

The util_env_create function creates and allocates the environment specified by env, returning a pointer to the environment. If the parameter env is NULL, the function allocates a new environment. Use util_env_create to create an environment when executing a new program.

Syntax

#include <base/util.h>
char **util_env_create(char **env, int n, int *pos);

Returns

A pointer to an environment.

Parameters

char **env is the existing environment or NULL.

int n is the maximum number of environment entries that you want in the environment.

int *pos is an integer that keeps track of the number of entries used in the environment.

See Also

util_env_replace, util_env_str , util_env_free , util_env_find

util_env_find

The util_env_find function locates the string denoted by a name in a specified environment and returns the associated value. Use this function to find an entry in an environment.

Syntax

char *util_env_find(char **env, char *name);

Returns

The value of the environment variable if it is found, or NULL if the string was not found.

Parameters

char **env is the environment.

char *name is the name of an environment variable in env.

See Also

util_env_replace, util_env_str , util_env_free , util_env_create

util_env_free

The util_env_free function frees a specified environment. Use this function to deallocate an environment that you created using the function util_env_create.

Syntax

void util_env_free(char **env);

Returns

void

Parameters

char **env is the environment to be freed.

See Also

util_env_replace, util_env_str , util_env_create , util_env_find

util_env_replace

The util_env_replace function replaces the occurrence of the variable denoted by a name in a specified environment with a specified value. Use this function to change the value of a setting in an environment.

Syntax

void util_env_replace(char **env, char *name, char *value);

Returns

void

Parameters

char **env is the environment.

char *name is the name of a name-value pair.

char *value is the new value to be stored.

See Also

util_env_str, util_env_free , util_env_find, util_env_create

util_env_str

The util_env_str function creates an environment entry and returns it. This function does not check for nonalphanumeric symbols in the name such as the equal sign “=”. You can use this function to create a new environment entry.

Syntax

char *util_env_str(char *name, char *value);

Returns

A newly allocated string containing the name-value pair.

Parameters

char *name is the name of a name-value pair.

char *value is the new value to be stored.

See Also

util_env_replace, util_env_free , util_env_create , util_env_find

util_get_current_gmt

The util_get_current_gmt function obtains the current time, represented in terms of GMT (Greenwich Mean Time).

Syntax

#include <libproxy/util.h>
time_t util_get_current_gmt(void);

Returns

the current GMT

Parameters

No parameter is required.

See Also

util_make_local

util_get_int_from_aux_file

The util_get_int_from_aux_file function is used to get a single line from a specified file and return it in the form of an integer. This ifunction enables you to store single numbers in a file.

Syntax

#include <libproxy/cutil.h>
int util_get_int_from_file(char *root, char *name);

Returns

An integer from the file.

Parameters

char*root is the name of the directory containing the file to be read.

char*name is the name of the file to be read.

See Also

util_get_long_from_aux_file, util_get_string_from_aux_file, util_get_int_from_file, util_get_long_from_file, util_get_string_from_file, util_put_int_to_file, util_put_long_to_file, util_put_string_to_aux_file, util_put_string_to_file

util_get_int_from_file

The util_get_int_from_file function is used to get a single line from a specified file and return it in the form of an integer. This function enables you to store single numbers in a file.

Syntax

#include <libproxy/cutil.h>
int util_get_int_from_file(char *filename);

Returns

Parameters

char *filename is the name of the file to be read.

See Also

util_get_long_from_file, util_get_string_from_file, util_put_int_to_file, util_put_long_to_file, util_put_string_to_file

util_get_long_from_aux_file

The util_get_long_from_file function is used to get a single line from a specified file and return it in the form of a long number. This function enables you to store single long numbers in a file.

Syntax

#include <libproxy/cutil.h>
long util_get_long_from_file(char *root,char *name);

Returns

A long integer from the file.

Parameters

char *root is the name of the directory containing the file to be read.

char *name is the name of the file to be read.

See Also

util_get_int_from_aux_file, util_get_string_from_aux_file, util_get_int_from_file, util_get_long_from_file, util_get_string_from_file, util_put_int_to_file, util_put_long_to_file, util_put_string_to_aux_file, util_put_string_to_file

util_get_long_from_file

The util_get_long_from_file function is used to get a single line from a specified file and return it in the form of a long number. This function enables you to store single long numbers in a file.

Syntax

#include <libproxy/cutil.h>
long util_get_long_from_file(char *filename);

Returns

Parameters

char *file is the name of the file to be read.

See Also

util_get_int_from_file, util_get_string_from_file, util_put_int_to_file, util_put_long_to_file, util_put_string_to_file

util_get_string_from_aux_file

The util_get_string_from_aux_file function is used to get a single line from a specified file and return it in the form of a word. This function enables you to store single words in a file.

Syntax

#include <libproxy/cutil.h>
char *util_get_string_from_file(char *root, char *name, char *buf, int maxsize);

Returns

A string containing the next line from the file.

Parameters

char *root is the name of the directory containing the file to be read.

char *name is the name of the file to be read.

char *buf is the string to use as the file buffer.

int maxsize is the maximum size for the file buffer.

See Also

util_get_int_from_aux_file, util_get_long_from_aux_file, util_get_int_from_file, util_get_long_from_file, util_get_string_from_file, util_put_int_to_file, util_put_long_to_file, util_put_string_to_aux_file, util_put_string_to_file

util_get_string_from_file

The util_get_string_from_file function is used to get a single line from a specified file and return it in the form of a word. This function enables you to store single words in a file.

Syntax

#include <libproxy/cutil.h>
char *util_get_string_from_file(char *filename, char *buf, int maxsize);

Returns

Parameters

char *file is the name of the file to be read.

char *buf is the string to use as the file buffer.

int maxsize is the maximum size for the file buffer.

See Also

util_get_int_from_file, util_get_long_from_file, util_put_int_to_file, util_put_long_to_file, util_put_string_to_file

util_getline

The util_getline function scans the specified file buffer to find a line feed or carriage return/line feed terminated string. The string is copied into the specified buffer, and NULL-terminates it. The function returns a value that indicates whether the operation stored a string in the buffer, encountered an error, or reached the end of the file.

Use this function to scan lines out of a text file, such as a configuration file.

Syntax

int util_getline(filebuf *buf, int lineno, int maxlen, char *line);

Returns

0 if successful line contains the string.

1 if the end of file was reached line contains the string.

-1 if an error occurred line contains a description of the error.

Parameters

filebuf *buf is the file buffer to be scanned.

int lineno is used to include the line number in the error message when an error occurs. The caller is responsible for making sure that the line number is accurate.

int maxlen is the maximum number of characters that can be written into l.

char *l is the buffer in which to store the string. The user is responsible for allocating and deallocating line.

See Also

util_can_exec, util_env_create, util_hostname

util_hostname

The util_hostname function retrieves the local host name and returns it as a string. If the function cannot find a fully qualified domain name, it returns NULL. You may reallocate or free this string. Use this function to determine the name of the system you are on.

Syntax

char *util_hostname(void);

Returns

If a fully qualified domain name was found, returns a string containing that name. Otherwise, the function returns NULL if the fully qualified domain name was not found.

Parameters

none

util_is_mozilla

The util_is_mozilla function checks whether a specified user-agent header string is a Netscape browser of at least a specified revision level. The function uses strings to specify the revision level to avoid ambiguities such as 1.56 > 1.5.

Syntax

int util_is_mozilla(char *ua, char *major, char *minor);

Returns

1 if the user-agent is a Netscape browser, or 0 if the user-agent is not a Netscape browser.

Parameters

char *ua is the user-agent string from the request headers.

char *major is the major release number to the left of the decimal point.

char *minor is the minor release number to the right of the decimal point.

See Also

util_is_url, util_later_than

util_is_url

The util_is_url function checks whether a string is a URL. The string is a URL if it begins with alphabetic characters followed by a colon (:).

Syntax

int util_is_url(char *url);

Returns

1 if the string specified by url is a URL, or 0 if the string specified by url is not a URL.

Parameters

char *url is the string to be examined.

See Also

util_is_mozilla, util_later_than

util_itoa

The util_itoa function converts a specified integer to a string, and returns the length of the string. Use this function to create a textual representation of a number.

Syntax

int util_itoa(int i, char *a);

Returns

The length of the string created.

Parameters

int i is the integer to be converted.

char *a is the ASCII string that represents the value. The user is responsible for the allocation and deallocation of a. The string should be at least 32 bytes long.

util_later_than

The util_later_than function compares the date specified in a time structure against a date specified in a string. If the date in the string is later than or equal to the one in the time structure, the function returns 1. Use this function to handle RFC 822, RFC 850, and ctime formats.

Syntax

int util_later_than(struct tm *lms, char *ims);

Returns

1 if the date represented by ims is the same as or later than that represented by the lms, or 0 if the date represented by ims is earlier than that represented by the lms.

Parameters

tm *lms is the time structure containing a date.

char *ims is the string containing a date.

See Also

util_strftime

util_make_filename

The util_make_filename function concatenates a directory name and a file name into a newly created string. This function is useful when you are dealing with a number of files that all go to the same directory.

Syntax

#include <libproxy/cutil.h>
char *util_make_filename(char *root, char *name);

Returns

A new string containing the directory name concatenated with the file name.

Parameters

char *root is a string containing the directory name.

char *name is a string containing the file name.

util_make_gmt

The util_make_gmt function converts a given local time to GMT (Greenwich Mean Time), or obtains the current GMT.

Syntax

#include <libproxy/util.h>
time_t util_make_gmt(time_t t);

Returns

Parameters

time_t t is a time.

See Also

util_make_local

util_make_local

The util_make_local function converts a given GMT to local time.

Syntax

#include <libproxy/util.h>
time_t util_make_local(time_t t);

Returns

The local equivalent to the GMT t.

Parameters

time_t t is a time.

See Also

util_make_gmt

util_move_dir

The util_move_dir function moves a directory, preserving permissions, creation times, and last-access times. If renaming fails, for example, if the source and destination are on two different file systems, the function copies the directory.

Syntax

#include <libproxy/util.h>
int util_move_dir (char *src, char *dst);

Returns

Parameters

char *src is the fully qualified name of the source directory.

char *dst is the fully qualified name of the destination directory.

See Also

util_move_file

util_move_file

The util_move_dir function moves a file, preserving permissions, creation time, and last-access time. If renaming fails, for example, if the source and destination are on two different file systems, the function copies the file.

Syntax

#include <libproxy/util.h>
int util_move_file (char *src, char *dst);

Returns

Parameters

char *src is the fully qualified name of the source file.

char *dst is the fully qualified name of the destination file.

See Also

util_move_dir

util_parse_http_time

The util_parse_http_time function converts a given HTTP time string to time_t format.

Syntax

#include <libproxy/util.h>
time_t util_parse_http_time(char *date_string);

Returns

The time_t equivalent to the GMT t.

Parameters

time_t t is a time.

See Also

util_make_gmt

util_put_int_to_file

The util_put_int_to_file function writes a single line containing an integer to a specified file.

Syntax

#include <libproxy/cutil.h>
int util_put_int_to_file(char *filename, int i);

Returns

Parameters

char *file is the name of the file to be written.

int i is the integer to write.

See Also

util_get_int_from_file, util_get_long_from_file, util_put_long_to_file, util_put_string_to_file

util_put_long_to_file

The util_put_long_to_file function writes a single line containing a long integer to a specified file.

Syntax

#include <libproxy/cutil.h>
ing util_put_long_to_file(char *filename, long l);

Returns

Parameters

char *file is the name of the file to be written.

long l is the long integer to write.

See Also

util_get_int_from_file, util_get_long_from_file, util_put_int_to_file, util_put_string_to_file

util_put_string_to_aux_file

The util_put_string_to_aux_file function writes a single line containing a string to a file specified by directory name and file name.

Syntax

#include <libproxy/cutil.h>
int util_put_string_to_aux_file(char *root, char *name, char *str);

Returns

Parameters

char *root is the name of the directory where the file is to be written.

char *name is the name of the file is to be written.

char *str is the string to write.

See Also

util_get_int_from_file, util_get_long_from_file, util_put_int_to_file, util_put_long_to_file, util_put_string_to_file

util_put_string_to_file

The util_put_string_to_file function writes a single line containing a string to a specified file.

Syntax

#include <libproxy/cutil.h>
int util_put_string_to_file(char *filename, char *str);

Returns

Parameters

char *file is the name of the file to be read.

char *str is the string to write.

See Also

util_get_int_from_file, util_get_long_from_file, util_put_int_to_file, util_put_long_to_file

util_sect_id

The util_sect_id function creates a section ID from the section dim and an index.

Syntax

#include <libproxy/cutil.h>
void util_sect_id(int dim, int idx, char *buf);

Returns

Parameters

int dim is the section dim.

int idx is the index.

char *buf is the buffer to receive the section ID.

util_sh_escape

The util_sh_escape function parses a specified string and places a backslash (\\) in front of any shell-special characters, returning the resultant string. Use this function to ensure that strings from clients won’t cause a shell to behave unexpectedly.

The shell-special characters are the space plus the following characters:

&;\Q’"|*?~<>^()[]{}$\\#!

Syntax

char *util_sh_escape(char *s);

Returns

A newly allocated string.

Parameters

char *s is the string to be parsed.

See Also

util_uri_escape

util_snprintf

The util_snprintf function formats a specified string, using a specified format, into a specified buffer using the printf-style syntax and performs bounds checking. The function returns the number of characters in the formatted buffer.

For more information, see the documentation on the printf function for the runtime library of your compiler.

Syntax

int util_snprintf(char *s, int n, char *fmt, ...);

Returns

The number of characters formatted into the buffer.

Parameters

char *s is the buffer to receive the formatted string.

int n is the maximum number of bytes allowed to be copied.

char *fmt is the format string. The function handles only %d and %s strings. It does not handle any width or precision strings.

... represents a sequence of parameters for the printf function.

See Also

util_sprintf, util_vsnprintf, util_vsprintf

util_sprintf

The util_sprintf function formats a specified string, using a specified format, into a specified buffer, using the printf-style syntax without bounds checking. The function returns the number of characters in the formatted buffer.

Because util_sprintf doesn’t perform bounds checking, use this function only if you are certain that the string fits the buffer. Otherwise, use the function util_snprintf. For more information, see the documentation on the printf function for the runtime library of your compiler.

Syntax

int util_sprintf(char *s, char *fmt, ...);

Returns

The number of characters formatted into the buffer.

Parameters

char *s is the buffer to receive the formatted string.

char *fmt is the format string. The function handles only %d and %s strings. It does not handle any width or precision strings.

... represents a sequence of parameters for the printf function.

Example

char *logmsg;int len;logmsg = (char *) MALLOC(256);
	len = util_sprintf(logmsg, "%s %s %s\\n", ip, method, uri);

See Also

util_snprintf, util_vsnprintf, util_vsprintf

util_strcasecmp

The util_strcasecmp function performs a comparison of two alphanumeric strings and returns a -1, 0, or 1 to signal which string is larger or that the strings are identical.

The comparison is not case sensitive.

Syntax

int util_strcasecmp(const char *s1, const char *s2);

Returns

1 if s1 is greater than s2.

0 if s1 is equal to s2.

-1 if s1 is less than s2.

Parameters

char *s1 is the first string.

char *s2 is the second string.

See Also

util_strncasecmp

util_strftime

The util_strftime function translates a tm structure, which is a structure describing a system time, into a textual representation. This function is a thread-safe version of the standard strftime function

Syntax

int util_strftime(char *s, const char *format, const struct tm *t);

Returns

The number of characters placed into s, not counting the terminating NULL character.

Parameters

char *s is the string buffer to put the text into. The function does not check bounds, so you must make sure that your buffer is large enough for the text of the date.

const char *format is a format string resembling a printf string in that it consists of text with certain %x substrings. You may use the constant HTTP_DATE_FMT to create date strings in the standard Internet format. For more information, see the documentation on the printf function for the runtime library of your compiler. Refer to Chapter 7, Time Formats for details on time formats.

const struct tm *t is a pointer to a calendar time (tm) structure, usually created by the function system_localtime or system_gmtime.

See Also

system_localtime, system_gmtime

util_strncasecmp

The util_strncasecmp function performs a comparison of the first n characters in the alphanumeric strings and returns a -1, 0, or 1 to signal which string is larger or that the strings are identical.

The function’s comparison is not case sensitive.

Syntax

int util_strncasecmp(const char *s1, const char *s2, int n);

Returns

1 if s1 is greater than s2.

0 if s1 is equal to s2.

-1 if s1 is less than s2.

Parameters

char *s1 is the first string.

char *s2 is the second string.

int n is the number of initial characters to compare.

See Also

util_strcasecmp

util_uri_check

The util_uri_check function checks whether a URI has a format conforming to the standard.

At present, the only URI checked for is a URL. The standard format for a URL is

protocol://user:password@host:port/url-path

where user:password, :password. :port, or /url-path can be omitted.

Syntax

#include <libproxy/util.h>
int util_uri_check (char *uri);

Returns

Parameters

char *uri is the URI to be tested.

util_uri_escape

The util_uri_escape function converts any special characters in the URI into the URI format, %XX, where XX is the hexadecimal equivalent of the ASCII character, and returns the escaped string. The special characters are %?#:+&*"<>, space, carriage return, and line feed.

Use util_uri_escape before sending a URI back to the client.

Syntax

char *util_uri_escape(char *d, char *s);

Returns

The string, possibly newly allocated with escaped characters replaced.

Parameters

char *d is a string. If d is not NULL, the function copies the formatted string into d and returns it. If d is NULL, the function allocates a properly sized string and copies the formatted special characters into the new string, then returns it.

The util_uri_escape function does not check bounds for the parameter d. Therefore, if d is not NULL, it should be at least three times as large as the string s.

char *s is the string containing the original unescaped URI.

See Also

util_uri_is_evil, util_uri_parse, util_uri_unescape

util_uri_is_evil

The util_uri_is_evil function checks a specified URI for insecure path characters. Insecure path characters include //, /./, /../ and/., /.. (and for Windows./) at the end of the URI. Use this function to see whether a URI requested by the client is insecure.

Syntax

int util_uri_is_evil(char *t);

Returns

1 if the URI is insecure, or 0 if the URI is OK.

Parameters

char *t is the URI to be checked.

See Also

util_uri_escape, util_uri_parse

util_uri_parse

The util_uri_parse function converts //, /./, and /*/../ into / in the specified URI where * is any character other than /. You can use this function to convert a URI’s unacceptable sequences into valid ones. First use the function util_uri_is_evil to determine whether the function has an incorrect sequence.

Syntax

void util_uri_parse(char *uri);

Returns

void

Parameters

char *uri is the URI to be converted.

See Also

util_uri_is_evil, util_uri_unescape

util_uri_unescape

The util_uri_unescape function converts the encoded characters of a URI into their ASCII equivalents. Encoded characters appear as %XX, where XX is a hexadecimal equivalent of the character.


Note –

You cannot use an embedded null in a string, because NSAPI functions assume that a null is the end of the string. Therefore, passing Unicode-encoded content through an NSAPI plug-in doesn’t work.


Syntax

void util_uri_unescape(char *uri);

Returns

void

Parameters

char *uri is the URI to be converted.

See Also

util_uri_escape, util_uri_is_evil, util_uri_parse

util_url_cmp

The util_url_cmp function compares two URLs. This function is analogous to the strcmp( )()library function of C.

Syntax

#include <libproxy/util.h>
int util_url_cmp (char *s1, char *s2);

Returns

Parameters

char *s1 is the first URL to be tested.

char *s2 is the second URL to be tested.

See Also

util_url_fix_host name, util_uri_check

util_url_fix_host name

The util_url_fix_host name function converts the host name in a URL to lowercase and removes redundant port numbers.

Syntax

#include <libproxy/util.h>
void util_url_fix_host name(char *url);

Returns

void but changes the value of its parameter string

The protocol specifier and the host name in the parameter string are changed to lowercase. The function also removes redundant port numbers, such as 80 for HTTP, 70 for gopher, and 21 for FTP.

Parameters

char *url is the URL to be converted.

See Also

util_url_cmp, util_uri_check

util_url_has_FQDN

The util_url_has_FQDN function returns a value to indicate whether a specified URL references a fully qualified domain name.

Syntax

#include <libproxy/util.h>
int util_url_has_FQDN(char *url);

Returns

Parameters

char *url is the URL to be examined.

util_vsnprintf

The util_vsnprintf function formats a specified string, using a specified format, into a specified buffer using the vprintf-style syntax and performs bounds checking. The function returns the number of characters in the formatted buffer.

For more information, see the documentation on the printf function for the runtime library of your compiler.

Syntax

int util_vsnprintf(char *s, int n, register char *fmt, va_list args);

Returns

The number of characters formatted into the buffer.

Parameters

char *s is the buffer to receive the formatted string.

int n is the maximum number of bytes allowed to be copied.

register char *fmt is the format string. The function handles only %d and %s strings. It does not handle any width or precision strings.

va_list args is an STD argument variable obtained from a previous call to va_start.

See Also

util_snprintf, util_vsprintf

util_vsprintf

The util_vsprintf function formats a specified string, using a specified format, into a specified buffer using the vprintf-style syntax without bounds checking. The function returns the number of characters in the formatted buffer.

For more information, see the documentation on the printf function for the runtime library of your compiler.

Syntax

int util_vsprintf(char *s, register char *fmt, va_list args);

Returns

The number of characters formatted into the buffer.

Parameters

char *s is the buffer to receive the formatted string.

register char *fmt is the format string. The function handles only %d and %s strings. It does not handle any width or precision strings.

va_list args is an STD argument variable obtained from a previous call to va_start.

See Also

util_snprintf, util_vsnprintf