Commit 5513bbd5 authored by Steve Holme's avatar Steve Holme
Browse files

tool: Moved --stderr to the global config

parent 1f077181
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
{
  struct OperationConfig *operation = userdata;
  struct GlobalConfig *config = operation->global;
  FILE *output = operation->errors;
  FILE *output = config->errors;
  const char *text;
  struct timeval tv;
  struct tm *now;
@@ -77,7 +77,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
      config->trace_stream = stdout;
    else if(curlx_strequal("%", config->trace_dump))
      /* Ok, this is somewhat hackish but we do it undocumented for now */
      config->trace_stream = operation->errors;  /* aka stderr */
      config->trace_stream = config->errors;  /* aka stderr */
    else {
      config->trace_stream = fopen(config->trace_dump, "w");
      config->trace_fopened = TRUE;
+1 −1
Original line number Diff line number Diff line
@@ -146,5 +146,5 @@ void progressbarinit(struct ProgressData *bar,
  bar->width = scr_size[0] - 1;
#endif

  bar->out = config->errors;
  bar->out = config->global->errors;
}
+0 −5
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ void config_init(struct OperationConfig* config)
{
  memset(config, 0, sizeof(struct OperationConfig));

  config->errors = stderr; /* default errors to stderr */
  config->postfieldsize = -1;
  config->use_httpget = FALSE;
  config->create_dirs = FALSE;
@@ -116,10 +115,6 @@ static void free_config_fields(struct OperationConfig *config)

  Curl_safefree(config->writeout);

  if(config->errors_fopened && config->errors)
    fclose(config->errors);
  config->errors = NULL;

  curl_slist_free_all(config->quote);
  curl_slist_free_all(config->postquote);
  curl_slist_free_all(config->prequote);
+2 −2
Original line number Diff line number Diff line
@@ -138,8 +138,6 @@ struct OperationConfig {
  bool proxyanyauth;
  char *writeout;           /* %-styled format string to output */
  bool writeenv;            /* write results to environment, if available */
  FILE *errors;             /* errors stream, defaults to stderr */
  bool errors_fopened;      /* whether errors stream isn't stderr */
  struct curl_slist *quote;
  struct curl_slist *postquote;
  struct curl_slist *prequote;
@@ -220,6 +218,8 @@ struct GlobalConfig {
                                      0 => -s is used to NOT show errors
                                      1 => -S has been used to show errors */
  bool mute;                      /* don't show messages, --silent given */
  FILE *errors;                   /* Error stream, defaults to stderr */
  bool errors_fopened;            /* Whether error stream isn't stderr */
  char *trace_dump;               /* file to dump the network trace to */
  FILE *trace_stream;
  bool trace_fopened;
+2 −2
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ int formparse(struct OperationConfig *config,
    /* Allocate the contents */
    contents = strdup(contp+1);
    if(!contents) {
      fprintf(config->errors, "out of memory\n");
      fprintf(config->global->errors, "out of memory\n");
      return 1;
    }
    contp = contents;
@@ -277,7 +277,7 @@ int formparse(struct OperationConfig *config,
        }
        forms = malloc((count+1)*sizeof(struct curl_forms));
        if(!forms) {
          fprintf(config->errors, "Error building form post!\n");
          fprintf(config->global->errors, "Error building form post!\n");
          Curl_safefree(contents);
          FreeMultiInfo(&multi_start, &multi_current);
          return 4;
Loading