]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: remove first argument from helpf()
authorDaniel Stenberg <daniel@haxx.se>
Thu, 7 Aug 2025 14:12:44 +0000 (16:12 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 7 Aug 2025 14:55:39 +0000 (16:55 +0200)
It was always the same and it is a global already!

Closes #18221

src/tool_getparam.c
src/tool_ipfs.c
src/tool_msgs.c
src/tool_msgs.h
src/tool_operate.c

index 6a4490151125d6fa91c1b5705ff2dbd925c28dea..475cbd4927ec7f8f2714a1ed4399b52db84abfb3 100644 (file)
@@ -3066,9 +3066,9 @@ ParameterError parse_args(int argc, argv_item_t argv[])
     const char *reason = param2text(result);
 
     if(orig_opt && strcmp(":", orig_opt))
-      helpf(tool_stderr, "option %s: %s", orig_opt, reason);
+      helpf("option %s: %s", orig_opt, reason);
     else
-      helpf(tool_stderr, "%s", reason);
+      helpf("%s", reason);
   }
 
   unicodefree(orig_opt);
index 06c45cb572e0b4c09cf110d88804d494599177ac..dd030f09bc925a5874becc7d788b5cdcbcd7ffb6 100644 (file)
@@ -271,13 +271,13 @@ clean:
   {
     switch(result) {
     case CURLE_URL_MALFORMAT:
-      helpf(tool_stderr, "malformed target URL");
+      helpf("malformed target URL");
       break;
     case CURLE_FILE_COULDNT_READ_FILE:
-      helpf(tool_stderr, "IPFS automatic gateway detection failed");
+      helpf("IPFS automatic gateway detection failed");
       break;
     case CURLE_BAD_FUNCTION_ARGUMENT:
-      helpf(tool_stderr, "--ipfs-gateway was given a malformed URL");
+      helpf("--ipfs-gateway was given a malformed URL");
       break;
     default:
       break;
index 32479832a839d244eabf7cc8c7a1206a183f86aa..de0c1431e2a2084ef988ec4325e6c3b70d06b1e1 100644 (file)
@@ -113,18 +113,18 @@ void warnf(const char *fmt, ...)
  * Emit help formatted message on given stream. This is for errors with or
  * related to command line arguments.
  */
-void helpf(FILE *errors, const char *fmt, ...)
+void helpf(const char *fmt, ...)
 {
   if(fmt) {
     va_list ap;
     va_start(ap, fmt);
     DEBUGASSERT(!strchr(fmt, '\n'));
-    fputs("curl: ", errors); /* prefix it */
-    vfprintf(errors, fmt, ap);
+    fputs("curl: ", tool_stderr); /* prefix it */
+    vfprintf(tool_stderr, fmt, ap);
     va_end(ap);
-    fputs("\n", errors); /* newline it */
+    fputs("\n", tool_stderr); /* newline it */
   }
-  fprintf(errors, "curl: try 'curl --help' "
+  fprintf(tool_stderr, "curl: try 'curl --help' "
 #ifdef USE_MANUAL
           "or 'curl --manual' "
 #endif
index b1980a401c007dc2067e01338c8566be12b87c2e..99a980234a23aac03aac9b4ec61210c181921601 100644 (file)
@@ -30,8 +30,8 @@ void warnf(const char *fmt, ...)
   CURL_PRINTF(1, 2);
 void notef(const char *fmt, ...)
   CURL_PRINTF(1, 2);
-void helpf(FILE *errors, const char *fmt, ...)
-  CURL_PRINTF(2, 3);
+void helpf(const char *fmt, ...)
+  CURL_PRINTF(1, 2);
 void errorf(const char *fmt, ...)
   CURL_PRINTF(1, 2);
 
index 8fc289344ecaee9ddd206bacc052c5b5047ef7c9..ab1e898c98e6ccfd96ec8c043d09d70ffa71a549 100644 (file)
@@ -302,7 +302,7 @@ static CURLcode pre_transfer(struct per_transfer *per)
     if((per->infd == -1) || fstat(per->infd, &fileinfo))
 #endif
     {
-      helpf(tool_stderr, "cannot open '%s'", per->uploadfile);
+      helpf("cannot open '%s'", per->uploadfile);
       if(per->infd != -1) {
         close(per->infd);
         per->infd = STDIN_FILENO;
@@ -2082,7 +2082,7 @@ static CURLcode transfer_per_config(struct OperationConfig *config,
 
   /* Check we have a url */
   if(!config->url_list || !config->url_list->url) {
-    helpf(tool_stderr, "(%d) no URL specified", CURLE_FAILED_INIT);
+    helpf("(%d) no URL specified", CURLE_FAILED_INIT);
     return CURLE_FAILED_INIT;
   }
 
@@ -2205,7 +2205,7 @@ CURLcode operate(int argc, argv_item_t argv[])
 
     /* If we had no arguments then make sure a url was specified in .curlrc */
     if((argc < 2) && (!global->first->url_list)) {
-      helpf(tool_stderr, NULL);
+      helpf(NULL);
       result = CURLE_FAILED_INIT;
     }
   }