aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib505.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-04-03 11:57:34 +0200
committerDaniel Stenberg <daniel@haxx.se>2016-04-03 11:57:34 +0200
commit365322b8bcf9efb6a361473d227b70f2032212ce (patch)
tree1c6aa49fce74e802ac29e33098abf4c81ed4836b /tests/libtest/lib505.c
parentc7e4266a2e52d0dd0ad446044174c60ebfe10f73 (diff)
tests/libtest: follow our code style guidelines better
... checksrc of all test code is pending.
Diffstat (limited to 'tests/libtest/lib505.c')
-rw-r--r--tests/libtest/lib505.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c
index 79c3bc79b..127fde77e 100644
--- a/tests/libtest/lib505.c
+++ b/tests/libtest/lib505.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -38,8 +38,8 @@ int test(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
- FILE *hd_src ;
- int hd ;
+ FILE *hd_src;
+ int hd;
struct_stat file_info;
struct curl_slist *hl;
int error;
@@ -48,7 +48,7 @@ int test(char *URL)
const char *buf_1 = "RNFR 505";
const char *buf_2 = "RNTO 505-forreal";
- if (!libtest_arg2) {
+ if(!libtest_arg2) {
fprintf(stderr, "Usage: <url> <file-to-upload>\n");
return TEST_ERR_USAGE;
}
@@ -56,7 +56,7 @@ int test(char *URL)
hd_src = fopen(libtest_arg2, "rb");
if(NULL == hd_src) {
error = ERRNO;
- fprintf(stderr, "fopen() failed with error: %d %s\n",
+ fprintf(stderr, "fopen failed with error: %d %s\n",
error, strerror(error));
fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
@@ -80,14 +80,15 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+ if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
fclose(hd_src);
return TEST_ERR_MAJOR_BAD;
}
/* get a curl handle */
- if ((curl = curl_easy_init()) == NULL) {
+ curl = curl_easy_init();
+ if(!curl) {
fprintf(stderr, "curl_easy_init() failed\n");
curl_global_cleanup();
fclose(hd_src);
@@ -96,14 +97,16 @@ int test(char *URL)
/* build a list of commands to pass to libcurl */
- if ((hl = curl_slist_append(headerlist, buf_1)) == NULL) {
+ hl = curl_slist_append(headerlist, buf_1);
+ if(!hl) {
fprintf(stderr, "curl_slist_append() failed\n");
curl_easy_cleanup(curl);
curl_global_cleanup();
fclose(hd_src);
return TEST_ERR_MAJOR_BAD;
}
- if ((headerlist = curl_slist_append(hl, buf_2)) == NULL) {
+ headerlist = curl_slist_append(hl, buf_2);
+ if(!headerlist) {
fprintf(stderr, "curl_slist_append() failed\n");
curl_slist_free_all(hl);
curl_easy_cleanup(curl);
@@ -120,7 +123,7 @@ int test(char *URL)
test_setopt(curl, CURLOPT_VERBOSE, 1L);
/* specify target */
- test_setopt(curl,CURLOPT_URL, URL);
+ test_setopt(curl, CURLOPT_URL, URL);
/* pass in that last of FTP commands to run after the transfer */
test_setopt(curl, CURLOPT_POSTQUOTE, headerlist);