]> granicus.if.org Git - curl/commitdiff
curl: remove tool_writeenv.[ch]
authorDaniel Stenberg <daniel@haxx.se>
Wed, 3 May 2017 12:28:40 +0000 (14:28 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 6 May 2017 21:13:08 +0000 (23:13 +0200)
... and USE_ENVIRONMENT and --environment. It was once added for RISC OS
support and its platform specific behavior has been annoying ever
since. Added in commit c3c8bbd3b2688da8e, mostly unchanged since
then. Most probably not actually used for years.

Closes #1463

docs/cmdline-opts/Makefile.inc
docs/cmdline-opts/environment.d [deleted file]
src/Makefile.inc
src/makefile.dj
src/tool_cfgable.h
src/tool_getparam.c
src/tool_help.c
src/tool_operate.c
src/tool_writeenv.c [deleted file]
src/tool_writeenv.h [deleted file]

index 97c0547eee28670c97bfd82565156abfbda05f48..4577fac7c7ef95f4ad6de9635766adadcead8919 100644 (file)
@@ -7,7 +7,7 @@ DPAGES = abstract-unix-socket.d anyauth.d append.d basic.d cacert.d capath.d cer
   data-raw.d data-urlencode.d delegation.d digest.d disable.d           \
   disable-eprt.d disable-epsv.d dns-interface.d dns-ipv4-addr.d         \
   dns-ipv6-addr.d dns-servers.d dump-header.d egd-file.d engine.d       \
-  environment.d expect100-timeout.d fail.d fail-early.d false-start.d   \
+  expect100-timeout.d fail.d fail-early.d false-start.d                 \
   form.d form-string.d ftp-account.d ftp-alternative-to-user.d          \
   ftp-create-dirs.d ftp-method.d ftp-pasv.d ftp-port.d ftp-pret.d       \
   ftp-skip-pasv-ip.d ftp-ssl-ccc.d ftp-ssl-ccc-mode.d ftp-ssl-control.d \
diff --git a/docs/cmdline-opts/environment.d b/docs/cmdline-opts/environment.d
deleted file mode 100644 (file)
index 6289e53..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-Long: environment
-Help: Write results to environment variables
-Requires: RISC OS
----
-Sets a range of environment variables, using the names the --write-out option
-supports, to allow easier extraction of useful information after having run
-curl.
index 2196ffa33e2a3996547a27151775f79d963ed712..5074f8fc6765a797655654b5459184ae4431cf4b 100644 (file)
@@ -58,7 +58,6 @@ CURL_CFILES = \
        tool_urlglob.c \
        tool_util.c \
        tool_vms.c \
-       tool_writeenv.c \
        tool_writeout.c \
        tool_xattr.c
 
@@ -103,7 +102,6 @@ CURL_HFILES = \
        tool_util.h \
        tool_version.h \
        tool_vms.h \
-       tool_writeenv.h \
        tool_writeout.h \
        tool_xattr.h
 
index c3bbc237fc96441e88aab219d89d44c1e47c5d3d..fbd2d3738c399e93bf50b39c8ac5de166a56866c 100644 (file)
@@ -53,8 +53,6 @@ endif
 
 EX_LIBS += $(WATT32_ROOT)/lib/libwatt.a
 
-CFLAGS += -DUSE_ENVIRONMENT
-
 PROGRAM  = curl.exe
 OBJECTS += $(addprefix $(OBJ_DIR)/, $(CSOURCES:.c=.o))
 
index b7fe1d340a8f1791de420dd9d4c43bc9e8202f73..38777f6fdbacd29994e347fb803a1b38c63e4308 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, 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
@@ -151,7 +151,6 @@ struct OperationConfig {
   bool proxybasic;
   bool proxyanyauth;
   char *writeout;           /* %-styled format string to output */
-  bool writeenv;            /* write results to environment, if available */
   struct curl_slist *quote;
   struct curl_slist *postquote;
   struct curl_slist *prequote;
index 315a9cf4a4e7b79a16dfa58d3147b0d023d28687..fde819e8d6aca114d65791bcd3d5f46cc5584508 100644 (file)
@@ -84,9 +84,6 @@ static const struct LongShort aliases[]= {
   {"*E", "epsv",                     ARG_BOOL},
          /* 'epsv' made like this to make --no-epsv and --epsv to work
              although --disable-epsv is the documented option */
-#ifdef USE_ENVIRONMENT
-  {"*f", "environment",              ARG_BOOL},
-#endif
   {"*F", "dns-servers",              ARG_STRING},
   {"*g", "trace",                    ARG_STRING},
   {"*G", "npn",                      ARG_BOOL},
@@ -562,11 +559,6 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       case 'E': /* --epsv */
         config->disable_epsv = (!toggle)?TRUE:FALSE;
         break;
-#ifdef USE_ENVIRONMENT
-      case 'f':
-        config->writeenv = toggle;
-        break;
-#endif
       case 'F': /* --dns-servers */
         /* IP addrs of DNS servers */
         GetStr(&config->dns_servers, nextarg);
index 86d35899ad4880beb1efd5c0ce0d193414985cd3..83a0276a1d849454030f3eb9d474f0d87cac67d8 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, 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
@@ -81,9 +81,6 @@ static const char *const helptext[] = {
   " -D, --dump-header FILE  Write the received headers to FILE",
   "     --egd-file FILE  EGD socket path for random data (SSL)",
   "     --engine ENGINE  Crypto engine (use \"--engine list\" for list) (SSL)",
-#ifdef USE_ENVIRONMENT
-  "     --environment   Write results to environment variables (RISC OS)",
-#endif
   "     --expect100-timeout SECONDS How long to wait for 100-continue (H)",
   " -f, --fail          Fail silently (no output at all) on HTTP errors (H)",
   "     --fail-early    Fail on first transfer error, do not continue",
index 5a129bd348968c7e2b175a1895f006cbfda1b3df..6f1525e8b1d3e215a07b9e22801131afc009e90c 100644 (file)
@@ -71,7 +71,6 @@
 #include "tool_sleep.h"
 #include "tool_urlglob.h"
 #include "tool_util.h"
-#include "tool_writeenv.h"
 #include "tool_writeout.h"
 #include "tool_xattr.h"
 #include "tool_vms.h"
@@ -1748,9 +1747,6 @@ static CURLcode operate_do(struct GlobalConfig *global,
         if(config->writeout)
           ourWriteOut(curl, &outs, config->writeout);
 
-        if(config->writeenv)
-          ourWriteEnv(curl);
-
         /*
         ** Code within this loop may jump directly here to label 'show_error'
         ** in order to display an error message for CURLcode stored in 'res'
diff --git a/src/tool_writeenv.c b/src/tool_writeenv.c
deleted file mode 100644 (file)
index 0bc075a..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * 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
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-#include "tool_setup.h"
-
-#ifdef USE_ENVIRONMENT
-
-#ifdef __riscos__
-#  include <kernel.h>
-#endif
-
-#include <curl/mprintf.h>
-#include "tool_writeenv.h"
-#include "memdebug.h" /* keep this as LAST include */
-
-static const struct
-{
-  const char *name;
-  CURLINFO id;
-  enum {
-    writeenv_NONE,
-    writeenv_DOUBLE,
-    writeenv_LONG,
-    writeenv_STRING
-  } type;
-} variables[14] =
-{
-  {"curl_url_effective", CURLINFO_EFFECTIVE_URL, writeenv_STRING},
-  {"curl_http_code", CURLINFO_RESPONSE_CODE, writeenv_LONG},
-  {"curl_time_total", CURLINFO_TOTAL_TIME, writeenv_DOUBLE},
-  {"curl_time_namelookup", CURLINFO_NAMELOOKUP_TIME, writeenv_DOUBLE},
-  {"curl_time_connect", CURLINFO_CONNECT_TIME, writeenv_DOUBLE},
-  {"curl_time_pretransfer", CURLINFO_PRETRANSFER_TIME, writeenv_DOUBLE},
-  {"curl_time_starttransfer", CURLINFO_STARTTRANSFER_TIME, writeenv_DOUBLE},
-  {"curl_size_header", CURLINFO_HEADER_SIZE, writeenv_LONG},
-  {"curl_size_request", CURLINFO_REQUEST_SIZE, writeenv_LONG},
-  {"curl_size_download", CURLINFO_SIZE_DOWNLOAD, writeenv_DOUBLE},
-  {"curl_size_upload", CURLINFO_SIZE_UPLOAD, writeenv_DOUBLE},
-  {"curl_speed_download", CURLINFO_SPEED_DOWNLOAD, writeenv_DOUBLE},
-  {"curl_speed_upload", CURLINFO_SPEED_UPLOAD, writeenv_DOUBLE},
-  {NULL, 0, writeenv_NONE}
- };
-
-static void internalSetEnv(const char *name, char *value)
-{
-  /* Add your OS-specific code here. */
-#ifdef __riscos__
-  _kernel_setenv(name, value);
-#elif defined (CURLDEBUG)
-  curl_memlog("ENV %s = %s\n", name, value);
-#endif
-  return;
-}
-
-void ourWriteEnv(CURL *curl)
-{
-  unsigned int i;
-  char *string, numtext[10];
-  long longinfo;
-  double doubleinfo;
-
-  for(i=0; variables[i].name; i++) {
-    switch(variables[i].type) {
-    case writeenv_STRING:
-      if(curl_easy_getinfo(curl, variables[i].id, &string) == CURLE_OK)
-        internalSetEnv(variables[i].name, string);
-      else
-        internalSetEnv(variables[i].name, NULL);
-      break;
-
-    case writeenv_LONG:
-      if(curl_easy_getinfo(curl, variables[i].id, &longinfo) == CURLE_OK) {
-        curl_msprintf(numtext, "%5ld", longinfo);
-        internalSetEnv(variables[i].name, numtext);
-      }
-      else
-        internalSetEnv(variables[i].name, NULL);
-      break;
-    case writeenv_DOUBLE:
-      if(curl_easy_getinfo(curl, variables[i].id, &doubleinfo) == CURLE_OK) {
-        curl_msprintf(numtext, "%6.2f", doubleinfo);
-        internalSetEnv(variables[i].name, numtext);
-      }
-      else
-        internalSetEnv(variables[i].name, NULL);
-      break;
-    default:
-      break;
-    }
-  }
-
-  return;
-}
-
-#endif
diff --git a/src/tool_writeenv.h b/src/tool_writeenv.h
deleted file mode 100644 (file)
index 55daf48..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef HEADER_CURL_TOOL_WRITEENV_H
-#define HEADER_CURL_TOOL_WRITEENV_H
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2012, 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
- * are also available at https://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-#include "tool_setup.h"
-
-#ifdef USE_ENVIRONMENT
-
-void ourWriteEnv(CURL *curl);
-
-#else
-#  define ourWriteEnv(x)  Curl_nop_stmt
-#endif
-
-#endif /* HEADER_CURL_TOOL_WRITEENV_H */
-