aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/cookie_interface.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-02-11 09:42:38 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-02-11 09:44:45 +0100
commit3a6563d668406df1703edb4202afc038fcf9d30e (patch)
tree0fbb9438d99c13049f72b10c966583e582e4e238 /docs/examples/cookie_interface.c
parent936d8f07dfbf2ac22ffd216f5363152bcecc2651 (diff)
examples: adhere to curl code style
All plain C examples now (mostly) adhere to the curl code style. While they are only examples, they had diverted so much and contained all sorts of different mixed code styles by now. Having them use a unified style helps users and readability. Also, as they get copy-and-pasted widely by users, making sure they're clean and nice is a good idea. 573 checksrc warnings were addressed.
Diffstat (limited to 'docs/examples/cookie_interface.c')
-rw-r--r--docs/examples/cookie_interface.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/examples/cookie_interface.c b/docs/examples/cookie_interface.c
index 5181f3fd0..064c7b329 100644
--- a/docs/examples/cookie_interface.c
+++ b/docs/examples/cookie_interface.c
@@ -42,18 +42,18 @@ print_cookies(CURL *curl)
printf("Cookies, curl knows:\n");
res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
- if (res != CURLE_OK) {
+ if(res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_getinfo failed: %s\n",
curl_easy_strerror(res));
exit(1);
}
nc = cookies, i = 1;
- while (nc) {
+ while(nc) {
printf("[%d]: %s\n", i, nc->data);
nc = nc->next;
i++;
}
- if (i == 1) {
+ if(i == 1) {
printf("(none)\n");
}
curl_slist_free_all(cookies);
@@ -67,14 +67,14 @@ main(void)
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
- if (curl) {
+ if(curl) {
char nline[256];
curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* start cookie engine */
res = curl_easy_perform(curl);
- if (res != CURLE_OK) {
+ if(res != CURLE_OK) {
fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res));
return 1;
}
@@ -97,7 +97,7 @@ main(void)
(unsigned long)time(NULL) + 31337UL,
"PREF", "hello google, i like you very much!");
res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline);
- if (res != CURLE_OK) {
+ if(res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_setopt failed: %s\n",
curl_easy_strerror(res));
return 1;
@@ -113,7 +113,7 @@ main(void)
"Set-Cookie: OLD_PREF=3d141414bf4209321; "
"expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com");
res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline);
- if (res != CURLE_OK) {
+ if(res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_setopt failed: %s\n",
curl_easy_strerror(res));
return 1;
@@ -122,7 +122,7 @@ main(void)
print_cookies(curl);
res = curl_easy_perform(curl);
- if (res != CURLE_OK) {
+ if(res != CURLE_OK) {
fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res));
return 1;
}