---
name: "pacparser"
section: "3"
platform: "linux"
package: "pacparser"
version: "1.5.3-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/pacparser"
---

# pacparser(3)

Library to parse proxy auto-confg (PAC) files. API for pacparser library, a library to use proxy auto-config (PAC) files. See project homepage: http://github.com/manugarg/pacparser for more information.

## NAME

pacparser - Library to parse proxy auto-confg (PAC) files.

API for pacparser library, a library to use proxy auto-config (PAC) files. See project homepage: http://github.com/manugarg/pacparser for more information.

### Typedefs

typedef int(\* **pacparser\_error\_printer** )(const char \*fmt, va\_list argp)\
 *Type definition for pacparser\_error\_printer.*

### Functions

int **pacparser\_init** (void)\
 *Initializes pac parser.*  int **pacparser\_parse\_pac\_file** (const char \*pacfile)\
 *Parses the given PAC file.*  int **pacparser\_parse\_pac\_string** (const char \*pacstring)\
 *Parses the given PAC script string.*  int **pacparser\_parse\_pac** (const char \*pacfile)\
 *Parses the gievn pac file.*  char \* **pacparser\_find\_proxy** (const char \*url, const char \*host)\
 *Finds proxy for the given URL and Host.*  char \* **pacparser\_just\_find\_proxy** (const char \*pacfile, const char \*url, const char \*host)\
 *Finds proxy for the given PAC file, URL and Host.*  void **pacparser\_cleanup** (void)\
 *Destroys JavaSctipt context.*  void **pacparser\_setmyip** (const char \*ip)\
 *Sets my IP address.*  void **pacparser\_set\_error\_printer** (**pacparser\_error\_printer** func)\
 *Sets error printing function.*  void **pacparser\_enable\_microsoft\_extensions** (void)\
 *(Deprecated) Enable Microsoft IPv6 PAC extensions.*  char \* **pacparser\_version** (void)\
 *Returns pacparser version.*

## Detailed Description

API for pacparser library, a library to use proxy auto-config (PAC) files. See project homepage: http://github.com/manugarg/pacparser for more information.

**Author:**

Manu Garg manugarg@gmail.com

## Function Documentation

### int pacparser\_init (void)

Initializes pac parser.

**Returns:**

0 on failure and 1 on success.

Initializes JavaScript engine and does few basic initializations specific to pacparser.

### int pacparser\_parse\_pac\_file (const char \*pacfile)

Parses the given PAC file.

**Parameters:**

*pacfile* PAC file to parse.

**Returns:**

0 on failure and 1 on success.

Reads the given PAC file and evaluates it in the JavaScript context created by pacparser\_init.

### int pacparser\_parse\_pac\_string (const char \*pacstring)

Parses the given PAC script string.

**Parameters:**

*pacstring* PAC string to parse.

**Returns:**

0 on failure and 1 on success.

Evaluates the given PAC script string in the JavaScript context created by pacparser\_init.

### int pacparser\_parse\_pac (const char \*pacfile)

Parses the gievn pac file.

**Deprecated**

Use pacparser\_parse\_pac\_file instead.

**Parameters:**

*pacfile* PAC file to parse.

**Returns:**

0 on failure and 1 on success.

Same as pacparser\_parse\_pac\_file. Included only for backward compatibility.

### char\* pacparser\_find\_proxy (const char \*url, const char \*host)

Finds proxy for the given URL and Host.

**Parameters:**

*url* URL to find proxy for. \
 *host* Host part of the URL.

**Returns:**

proxy string on success and NULL on error.

Finds proxy for the given URL and Host. This function should be called only after pacparser engine has been initialized (using pacparser\_init) and pac script has been parsed (using pacparser\_parse\_pac\_file or pacparser\_parse\_pac\_string).

### char\* pacparser\_just\_find\_proxy (const char \*pacfile, const char \*url, const char \*host)

Finds proxy for the given PAC file, URL and Host.

**Parameters:**

*pacfile* PAC file to parse. \
 *url* URL to find proxy for. \
 *host* Host part of the URL.

**Returns:**

proxy string on success and NULL on error.

This function is a wrapper around functions pacparser\_init, pacparser\_parse\_pac\_file, pacparser\_find\_proxy and pacparser\_cleanup. If you just want to find out proxy for a given set of pac file, url and host, this is the function to call. This function takes care of all the initialization and cleanup.

### void pacparser\_cleanup (void)

Destroys JavaSctipt context. This function should be called once you're done with using pacparser engine.

### void pacparser\_setmyip (const char \*ip)

Sets my IP address.

**Parameters:**

*ip* Custom IP address.

Sets my IP address to a custom value. This is the IP address returned by myIpAddress() javascript function.

### void pacparser\_set\_error\_printer (pacparser\_error\_printerfunc)

Sets error printing function.

**Parameters:**

*func* Printing function.

Sets error variadic-argument printing function. If not set the messages are printed to stderr. If messages begin with DEBUG: or WARNING:, they are not fatal error messages, otherwise they are. May be called before **pacparser\_init()**.

### void pacparser\_enable\_microsoft\_extensions (void)

(Deprecated) Enable Microsoft IPv6 PAC extensions. Deprecated. IPv6 extension (\*Ex functions) are enabled by default now.

### char\* pacparser\_version (void)

Returns pacparser version.

**Returns:**

version string if version defined, '' otherwise.

Version string is determined at the time of build. If built from a released package, version corresponds to the latest release (git) tag. If built from the repository, it corresponds to the head revision of the repo.

## Author

Generated automatically by Doxygen for Pacparser from the source code.
