mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
use hugehelp.h to silence picky compiler warnings
This commit is contained in:
parent
3415ac3866
commit
d7579087f2
26
src/hugehelp.h
Normal file
26
src/hugehelp.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef __HUGEHELP_H
|
||||||
|
#define __HUGEHELP_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2004, 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 http://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.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
***************************************************************************/
|
||||||
|
void hugehelp(void);
|
||||||
|
#endif
|
68
src/main.c
68
src/main.c
@ -42,6 +42,7 @@
|
|||||||
#include "writeout.h"
|
#include "writeout.h"
|
||||||
#include "getpass.h"
|
#include "getpass.h"
|
||||||
#include "homedir.h"
|
#include "homedir.h"
|
||||||
|
#include "hugehelp.h"
|
||||||
#ifdef USE_ENVIRONMENT
|
#ifdef USE_ENVIRONMENT
|
||||||
#include "writeenv.h"
|
#include "writeenv.h"
|
||||||
#endif
|
#endif
|
||||||
@ -191,14 +192,12 @@ char *strdup(char *str)
|
|||||||
#include "curlmsg_vms.h"
|
#include "curlmsg_vms.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void hugehelp(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the main global constructor for the app. Call this before
|
* This is the main global constructor for the app. Call this before
|
||||||
* _any_ libcurl usage. If this fails, *NO* libcurl functions may be
|
* _any_ libcurl usage. If this fails, *NO* libcurl functions may be
|
||||||
* used, or havoc may be the result.
|
* used, or havoc may be the result.
|
||||||
*/
|
*/
|
||||||
CURLcode main_init(void)
|
static CURLcode main_init(void)
|
||||||
{
|
{
|
||||||
return curl_global_init(CURL_GLOBAL_DEFAULT);
|
return curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||||
}
|
}
|
||||||
@ -207,12 +206,12 @@ CURLcode main_init(void)
|
|||||||
* This is the main global destructor for the app. Call this after
|
* This is the main global destructor for the app. Call this after
|
||||||
* _all_ libcurl usage is done.
|
* _all_ libcurl usage is done.
|
||||||
*/
|
*/
|
||||||
void main_free(void)
|
static void main_free(void)
|
||||||
{
|
{
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SetHTTPrequest(HttpReq req, HttpReq *store)
|
static int SetHTTPrequest(HttpReq req, HttpReq *store)
|
||||||
{
|
{
|
||||||
if((*store == HTTPREQ_UNSPEC) ||
|
if((*store == HTTPREQ_UNSPEC) ||
|
||||||
(*store == req)) {
|
(*store == req)) {
|
||||||
@ -257,7 +256,7 @@ struct getout {
|
|||||||
static void help(void)
|
static void help(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *help[]={
|
static const char *helptext[]={
|
||||||
"Usage: curl [options...] <url>",
|
"Usage: curl [options...] <url>",
|
||||||
"Options: (H) means HTTP/HTTPS only, (F) means FTP only",
|
"Options: (H) means HTTP/HTTPS only, (F) means FTP only",
|
||||||
" -a/--append Append to target file when uploading (F)",
|
" -a/--append Append to target file when uploading (F)",
|
||||||
@ -365,8 +364,8 @@ static void help(void)
|
|||||||
" -#/--progress-bar Display transfer progress as a progress bar",
|
" -#/--progress-bar Display transfer progress as a progress bar",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
for(i=0; help[i]; i++)
|
for(i=0; helptext[i]; i++)
|
||||||
puts(help[i]);
|
puts(helptext[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LongShort {
|
struct LongShort {
|
||||||
@ -564,7 +563,7 @@ static char *file2memory(FILE *file, long *size)
|
|||||||
return NULL; /* no string */
|
return NULL; /* no string */
|
||||||
}
|
}
|
||||||
|
|
||||||
void clean_getout(struct Configurable *config)
|
static void clean_getout(struct Configurable *config)
|
||||||
{
|
{
|
||||||
struct getout *node=config->url_list;
|
struct getout *node=config->url_list;
|
||||||
struct getout *next;
|
struct getout *next;
|
||||||
@ -583,7 +582,7 @@ void clean_getout(struct Configurable *config)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct getout *new_getout(struct Configurable *config)
|
static struct getout *new_getout(struct Configurable *config)
|
||||||
{
|
{
|
||||||
struct getout *node =malloc(sizeof(struct getout));
|
struct getout *node =malloc(sizeof(struct getout));
|
||||||
struct getout *last= config->url_last;
|
struct getout *last= config->url_last;
|
||||||
@ -951,7 +950,6 @@ static const char *param2text(ParameterError error)
|
|||||||
default:
|
default:
|
||||||
return "unknown error";
|
return "unknown error";
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanarg(char *str)
|
static void cleanarg(char *str)
|
||||||
@ -1032,7 +1030,7 @@ static void checkpasswd(const char *kind, /* for what purpose */
|
|||||||
char prompt[256];
|
char prompt[256];
|
||||||
int passwdlen;
|
int passwdlen;
|
||||||
int userlen = strlen(*userpwd);
|
int userlen = strlen(*userpwd);
|
||||||
char *ptr;
|
char *passptr;
|
||||||
|
|
||||||
/* build a nice-looking prompt */
|
/* build a nice-looking prompt */
|
||||||
curl_msnprintf(prompt, sizeof(prompt),
|
curl_msnprintf(prompt, sizeof(prompt),
|
||||||
@ -1043,16 +1041,16 @@ static void checkpasswd(const char *kind, /* for what purpose */
|
|||||||
getpass_r(prompt, passwd, sizeof(passwd));
|
getpass_r(prompt, passwd, sizeof(passwd));
|
||||||
passwdlen = strlen(passwd);
|
passwdlen = strlen(passwd);
|
||||||
|
|
||||||
/* extend the allocated memory are to fit the password too */
|
/* extend the allocated memory area to fit the password too */
|
||||||
ptr = realloc(*userpwd,
|
passptr = realloc(*userpwd,
|
||||||
passwdlen + 1 + /* an extra for the colon */
|
passwdlen + 1 + /* an extra for the colon */
|
||||||
userlen + 1); /* an extra for the zero */
|
userlen + 1); /* an extra for the zero */
|
||||||
|
|
||||||
if(ptr) {
|
if(passptr) {
|
||||||
/* append the password separated with a colon */
|
/* append the password separated with a colon */
|
||||||
ptr[userlen]=':';
|
passptr[userlen]=':';
|
||||||
memcpy(&ptr[userlen+1], passwd, passwdlen+1);
|
memcpy(&passptr[userlen+1], passwd, passwdlen+1);
|
||||||
*userpwd = ptr;
|
*userpwd = passptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2190,7 +2188,7 @@ struct OutStruct {
|
|||||||
struct Configurable *config;
|
struct Configurable *config;
|
||||||
};
|
};
|
||||||
|
|
||||||
int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
|
static int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct OutStruct *out=(struct OutStruct *)stream;
|
struct OutStruct *out=(struct OutStruct *)stream;
|
||||||
@ -2236,7 +2234,7 @@ struct InStruct {
|
|||||||
struct Configurable *config;
|
struct Configurable *config;
|
||||||
};
|
};
|
||||||
|
|
||||||
int my_fread(void *buffer, size_t size, size_t nmemb, void *userp)
|
static int my_fread(void *buffer, size_t size, size_t nmemb, void *userp)
|
||||||
{
|
{
|
||||||
struct InStruct *in=(struct InStruct *)userp;
|
struct InStruct *in=(struct InStruct *)userp;
|
||||||
|
|
||||||
@ -2283,14 +2281,14 @@ struct ProgressData {
|
|||||||
curl_off_t initial_size;
|
curl_off_t initial_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
int myprogress (void *clientp,
|
static int myprogress (void *clientp,
|
||||||
double dltotal,
|
double dltotal,
|
||||||
double dlnow,
|
double dlnow,
|
||||||
double ultotal,
|
double ultotal,
|
||||||
double ulnow)
|
double ulnow)
|
||||||
{
|
{
|
||||||
/* The original progress-bar source code was written for curl by Lars Aas,
|
/* The original progress-bar source code was written for curl by Lars Aas,
|
||||||
and this new edition inherites some of his concepts. */
|
and this new edition inherits some of his concepts. */
|
||||||
|
|
||||||
char line[256];
|
char line[256];
|
||||||
char outline[256];
|
char outline[256];
|
||||||
@ -2307,7 +2305,7 @@ int myprogress (void *clientp,
|
|||||||
|
|
||||||
bar->calls++; /* simply count invokes */
|
bar->calls++; /* simply count invokes */
|
||||||
|
|
||||||
if(0 == total) {
|
if(total < 1) {
|
||||||
int prevblock = (int)bar->prev / 1024;
|
int prevblock = (int)bar->prev / 1024;
|
||||||
int thisblock = (int)point / 1024;
|
int thisblock = (int)point / 1024;
|
||||||
while ( thisblock > prevblock ) {
|
while ( thisblock > prevblock ) {
|
||||||
@ -2476,7 +2474,7 @@ int my_trace(CURL *handle, curl_infotype type,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_config_fields(struct Configurable *config)
|
static void free_config_fields(struct Configurable *config)
|
||||||
{
|
{
|
||||||
if(config->random_file)
|
if(config->random_file)
|
||||||
free(config->random_file);
|
free(config->random_file);
|
||||||
@ -3018,8 +3016,8 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (httpgetfields) {
|
if (httpgetfields) {
|
||||||
/* Find out whether the url contains a file name */
|
/* Find out whether the url contains a file name */
|
||||||
char *pc =strstr(url, "://");
|
const char *pc =strstr(url, "://");
|
||||||
char separator='?';
|
char sep='?';
|
||||||
if(pc)
|
if(pc)
|
||||||
pc+=3;
|
pc+=3;
|
||||||
else
|
else
|
||||||
@ -3032,8 +3030,8 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
|
|
||||||
if(strchr(pc, '?'))
|
if(strchr(pc, '?'))
|
||||||
/* Ouch, there's already a question mark in the URL string, we
|
/* Ouch, there's already a question mark in the URL string, we
|
||||||
then appead the data with an amperand separator instead! */
|
then append the data with an ampersand separator instead! */
|
||||||
separator='&';
|
sep='&';
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Then append ? followed by the get fields to the url.
|
* Then append ? followed by the get fields to the url.
|
||||||
@ -3044,7 +3042,7 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
if (pc)
|
if (pc)
|
||||||
sprintf(urlbuffer, "%s%c%s", url, separator, httpgetfields);
|
sprintf(urlbuffer, "%s%c%s", url, sep, httpgetfields);
|
||||||
else
|
else
|
||||||
/* Append / before the ? to create a well-formed url
|
/* Append / before the ? to create a well-formed url
|
||||||
if the url contains a hostname only
|
if the url contains a hostname only
|
||||||
|
@ -112,6 +112,7 @@ print <<HEAD
|
|||||||
* NEVER EVER edit this manually, fix the mkhelp.pl script instead!
|
* NEVER EVER edit this manually, fix the mkhelp.pl script instead!
|
||||||
* Generation time: $now
|
* Generation time: $now
|
||||||
*/
|
*/
|
||||||
|
#include "hugehelp.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
HEAD
|
HEAD
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user