mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
docs: enable syntax highlighting in several docs files
... for better readability Closes #6286
This commit is contained in:
parent
eddae97406
commit
5253444090
@ -36,18 +36,22 @@ library-global symbols.
|
|||||||
We use only spaces for indentation, never TABs. We use two spaces for each new
|
We use only spaces for indentation, never TABs. We use two spaces for each new
|
||||||
open brace.
|
open brace.
|
||||||
|
|
||||||
if(something_is_true) {
|
```c
|
||||||
while(second_statement == fine) {
|
if(something_is_true) {
|
||||||
moo();
|
while(second_statement == fine) {
|
||||||
}
|
moo();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Comments
|
## Comments
|
||||||
|
|
||||||
Since we write C89 code, **//** comments are not allowed. They weren't
|
Since we write C89 code, **//** comments are not allowed. They weren't
|
||||||
introduced in the C standard until C99. We use only **/* comments */**.
|
introduced in the C standard until C99. We use only **/* comments */**.
|
||||||
|
|
||||||
/* this is a comment */
|
```c
|
||||||
|
/* this is a comment */
|
||||||
|
```
|
||||||
|
|
||||||
## Long lines
|
## Long lines
|
||||||
|
|
||||||
@ -69,42 +73,52 @@ In if/while/do/for expressions, we write the open brace on the same line as
|
|||||||
the keyword and we then set the closing brace on the same indentation level as
|
the keyword and we then set the closing brace on the same indentation level as
|
||||||
the initial keyword. Like this:
|
the initial keyword. Like this:
|
||||||
|
|
||||||
if(age < 40) {
|
```c
|
||||||
/* clearly a youngster */
|
if(age < 40) {
|
||||||
}
|
/* clearly a youngster */
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
You may omit the braces if they would contain only a one-line statement:
|
You may omit the braces if they would contain only a one-line statement:
|
||||||
|
|
||||||
if(!x)
|
```c
|
||||||
continue;
|
if(!x)
|
||||||
|
continue;
|
||||||
|
```
|
||||||
|
|
||||||
For functions the opening brace should be on a separate line:
|
For functions the opening brace should be on a separate line:
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
```c
|
||||||
{
|
int main(int argc, char **argv)
|
||||||
return 1;
|
{
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## 'else' on the following line
|
## 'else' on the following line
|
||||||
|
|
||||||
When adding an **else** clause to a conditional expression using braces, we
|
When adding an **else** clause to a conditional expression using braces, we
|
||||||
add it on a new line after the closing brace. Like this:
|
add it on a new line after the closing brace. Like this:
|
||||||
|
|
||||||
if(age < 40) {
|
```c
|
||||||
/* clearly a youngster */
|
if(age < 40) {
|
||||||
}
|
/* clearly a youngster */
|
||||||
else {
|
}
|
||||||
/* probably grumpy */
|
else {
|
||||||
}
|
/* probably grumpy */
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## No space before parentheses
|
## No space before parentheses
|
||||||
|
|
||||||
When writing expressions using if/while/do/for, there shall be no space
|
When writing expressions using if/while/do/for, there shall be no space
|
||||||
between the keyword and the open parenthesis. Like this:
|
between the keyword and the open parenthesis. Like this:
|
||||||
|
|
||||||
while(1) {
|
```c
|
||||||
/* loop forever */
|
while(1) {
|
||||||
}
|
/* loop forever */
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Use boolean conditions
|
## Use boolean conditions
|
||||||
|
|
||||||
@ -112,40 +126,50 @@ Rather than test a conditional value such as a bool against TRUE or FALSE, a
|
|||||||
pointer against NULL or != NULL and an int against zero or not zero in
|
pointer against NULL or != NULL and an int against zero or not zero in
|
||||||
if/while conditions we prefer:
|
if/while conditions we prefer:
|
||||||
|
|
||||||
result = do_something();
|
```c
|
||||||
if(!result) {
|
result = do_something();
|
||||||
/* something went wrong */
|
if(!result) {
|
||||||
return result;
|
/* something went wrong */
|
||||||
}
|
return result;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## No assignments in conditions
|
## No assignments in conditions
|
||||||
|
|
||||||
To increase readability and reduce complexity of conditionals, we avoid
|
To increase readability and reduce complexity of conditionals, we avoid
|
||||||
assigning variables within if/while conditions. We frown upon this style:
|
assigning variables within if/while conditions. We frown upon this style:
|
||||||
|
|
||||||
if((ptr = malloc(100)) == NULL)
|
```c
|
||||||
return NULL;
|
if((ptr = malloc(100)) == NULL)
|
||||||
|
return NULL;
|
||||||
|
```
|
||||||
|
|
||||||
and instead we encourage the above version to be spelled out more clearly:
|
and instead we encourage the above version to be spelled out more clearly:
|
||||||
|
|
||||||
ptr = malloc(100);
|
```c
|
||||||
if(!ptr)
|
ptr = malloc(100);
|
||||||
return NULL;
|
if(!ptr)
|
||||||
|
return NULL;
|
||||||
|
```
|
||||||
|
|
||||||
## New block on a new line
|
## New block on a new line
|
||||||
|
|
||||||
We never write multiple statements on the same source line, even for very
|
We never write multiple statements on the same source line, even for very
|
||||||
short if() conditions.
|
short if() conditions.
|
||||||
|
|
||||||
if(a)
|
```c
|
||||||
return TRUE;
|
if(a)
|
||||||
else if(b)
|
return TRUE;
|
||||||
return FALSE;
|
else if(b)
|
||||||
|
return FALSE;
|
||||||
|
```
|
||||||
|
|
||||||
and NEVER:
|
and NEVER:
|
||||||
|
|
||||||
if(a) return TRUE;
|
```c
|
||||||
else if(b) return FALSE;
|
if(a) return TRUE;
|
||||||
|
else if(b) return FALSE;
|
||||||
|
```
|
||||||
|
|
||||||
## Space around operators
|
## Space around operators
|
||||||
|
|
||||||
@ -155,33 +179,39 @@ have no space.
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
bla = func();
|
```c
|
||||||
who = name[0];
|
bla = func();
|
||||||
age += 1;
|
who = name[0];
|
||||||
true = !false;
|
age += 1;
|
||||||
size += -2 + 3 * (a + b);
|
true = !false;
|
||||||
ptr->member = a++;
|
size += -2 + 3 * (a + b);
|
||||||
struct.field = b--;
|
ptr->member = a++;
|
||||||
ptr = &address;
|
struct.field = b--;
|
||||||
contents = *pointer;
|
ptr = &address;
|
||||||
complement = ~bits;
|
contents = *pointer;
|
||||||
empty = (!*string) ? TRUE : FALSE;
|
complement = ~bits;
|
||||||
|
empty = (!*string) ? TRUE : FALSE;
|
||||||
|
```
|
||||||
|
|
||||||
## No parentheses for return values
|
## No parentheses for return values
|
||||||
|
|
||||||
We use the 'return' statement without extra parentheses around the value:
|
We use the 'return' statement without extra parentheses around the value:
|
||||||
|
|
||||||
int works(void)
|
```c
|
||||||
{
|
int works(void)
|
||||||
return TRUE;
|
{
|
||||||
}
|
return TRUE;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Parentheses for sizeof arguments
|
## Parentheses for sizeof arguments
|
||||||
|
|
||||||
When using the sizeof operator in code, we prefer it to be written with
|
When using the sizeof operator in code, we prefer it to be written with
|
||||||
parentheses around its argument:
|
parentheses around its argument:
|
||||||
|
|
||||||
int size = sizeof(int);
|
```c
|
||||||
|
int size = sizeof(int);
|
||||||
|
```
|
||||||
|
|
||||||
## Column alignment
|
## Column alignment
|
||||||
|
|
||||||
@ -195,32 +225,40 @@ the statement it is. Operators should not start continuation lines. In other
|
|||||||
cases follow the 2-space indent guideline. Here are some examples from
|
cases follow the 2-space indent guideline. Here are some examples from
|
||||||
libcurl:
|
libcurl:
|
||||||
|
|
||||||
if(Curl_pipeline_wanted(handle->multi, CURLPIPE_HTTP1) &&
|
```c
|
||||||
(handle->set.httpversion != CURL_HTTP_VERSION_1_0) &&
|
if(Curl_pipeline_wanted(handle->multi, CURLPIPE_HTTP1) &&
|
||||||
(handle->set.httpreq == HTTPREQ_GET ||
|
(handle->set.httpversion != CURL_HTTP_VERSION_1_0) &&
|
||||||
handle->set.httpreq == HTTPREQ_HEAD))
|
(handle->set.httpreq == HTTPREQ_GET ||
|
||||||
/* didn't ask for HTTP/1.0 and a GET or HEAD */
|
handle->set.httpreq == HTTPREQ_HEAD))
|
||||||
return TRUE;
|
/* didn't ask for HTTP/1.0 and a GET or HEAD */
|
||||||
|
return TRUE;
|
||||||
|
```
|
||||||
|
|
||||||
If no parenthesis, use the default indent:
|
If no parenthesis, use the default indent:
|
||||||
|
|
||||||
data->set.http_disable_hostname_check_before_authentication =
|
```c
|
||||||
(0 != va_arg(param, long)) ? TRUE : FALSE;
|
data->set.http_disable_hostname_check_before_authentication =
|
||||||
|
(0 != va_arg(param, long)) ? TRUE : FALSE;
|
||||||
|
```
|
||||||
|
|
||||||
Function invoke with an open parenthesis:
|
Function invoke with an open parenthesis:
|
||||||
|
|
||||||
if(option) {
|
```c
|
||||||
result = parse_login_details(option, strlen(option),
|
if(option) {
|
||||||
(userp ? &user : NULL),
|
result = parse_login_details(option, strlen(option),
|
||||||
(passwdp ? &passwd : NULL),
|
(userp ? &user : NULL),
|
||||||
NULL);
|
(passwdp ? &passwd : NULL),
|
||||||
}
|
NULL);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Align with the "current open" parenthesis:
|
Align with the "current open" parenthesis:
|
||||||
|
|
||||||
DEBUGF(infof(data, "Curl_pp_readresp_ %d bytes of trailing "
|
```c
|
||||||
"server response left\n",
|
DEBUGF(infof(data, "Curl_pp_readresp_ %d bytes of trailing "
|
||||||
(int)clipamount));
|
"server response left\n",
|
||||||
|
(int)clipamount));
|
||||||
|
```
|
||||||
|
|
||||||
## Platform dependent code
|
## Platform dependent code
|
||||||
|
|
||||||
@ -234,32 +272,38 @@ to constants when libcurl is built without that feature, to make the code
|
|||||||
seamless. Like this example where the **magic()** function works differently
|
seamless. Like this example where the **magic()** function works differently
|
||||||
depending on a build-time conditional:
|
depending on a build-time conditional:
|
||||||
|
|
||||||
#ifdef HAVE_MAGIC
|
```c
|
||||||
void magic(int a)
|
#ifdef HAVE_MAGIC
|
||||||
{
|
void magic(int a)
|
||||||
return a + 2;
|
{
|
||||||
}
|
return a + 2;
|
||||||
#else
|
}
|
||||||
#define magic(x) 1
|
#else
|
||||||
#endif
|
#define magic(x) 1
|
||||||
|
#endif
|
||||||
|
|
||||||
int content = magic(3);
|
int content = magic(3);
|
||||||
|
```
|
||||||
|
|
||||||
## No typedefed structs
|
## No typedefed structs
|
||||||
|
|
||||||
Use structs by all means, but do not typedef them. Use the `struct name` way
|
Use structs by all means, but do not typedef them. Use the `struct name` way
|
||||||
of identifying them:
|
of identifying them:
|
||||||
|
|
||||||
struct something {
|
```c
|
||||||
void *valid;
|
struct something {
|
||||||
size_t way_to_write;
|
void *valid;
|
||||||
};
|
size_t way_to_write;
|
||||||
struct something instance;
|
};
|
||||||
|
struct something instance;
|
||||||
|
```
|
||||||
|
|
||||||
**Not okay**:
|
**Not okay**:
|
||||||
|
|
||||||
typedef struct {
|
```c
|
||||||
void *wrong;
|
typedef struct {
|
||||||
size_t way_to_write;
|
void *wrong;
|
||||||
} something;
|
size_t way_to_write;
|
||||||
something instance;
|
} something;
|
||||||
|
something instance;
|
||||||
|
```
|
||||||
|
@ -11,7 +11,9 @@ without using the dedicated dynbuf API.
|
|||||||
|
|
||||||
## init
|
## init
|
||||||
|
|
||||||
void Curl_dyn_init(struct dynbuf *s, size_t toobig);
|
```c
|
||||||
|
void Curl_dyn_init(struct dynbuf *s, size_t toobig);
|
||||||
|
```
|
||||||
|
|
||||||
This inits a struct to use for dynbuf and it can't fail. The `toobig` value
|
This inits a struct to use for dynbuf and it can't fail. The `toobig` value
|
||||||
**must** be set to the maximum size we allow this buffer instance to grow to.
|
**must** be set to the maximum size we allow this buffer instance to grow to.
|
||||||
@ -19,44 +21,58 @@ The functions below will return `CURLE_OUT_OF_MEMORY` when hitting this limit.
|
|||||||
|
|
||||||
## free
|
## free
|
||||||
|
|
||||||
void Curl_dyn_free(struct dynbuf *s);
|
```c
|
||||||
|
void Curl_dyn_free(struct dynbuf *s);
|
||||||
|
```
|
||||||
|
|
||||||
Free the associated memory and clean up. After a free, the `dynbuf` struct can
|
Free the associated memory and clean up. After a free, the `dynbuf` struct can
|
||||||
be re-used to start appending new data to.
|
be re-used to start appending new data to.
|
||||||
|
|
||||||
## addn
|
## addn
|
||||||
|
|
||||||
CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len);
|
```c
|
||||||
|
CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len);
|
||||||
|
```
|
||||||
|
|
||||||
Append arbitrary data of a given length to the end of the buffer.
|
Append arbitrary data of a given length to the end of the buffer.
|
||||||
|
|
||||||
## add
|
## add
|
||||||
|
|
||||||
CURLcode Curl_dyn_add(struct dynbuf *s, const char *str);
|
```c
|
||||||
|
CURLcode Curl_dyn_add(struct dynbuf *s, const char *str);
|
||||||
|
```
|
||||||
|
|
||||||
Append a C string to the end of the buffer.
|
Append a C string to the end of the buffer.
|
||||||
|
|
||||||
## addf
|
## addf
|
||||||
|
|
||||||
CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...);
|
```c
|
||||||
|
CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...);
|
||||||
|
```
|
||||||
|
|
||||||
Append a `printf()`-style string to the end of the buffer.
|
Append a `printf()`-style string to the end of the buffer.
|
||||||
|
|
||||||
## vaddf
|
## vaddf
|
||||||
|
|
||||||
CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap);
|
```c
|
||||||
|
CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap);
|
||||||
|
```
|
||||||
|
|
||||||
Append a `vprintf()`-style string to the end of the buffer.
|
Append a `vprintf()`-style string to the end of the buffer.
|
||||||
|
|
||||||
## reset
|
## reset
|
||||||
|
|
||||||
void Curl_dyn_reset(struct dynbuf *s);
|
```c
|
||||||
|
void Curl_dyn_reset(struct dynbuf *s);
|
||||||
|
```
|
||||||
|
|
||||||
Reset the buffer length, but leave the allocation.
|
Reset the buffer length, but leave the allocation.
|
||||||
|
|
||||||
## tail
|
## tail
|
||||||
|
|
||||||
CURLcode Curl_dyn_tail(struct dynbuf *s, size_t length)
|
```c
|
||||||
|
CURLcode Curl_dyn_tail(struct dynbuf *s, size_t length);
|
||||||
|
```
|
||||||
|
|
||||||
Keep `length` bytes of the buffer tail (the last `length` bytes of the
|
Keep `length` bytes of the buffer tail (the last `length` bytes of the
|
||||||
buffer). The rest of the buffer is dropped. The specified `length` must not be
|
buffer). The rest of the buffer is dropped. The specified `length` must not be
|
||||||
@ -64,7 +80,9 @@ larger than the buffer length.
|
|||||||
|
|
||||||
## ptr
|
## ptr
|
||||||
|
|
||||||
char *Curl_dyn_ptr(const struct dynbuf *s);
|
```c
|
||||||
|
char *Curl_dyn_ptr(const struct dynbuf *s);
|
||||||
|
```
|
||||||
|
|
||||||
Returns a `char *` to the buffer if it has a length, otherwise a NULL. Since
|
Returns a `char *` to the buffer if it has a length, otherwise a NULL. Since
|
||||||
the buffer may be reallocated, this pointer should not be trusted or used
|
the buffer may be reallocated, this pointer should not be trusted or used
|
||||||
@ -72,7 +90,9 @@ anymore after the next buffer manipulation call.
|
|||||||
|
|
||||||
## uptr
|
## uptr
|
||||||
|
|
||||||
unsigned char *Curl_dyn_uptr(const struct dynbuf *s);
|
```c
|
||||||
|
unsigned char *Curl_dyn_uptr(const struct dynbuf *s);
|
||||||
|
```
|
||||||
|
|
||||||
Returns an `unsigned char *` to the buffer if it has a length, otherwise a
|
Returns an `unsigned char *` to the buffer if it has a length, otherwise a
|
||||||
NULL. Since the buffer may be reallocated, this pointer should not be trusted
|
NULL. Since the buffer may be reallocated, this pointer should not be trusted
|
||||||
@ -80,7 +100,9 @@ or used anymore after the next buffer manipulation call.
|
|||||||
|
|
||||||
## len
|
## len
|
||||||
|
|
||||||
size_t Curl_dyn_len(const struct dynbuf *s);
|
```c
|
||||||
|
size_t Curl_dyn_len(const struct dynbuf *s);
|
||||||
|
```
|
||||||
|
|
||||||
Returns the length of the buffer in bytes. Does not include the terminating
|
Returns the length of the buffer in bytes. Does not include the terminating
|
||||||
zero byte.
|
zero byte.
|
||||||
|
@ -148,7 +148,9 @@ debug multithreaded dynamic C runtime.
|
|||||||
|
|
||||||
Make sure that MinGW32's bin dir is in the search path, for example:
|
Make sure that MinGW32's bin dir is in the search path, for example:
|
||||||
|
|
||||||
set PATH=c:\mingw32\bin;%PATH%
|
```cmd
|
||||||
|
set PATH=c:\mingw32\bin;%PATH%
|
||||||
|
```
|
||||||
|
|
||||||
then run `mingw32-make mingw32` in the root dir. There are other
|
then run `mingw32-make mingw32` in the root dir. There are other
|
||||||
make targets available to build libcurl with more features, use:
|
make targets available to build libcurl with more features, use:
|
||||||
@ -164,20 +166,26 @@ to verify that the provided `Makefile.m32` files use the proper paths, and
|
|||||||
adjust as necessary. It is also possible to override these paths with
|
adjust as necessary. It is also possible to override these paths with
|
||||||
environment variables, for example:
|
environment variables, for example:
|
||||||
|
|
||||||
set ZLIB_PATH=c:\zlib-1.2.8
|
```cmd
|
||||||
set OPENSSL_PATH=c:\openssl-1.0.2c
|
set ZLIB_PATH=c:\zlib-1.2.8
|
||||||
set LIBSSH2_PATH=c:\libssh2-1.6.0
|
set OPENSSL_PATH=c:\openssl-1.0.2c
|
||||||
|
set LIBSSH2_PATH=c:\libssh2-1.6.0
|
||||||
|
```
|
||||||
|
|
||||||
It is also possible to build with other LDAP SDKs than MS LDAP; currently
|
It is also possible to build with other LDAP SDKs than MS LDAP; currently
|
||||||
it is possible to build with native Win32 OpenLDAP, or with the Novell CLDAP
|
it is possible to build with native Win32 OpenLDAP, or with the Novell CLDAP
|
||||||
SDK. If you want to use these you need to set these vars:
|
SDK. If you want to use these you need to set these vars:
|
||||||
|
|
||||||
set LDAP_SDK=c:\openldap
|
```cmd
|
||||||
set USE_LDAP_OPENLDAP=1
|
set LDAP_SDK=c:\openldap
|
||||||
|
set USE_LDAP_OPENLDAP=1
|
||||||
|
```
|
||||||
|
|
||||||
or for using the Novell SDK:
|
or for using the Novell SDK:
|
||||||
|
|
||||||
set USE_LDAP_NOVELL=1
|
```cmd
|
||||||
|
set USE_LDAP_NOVELL=1
|
||||||
|
```
|
||||||
|
|
||||||
If you want to enable LDAPS support then set LDAPS=1.
|
If you want to enable LDAPS support then set LDAPS=1.
|
||||||
|
|
||||||
@ -280,9 +288,11 @@ the same curl binary is executed on older cats. For example, running these
|
|||||||
commands in curl's directory in the shell will build the code such that it
|
commands in curl's directory in the shell will build the code such that it
|
||||||
will run on cats as old as OS X 10.6 ("Snow Leopard") (using bash):
|
will run on cats as old as OS X 10.6 ("Snow Leopard") (using bash):
|
||||||
|
|
||||||
export MACOSX_DEPLOYMENT_TARGET="10.6"
|
```bash
|
||||||
./configure --with-secure-transport
|
export MACOSX_DEPLOYMENT_TARGET="10.6"
|
||||||
make
|
./configure --with-secure-transport
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
# Android
|
# Android
|
||||||
|
|
||||||
@ -295,16 +305,18 @@ where it has been installed and then set up some environment variables before
|
|||||||
launching `configure`. On macOS, those variables could look like this to compile
|
launching `configure`. On macOS, those variables could look like this to compile
|
||||||
for `aarch64` and API level 29:
|
for `aarch64` and API level 29:
|
||||||
|
|
||||||
export NDK=~/Library/Android/sdk/ndk/20.1.5948944
|
```bash
|
||||||
export HOST_TAG=darwin-x86_64
|
export NDK=~/Library/Android/sdk/ndk/20.1.5948944
|
||||||
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG
|
export HOST_TAG=darwin-x86_64
|
||||||
export AR=$TOOLCHAIN/bin/aarch64-linux-android-ar
|
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG
|
||||||
export AS=$TOOLCHAIN/bin/aarch64-linux-android-as
|
export AR=$TOOLCHAIN/bin/aarch64-linux-android-ar
|
||||||
export CC=$TOOLCHAIN/bin/aarch64-linux-android29-clang
|
export AS=$TOOLCHAIN/bin/aarch64-linux-android-as
|
||||||
export CXX=$TOOLCHAIN/bin/aarch64-linux-android29-clang++
|
export CC=$TOOLCHAIN/bin/aarch64-linux-android29-clang
|
||||||
export LD=$TOOLCHAIN/bin/aarch64-linux-android-ld
|
export CXX=$TOOLCHAIN/bin/aarch64-linux-android29-clang++
|
||||||
export RANLIB=$TOOLCHAIN/bin/aarch64-linux-android-ranlib
|
export LD=$TOOLCHAIN/bin/aarch64-linux-android-ld
|
||||||
export STRIP=$TOOLCHAIN/bin/aarch64-linux-android-strip
|
export RANLIB=$TOOLCHAIN/bin/aarch64-linux-android-ranlib
|
||||||
|
export STRIP=$TOOLCHAIN/bin/aarch64-linux-android-strip
|
||||||
|
```
|
||||||
|
|
||||||
When building on Linux or targeting other API levels or architectures, you need
|
When building on Linux or targeting other API levels or architectures, you need
|
||||||
to adjust those variables accordingly. After that you can build curl like this:
|
to adjust those variables accordingly. After that you can build curl like this:
|
||||||
@ -337,22 +349,24 @@ configure with any options you need. Be sure and specify the `--host` and
|
|||||||
example of cross-compiling for the IBM 405GP PowerPC processor using the
|
example of cross-compiling for the IBM 405GP PowerPC processor using the
|
||||||
toolchain from MonteVista for Hardhat Linux.
|
toolchain from MonteVista for Hardhat Linux.
|
||||||
|
|
||||||
#! /bin/sh
|
```bash
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin
|
export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin
|
||||||
export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include"
|
export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include"
|
||||||
export AR=ppc_405-ar
|
export AR=ppc_405-ar
|
||||||
export AS=ppc_405-as
|
export AS=ppc_405-as
|
||||||
export LD=ppc_405-ld
|
export LD=ppc_405-ld
|
||||||
export RANLIB=ppc_405-ranlib
|
export RANLIB=ppc_405-ranlib
|
||||||
export CC=ppc_405-gcc
|
export CC=ppc_405-gcc
|
||||||
export NM=ppc_405-nm
|
export NM=ppc_405-nm
|
||||||
|
|
||||||
./configure --target=powerpc-hardhat-linux
|
./configure --target=powerpc-hardhat-linux
|
||||||
--host=powerpc-hardhat-linux
|
--host=powerpc-hardhat-linux
|
||||||
--build=i586-pc-linux-gnu
|
--build=i586-pc-linux-gnu
|
||||||
--prefix=/opt/hardhat/devkit/ppc/405/target/usr/local
|
--prefix=/opt/hardhat/devkit/ppc/405/target/usr/local
|
||||||
--exec-prefix=/usr/local
|
--exec-prefix=/usr/local
|
||||||
|
```
|
||||||
|
|
||||||
You may also need to provide a parameter like `--with-random=/dev/urandom` to
|
You may also need to provide a parameter like `--with-random=/dev/urandom` to
|
||||||
configure as it cannot detect the presence of a random number generating
|
configure as it cannot detect the presence of a random number generating
|
||||||
|
@ -773,7 +773,9 @@ Track Down Memory Leaks
|
|||||||
|
|
||||||
Add a line in your application code:
|
Add a line in your application code:
|
||||||
|
|
||||||
`curl_dbg_memdebug("dump");`
|
```c
|
||||||
|
curl_dbg_memdebug("dump");
|
||||||
|
```
|
||||||
|
|
||||||
This will make the malloc debug system output a full trace of all resource
|
This will make the malloc debug system output a full trace of all resource
|
||||||
using functions to the given file name. Make sure you rebuild your program
|
using functions to the given file name. Make sure you rebuild your program
|
||||||
|
@ -307,12 +307,14 @@ Example:
|
|||||||
|
|
||||||
(page located at `http://www.formpost.com/getthis/`)
|
(page located at `http://www.formpost.com/getthis/`)
|
||||||
|
|
||||||
<form action="post.cgi" method="post">
|
```html
|
||||||
<input name=user size=10>
|
<form action="post.cgi" method="post">
|
||||||
<input name=pass type=password size=10>
|
<input name=user size=10>
|
||||||
<input name=id type=hidden value="blablabla">
|
<input name=pass type=password size=10>
|
||||||
<input name=ding value="submit">
|
<input name=id type=hidden value="blablabla">
|
||||||
</form>
|
<input name=ding value="submit">
|
||||||
|
</form>
|
||||||
|
```
|
||||||
|
|
||||||
We want to enter user 'foobar' with password '12345'.
|
We want to enter user 'foobar' with password '12345'.
|
||||||
|
|
||||||
@ -419,7 +421,9 @@ if it should be used on secure connections only (`secure`).
|
|||||||
|
|
||||||
If you've received a page from a server that contains a header like:
|
If you've received a page from a server that contains a header like:
|
||||||
|
|
||||||
Set-Cookie: sessionid=boo123; path="/foo";
|
```http
|
||||||
|
Set-Cookie: sessionid=boo123; path="/foo";
|
||||||
|
```
|
||||||
|
|
||||||
it means the server wants that first pair passed on when we get anything in a
|
it means the server wants that first pair passed on when we get anything in a
|
||||||
path beginning with "/foo".
|
path beginning with "/foo".
|
||||||
|
@ -222,10 +222,12 @@
|
|||||||
|
|
||||||
A GET-form uses the method GET, as specified in HTML like:
|
A GET-form uses the method GET, as specified in HTML like:
|
||||||
|
|
||||||
<form method="GET" action="junk.cgi">
|
```html
|
||||||
<input type=text name="birthyear">
|
<form method="GET" action="junk.cgi">
|
||||||
<input type=submit name=press value="OK">
|
<input type=text name="birthyear">
|
||||||
</form>
|
<input type=submit name=press value="OK">
|
||||||
|
</form>
|
||||||
|
```
|
||||||
|
|
||||||
In your favorite browser, this form will appear with a text box to fill in
|
In your favorite browser, this form will appear with a text box to fill in
|
||||||
and a press-button labeled "OK". If you fill in '1905' and press the OK
|
and a press-button labeled "OK". If you fill in '1905' and press the OK
|
||||||
@ -258,10 +260,12 @@
|
|||||||
|
|
||||||
The form would look very similar to the previous one:
|
The form would look very similar to the previous one:
|
||||||
|
|
||||||
<form method="POST" action="junk.cgi">
|
```html
|
||||||
<input type=text name="birthyear">
|
<form method="POST" action="junk.cgi">
|
||||||
<input type=submit name=press value=" OK ">
|
<input type=text name="birthyear">
|
||||||
</form>
|
<input type=submit name=press value=" OK ">
|
||||||
|
</form>
|
||||||
|
```
|
||||||
|
|
||||||
And to use curl to post this form with the same data filled in as before, we
|
And to use curl to post this form with the same data filled in as before, we
|
||||||
could do it like:
|
could do it like:
|
||||||
@ -293,10 +297,12 @@
|
|||||||
This method is mainly designed to better support file uploads. A form that
|
This method is mainly designed to better support file uploads. A form that
|
||||||
allows a user to upload a file could be written like this in HTML:
|
allows a user to upload a file could be written like this in HTML:
|
||||||
|
|
||||||
<form method="POST" enctype='multipart/form-data' action="upload.cgi">
|
```html
|
||||||
<input type=file name=upload>
|
<form method="POST" enctype='multipart/form-data' action="upload.cgi">
|
||||||
<input type=submit name=press value="OK">
|
<input type=file name=upload>
|
||||||
</form>
|
<input type=submit name=press value="OK">
|
||||||
|
</form>
|
||||||
|
```
|
||||||
|
|
||||||
This clearly shows that the Content-Type about to be sent is
|
This clearly shows that the Content-Type about to be sent is
|
||||||
`multipart/form-data`.
|
`multipart/form-data`.
|
||||||
@ -315,11 +321,13 @@
|
|||||||
A similar example form with one visible field, one hidden field and one
|
A similar example form with one visible field, one hidden field and one
|
||||||
submit button could look like:
|
submit button could look like:
|
||||||
|
|
||||||
<form method="POST" action="foobar.cgi">
|
```html
|
||||||
<input type=text name="birthyear">
|
<form method="POST" action="foobar.cgi">
|
||||||
<input type=hidden name="person" value="daniel">
|
<input type=text name="birthyear">
|
||||||
<input type=submit name="press" value="OK">
|
<input type=hidden name="person" value="daniel">
|
||||||
</form>
|
<input type=submit name="press" value="OK">
|
||||||
|
</form>
|
||||||
|
```
|
||||||
|
|
||||||
To POST this with curl, you won't have to think about if the fields are
|
To POST this with curl, you won't have to think about if the fields are
|
||||||
hidden or not. To curl they're all the same:
|
hidden or not. To curl they're all the same:
|
||||||
@ -383,7 +391,7 @@
|
|||||||
may require its own user and password to allow the client to get through to
|
may require its own user and password to allow the client to get through to
|
||||||
the Internet. To specify those with curl, run something like:
|
the Internet. To specify those with curl, run something like:
|
||||||
|
|
||||||
curl --proxy-user proxyuser:proxypassword curl.se
|
curl --proxy-user proxyuser:proxypassword curl.se
|
||||||
|
|
||||||
If your proxy requires the authentication to be done using the NTLM method,
|
If your proxy requires the authentication to be done using the NTLM method,
|
||||||
use [`--proxy-ntlm`](https://curl.se/docs/manpage.html#--proxy-ntlm), if
|
use [`--proxy-ntlm`](https://curl.se/docs/manpage.html#--proxy-ntlm), if
|
||||||
|
@ -41,7 +41,9 @@ Version Numbers and Releases
|
|||||||
numbering scheme that can be used for comparison. The version number is
|
numbering scheme that can be used for comparison. The version number is
|
||||||
defined as:
|
defined as:
|
||||||
|
|
||||||
#define LIBCURL_VERSION_NUM 0xXXYYZZ
|
```c
|
||||||
|
#define LIBCURL_VERSION_NUM 0xXXYYZZ
|
||||||
|
```
|
||||||
|
|
||||||
Where XX, YY and ZZ are the main version, release and patch numbers in
|
Where XX, YY and ZZ are the main version, release and patch numbers in
|
||||||
hexadecimal. All three number fields are always represented using two digits
|
hexadecimal. All three number fields are always represented using two digits
|
||||||
|
Loading…
Reference in New Issue
Block a user