diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-10-06 07:50:18 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-10-06 07:50:18 +0000 |
commit | 39af394a1c3ae1d8ac71ad263a7c524988702c2e (patch) | |
tree | 4ba44670440d52ff6c3b07fdef35ae3384f3dc5a /src | |
parent | 5c7dcc6c33bb9e9621cf09ada4a15f310cf1c0e0 (diff) |
removed tabs and trailing whitespace from source
Diffstat (limited to 'src')
-rw-r--r-- | src/config-amigaos.h | 39 | ||||
-rw-r--r-- | src/config-mac.h | 12 | ||||
-rw-r--r-- | src/getpass.c | 10 | ||||
-rw-r--r-- | src/homedir.c | 20 | ||||
-rw-r--r-- | src/main.c | 148 | ||||
-rw-r--r-- | src/urlglob.c | 110 |
6 files changed, 165 insertions, 174 deletions
diff --git a/src/config-amigaos.h b/src/config-amigaos.h index ab6d28826..2d66e37e3 100644 --- a/src/config-amigaos.h +++ b/src/config-amigaos.h @@ -7,37 +7,28 @@ #define OS "AmigaOS" -#define HAVE_UNISTD_H 1 -#define HAVE_STRDUP 1 -#define HAVE_UTIME 1 -#define HAVE_UTIME_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_SYS_SOCKET_H 1 -#define HAVE_WRITABLE_ARGV 1 -#define HAVE_SYS_TIME_H 1 -#define HAVE_TIME_H 1 -#define TIME_WITH_SYS_TIME 1 -#define HAVE_TERMIOS_H 1 - -#define HAVE_PWD_H 1 - -/* futher implementation?... */ -//#define HAVE_TCGETATTR 1 -//#define HAVE_TCSETATTR 1 - -/* futher usergroup.library usage?... */ -//#define HAVE_GETPWUID 1 -//#define HAVE_GETEUID 1 - +#define HAVE_UNISTD_H 1 +#define HAVE_STRDUP 1 +#define HAVE_UTIME 1 +#define HAVE_UTIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_WRITABLE_ARGV 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_TIME_H 1 +#define TIME_WITH_SYS_TIME 1 +#define HAVE_TERMIOS_H 1 + +#define HAVE_PWD_H 1 #ifndef F_OK # define F_OK 0 #endif #ifndef LONG_MAX -# define LONG_MAX 0x7fffffffL /* max value for a long */ +# define LONG_MAX 0x7fffffffL /* max value for a long */ #endif #ifndef LONG_MIN -# define LONG_MIN (-0x7fffffffL-1) /* min value for a long */ +# define LONG_MIN (-0x7fffffffL-1) /* min value for a long */ #endif #endif /* CURL_CONFIG_AMIGAOS_H */ diff --git a/src/config-mac.h b/src/config-mac.h index a6f58e685..36505c94c 100644 --- a/src/config-mac.h +++ b/src/config-mac.h @@ -1,13 +1,13 @@ /* Define to 1 if you want the built-in manual */ #define USE_MANUAL 1 -#define HAVE_UNISTD_H 1 -#define HAVE_FCNTL_H 1 -#define HAVE_UTIME_H 1 -#define HAVE_SYS_UTIME_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_UTIME_H 1 +#define HAVE_SYS_UTIME_H 1 -#define HAVE_SETVBUF 1 -#define HAVE_UTIME 1 +#define HAVE_SETVBUF 1 +#define HAVE_UTIME 1 #define main(x,y) curl_main(x,y) diff --git a/src/getpass.c b/src/getpass.c index 21cb679a7..af377b1ed 100644 --- a/src/getpass.c +++ b/src/getpass.c @@ -39,7 +39,7 @@ #include "getpass.h" #ifndef WIN32 -#ifdef VMS +#ifdef VMS #include <stdio.h> #include <string.h> #include descrip @@ -80,7 +80,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) } #else /* VMS */ #ifdef HAVE_TERMIOS_H -# if !defined(HAVE_TCGETATTR) && !defined(HAVE_TCSETATTR) +# if !defined(HAVE_TCGETATTR) && !defined(HAVE_TCSETATTR) # undef HAVE_TERMIOS_H # endif #endif @@ -126,7 +126,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) #else # ifdef HAVE_TERMIO_H struct termio orig; - struct termio noecho; + struct termio noecho; # else # endif #endif @@ -192,7 +192,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) # else # endif #endif - + signal(SIGINT, sigint); #ifdef SIGTSTP signal(SIGTSTP, sigtstp); @@ -211,7 +211,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) { size_t i; printf("%s", prompt); - + for(i=0; i<buflen; i++) { buffer[i] = getch(); if ( buffer[i] == '\r' ) { diff --git a/src/homedir.c b/src/homedir.c index 3ec196a7e..69fbc467c 100644 --- a/src/homedir.c +++ b/src/homedir.c @@ -1,8 +1,8 @@ /*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. @@ -10,7 +10,7 @@ * 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. @@ -56,7 +56,7 @@ char *GetEnv(const char *variable, char do_expand) /* Don't use getenv(); it doesn't find variable added after program was * started. Don't accept truncated results (i.e. rc >= sizeof(buf1)). */ - + rc = GetEnvironmentVariable(variable, buf1, sizeof(buf1)); if (rc > 0 && rc < sizeof(buf1)) { env = buf1; @@ -71,10 +71,10 @@ char *GetEnv(const char *variable, char do_expand) } #else (void)do_expand; -#ifdef VMS +#ifdef VMS env = getenv(variable); if (env && strcmp("HOME",variable) == 0) { - env = decc$translate_vms(env); + env = decc$translate_vms(env); } #else /* no length control */ @@ -90,11 +90,11 @@ char *homedir(void) char *home = GetEnv("HOME", FALSE); if(home) return home; - + #if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID) { struct passwd *pw = getpwuid(geteuid()); - + if (pw) { #ifdef VMS home = decc$translate_vms(pw->pw_dir); diff --git a/src/main.c b/src/main.c index 87886ad6c..86e06ccd3 100644 --- a/src/main.c +++ b/src/main.c @@ -46,7 +46,7 @@ #include "writeenv.h" #endif -#define CURLseparator "--_curl_--" +#define CURLseparator "--_curl_--" #if defined(WIN32)&&!defined(__CYGWIN32__) #include <winsock2.h> @@ -146,7 +146,7 @@ typedef char bool; * standard MIN macro */ #ifndef MIN -#define MIN(X,Y) (((X) < (Y)) ? (X) : (Y)) +#define MIN(X,Y) (((X) < (Y)) ? (X) : (Y)) #endif typedef enum { @@ -207,7 +207,7 @@ char *strdup(char *str) #define mkdir(x,y) (mkdir)(x) #endif -#ifdef VMS +#ifdef VMS #include "curlmsg_vms.h" #endif @@ -523,7 +523,7 @@ static char *my_get_line(FILE *fp); static int create_dir_hierarchy(char *outfile); static void GetStr(char **string, - char *value) + char *value) { if(*string) free(*string); @@ -788,34 +788,34 @@ static int formparse(char *input, multi_start = multi_current=NULL; do { - /* since this was a file, it may have a content-type specifier - at the end too, or a filename. Or both. */ + /* since this was a file, it may have a content-type specifier + at the end too, or a filename. Or both. */ char *ptr; char *filename=NULL; - sep=strchr(contp, FORM_TYPE_SEPARATOR); - sep2=strchr(contp, FORM_FILE_SEPARATOR); + sep=strchr(contp, FORM_TYPE_SEPARATOR); + sep2=strchr(contp, FORM_FILE_SEPARATOR); - /* pick the closest */ - if(sep2 && (sep2 < sep)) { - sep = sep2; + /* pick the closest */ + if(sep2 && (sep2 < sep)) { + sep = sep2; - /* no type was specified! */ - } + /* no type was specified! */ + } type = NULL; - if(sep) { + if(sep) { - /* if we got here on a comma, don't do much */ - if(FORM_FILE_SEPARATOR == *sep) - ptr = NULL; - else + /* if we got here on a comma, don't do much */ + if(FORM_FILE_SEPARATOR == *sep) + ptr = NULL; + else ptr = sep+1; - *sep=0; /* terminate file name at separator */ + *sep=0; /* terminate file name at separator */ - while(ptr && (FORM_FILE_SEPARATOR!= *ptr)) { + while(ptr && (FORM_FILE_SEPARATOR!= *ptr)) { /* pass all white spaces */ while(isspace((int)*ptr)) @@ -855,21 +855,21 @@ static int formparse(char *input, else /* confusion, bail out of loop */ break; - } + } /* find the following comma */ if(ptr) sep=strchr(ptr, FORM_FILE_SEPARATOR); else sep=NULL; - } - else { - sep=strchr(contp, FORM_FILE_SEPARATOR); - } - if(sep) { - /* the next file name starts here */ - *sep =0; - sep++; - } + } + else { + sep=strchr(contp, FORM_FILE_SEPARATOR); + } + if(sep) { + /* the next file name starts here */ + *sep =0; + sep++; + } /* if type == NULL curl_formadd takes care of the problem */ if (!AddMultiFiles (contp, type, filename, &multi_start, @@ -879,7 +879,7 @@ static int formparse(char *input, FreeMultiInfo (multi_start); return 3; } - contp = sep; /* move the contents pointer to after the separator */ + contp = sep; /* move the contents pointer to after the separator */ } while(sep && *sep); /* loop if there's another file name */ @@ -1280,8 +1280,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ numhits = 1; /* a single unique hit */ break; } - parse = aliases[j].letter; - hit = j; + parse = aliases[j].letter; + hit = j; } } if(numhits>1) { @@ -1314,13 +1314,13 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ #endif if(hit < 0) { for(j=0; j< sizeof(aliases)/sizeof(aliases[0]); j++) { - if(letter == aliases[j].letter[0]) { - hit = j; - break; - } + if(letter == aliases[j].letter[0]) { + hit = j; + break; + } } if(hit < 0) { - return PARAM_OPTION_UNKNOWN; + return PARAM_OPTION_UNKNOWN; } } if(hit < 0) { @@ -1392,34 +1392,34 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'j': /* --compressed */ - config->encoding ^= TRUE; - break; + config->encoding ^= TRUE; + break; case 'k': /* --digest */ - config->authtype = CURLAUTH_DIGEST; - break; + config->authtype = CURLAUTH_DIGEST; + break; case 'l': /* --negotiate */ if(curlinfo->features & CURL_VERSION_GSSNEGOTIATE) config->authtype = CURLAUTH_GSSNEGOTIATE; else return PARAM_LIBCURL_DOESNT_SUPPORT; - break; + break; case 'm': /* --ntlm */ if(curlinfo->features & CURL_VERSION_NTLM) config->authtype = CURLAUTH_NTLM; else return PARAM_LIBCURL_DOESNT_SUPPORT; - break; + break; case 'n': /* --basic for completeness */ - config->authtype = CURLAUTH_BASIC; - break; + config->authtype = CURLAUTH_BASIC; + break; case 'o': /* --anyauth, let libcurl pick it */ - config->authtype = CURLAUTH_ANY; - break; + config->authtype = CURLAUTH_ANY; + break; #ifdef __DJGPP__ case 'p': /* --wdebug */ @@ -1520,8 +1520,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ GetStr(&config->socks5proxy, nextarg); break; case 'd': /* --tcp-nodelay option */ - config->tcp_nodelay ^= TRUE; - break; + config->tcp_nodelay ^= TRUE; + break; case 'e': /* --proxy-digest */ config->proxydigest ^= TRUE; break; @@ -1723,11 +1723,11 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'F': /* "form data" simulation, this is a little advanced so lets do our best - to sort this out slowly and carefully */ + to sort this out slowly and carefully */ if(formparse(nextarg, &config->httppost, &config->last_post)) - return PARAM_BAD_USE; + return PARAM_BAD_USE; if(SetHTTPrequest(HTTPREQ_POST, &config->httpreq)) return PARAM_BAD_USE; break; @@ -1860,9 +1860,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ case 'P': /* This makes the FTP sessions use PORT instead of PASV */ /* use <eth0> or <192.168.10.10> style addresses. Anything except - this will make us try to get the "default" address. - NOTE: this is a changed behaviour since the released 4.1! - */ + this will make us try to get the "default" address. + NOTE: this is a changed behaviour since the released 4.1! + */ GetStr(&config->ftpport, nextarg); break; case 'p': @@ -1871,7 +1871,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'q': /* if used first, already taken care of, we do it like - this so we don't cause an error! */ + this so we don't cause an error! */ break; case 'Q': /* QUOTE command to send to FTP server */ @@ -2034,14 +2034,14 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ if(str2num(&config->low_speed_time, nextarg)) return PARAM_BAD_NUMERIC; if(!config->low_speed_limit) - config->low_speed_limit = 1; + config->low_speed_limit = 1; break; case 'Y': /* low speed limit */ if(str2num(&config->low_speed_limit, nextarg)) return PARAM_BAD_NUMERIC; if(!config->low_speed_time) - config->low_speed_time=30; + config->low_speed_time=30; break; case 'z': /* time condition coming up */ switch(*nextarg) { @@ -2254,7 +2254,7 @@ static void parseconfig(const char *filename, if(alloced_param) { free(param); - param = NULL; + param = NULL; } free(aline); @@ -2831,23 +2831,23 @@ operate(struct Configurable *config, int argc, char *argv[]) char *flag = argv[i]; if(curlx_strequal("--", argv[i])) - /* this indicates the end of the flags and thus enables the - following (URL) argument to start with -. */ - stillflags=FALSE; + /* this indicates the end of the flags and thus enables the + following (URL) argument to start with -. */ + stillflags=FALSE; else { - nextarg= (i < argc - 1)? argv[i+1]: NULL; + nextarg= (i < argc - 1)? argv[i+1]: NULL; - res = getparameter(flag, nextarg, &passarg, config); - if(res) { + res = getparameter(flag, nextarg, &passarg, config); + if(res) { const char *reason = param2text(res); if(res != PARAM_HELP_REQUESTED) helpf("option %s: %s\n", origopt, reason); clean_getout(config); - return CURLE_FAILED_INIT; + return CURLE_FAILED_INIT; } - if(passarg) /* we're supposed to skip this */ - i++; + if(passarg) /* we're supposed to skip this */ + i++; } } else { @@ -3093,7 +3093,7 @@ operate(struct Configurable *config, int argc, char *argv[]) config->resume_from = 0; } - outs.filename = outfile; + outs.filename = outfile; if(config->resume_from) { /* open file for output: */ @@ -3253,8 +3253,8 @@ operate(struct Configurable *config, int argc, char *argv[]) } #endif - if(1 == config->tcp_nodelay) - curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + if(1 == config->tcp_nodelay) + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); curl_easy_setopt(curl, CURLOPT_SSLENGINE, config->engine); curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1); @@ -3479,7 +3479,7 @@ operate(struct Configurable *config, int argc, char *argv[]) ourWriteEnv(curl); #endif -#ifdef VMS +#ifdef VMS if (!config->showerror) { vms_show = VMSSTS_HIDE; } @@ -3617,8 +3617,8 @@ int main(int argc, char *argv[]) #ifdef __NOVELL_LIBC__ pressanykey(); #endif -#ifdef VMS - if (res > CURL_LAST) res = CURL_LAST; /* If CURL_LAST exceeded then */ +#ifdef VMS + if (res > CURL_LAST) res = CURL_LAST; /* If CURL_LAST exceeded then */ return (vms_cond[res]|vms_show); /* curlmsg.h is out of sync. */ #else return res; diff --git a/src/urlglob.c b/src/urlglob.c index 6bb323218..e4f441b08 100644 --- a/src/urlglob.c +++ b/src/urlglob.c @@ -74,19 +74,19 @@ static GlobCode glob_set(URLGlob *glob, char *pattern, while (1) { switch (*pattern) { - case '\0': /* URL ended while set was still open */ + case '\0': /* URL ended while set was still open */ snprintf(glob->errormsg, sizeof(glob->errormsg), "unmatched brace at pos %d\n", (int)pos); return GLOB_ERROR; case '{': - case '[': /* no nested expressions at this time */ + case '[': /* no nested expressions at this time */ snprintf(glob->errormsg, sizeof(glob->errormsg), "nested braces not supported at pos %d\n", (int)pos); return GLOB_ERROR; case ',': - case '}': /* set element completed */ + case '}': /* set element completed */ *buf = '\0'; pat->content.Set.elements = realloc(pat->content.Set.elements, @@ -103,10 +103,10 @@ static GlobCode glob_set(URLGlob *glob, char *pattern, /* entire set pattern completed */ int wordamount; - /* always check for a literal (may be "") between patterns */ + /* always check for a literal (may be "") between patterns */ if(GLOB_ERROR == glob_word(glob, ++pattern, ++pos, &wordamount)) wordamount=1; - *amount = pat->content.Set.size * wordamount; + *amount = pat->content.Set.size * wordamount; return GLOB_OK; } @@ -116,22 +116,22 @@ static GlobCode glob_set(URLGlob *glob, char *pattern, ++pos; break; - case ']': /* illegal closing bracket */ + case ']': /* illegal closing bracket */ snprintf(glob->errormsg, sizeof(glob->errormsg), "illegal pattern at pos %d\n", (int)pos); return GLOB_ERROR; - case '\\': /* escaped character, skip '\' */ - if (*(buf+1) == '\0') { /* but no escaping of '\0'! */ + case '\\': /* escaped character, skip '\' */ + if (*(buf+1) == '\0') { /* but no escaping of '\0'! */ snprintf(glob->errormsg, sizeof(glob->errormsg), "illegal pattern at pos %d\n", (int)pos); - return GLOB_ERROR; + return GLOB_ERROR; } ++pattern; - ++pos; /* intentional fallthrough */ + ++pos; /* intentional fallthrough */ default: - *buf++ = *pattern++; /* copy character to set element */ + *buf++ = *pattern++; /* copy character to set element */ ++pos; } } @@ -155,12 +155,12 @@ static GlobCode glob_range(URLGlob *glob, char *pattern, /* patterns 0,1,2,... correspond to size=1,3,5,... */ ++glob->size; - if (isalpha((int)*pattern)) { /* character range detected */ + if (isalpha((int)*pattern)) { /* character range detected */ pat->type = UPTCharRange; if (sscanf(pattern, "%c-%c]", &pat->content.CharRange.min_c, &pat->content.CharRange.max_c) != 2 || - pat->content.CharRange.min_c >= pat->content.CharRange.max_c || - pat->content.CharRange.max_c - pat->content.CharRange.min_c > 'z' - 'a') { + pat->content.CharRange.min_c >= pat->content.CharRange.max_c || + pat->content.CharRange.max_c - pat->content.CharRange.min_c > 'z' - 'a') { /* the pattern is not well-formed */ snprintf(glob->errormsg, sizeof(glob->errormsg), "illegal pattern or range specification after pos %d\n", pos); @@ -186,17 +186,17 @@ static GlobCode glob_range(URLGlob *glob, char *pattern, if (sscanf(pattern, "%d-%d]", &pat->content.NumRange.min_n, &pat->content.NumRange.max_n) != 2 || - pat->content.NumRange.min_n >= pat->content.NumRange.max_n) { + pat->content.NumRange.min_n >= pat->content.NumRange.max_n) { /* the pattern is not well-formed */ snprintf(glob->errormsg, sizeof(glob->errormsg), "error: illegal pattern or range specification after pos %d\n", pos); return GLOB_ERROR; } - if (*pattern == '0') { /* leading zero specified */ + if (*pattern == '0') { /* leading zero specified */ c = pattern; while (isdigit((int)*c++)) - ++pat->content.NumRange.padlength; /* padding length is set for all + ++pat->content.NumRange.padlength; /* padding length is set for all instances of this pattern */ } pat->content.NumRange.ptr_n = pat->content.NumRange.min_n; @@ -248,10 +248,10 @@ static GlobCode glob_word(URLGlob *glob, char *pattern, /* escape character, skip '\' */ ++pattern; ++pos; - if (*pattern == '\0') /* but no escaping of '\0'! */ - return GLOB_ERROR; + if (*pattern == '\0') /* but no escaping of '\0'! */ + return GLOB_ERROR; } - *buf++ = *pattern++; /* copy character to literal */ + *buf++ = *pattern++; /* copy character to literal */ ++pos; } *buf = '\0'; @@ -264,7 +264,7 @@ static GlobCode glob_word(URLGlob *glob, char *pattern, switch (*pattern) { case '\0': - break; /* singular URL processed */ + break; /* singular URL processed */ case '{': /* process set pattern */ @@ -333,17 +333,17 @@ void glob_cleanup(URLGlob* glob) int elem; for (i = glob->size - 1; i < glob->size; --i) { - if (!(i & 1)) { /* even indexes contain literals */ + if (!(i & 1)) { /* even indexes contain literals */ free(glob->literal[i/2]); } - else { /* odd indexes contain sets or ranges */ + else { /* odd indexes contain sets or ranges */ if (glob->pattern[i/2].type == UPTSet) { - for (elem = glob->pattern[i/2].content.Set.size - 1; + for (elem = glob->pattern[i/2].content.Set.size - 1; elem >= 0; --elem) { - free(glob->pattern[i/2].content.Set.elements[elem]); - } - free(glob->pattern[i/2].content.Set.elements); + free(glob->pattern[i/2].content.Set.elements[elem]); + } + free(glob->pattern[i/2].content.Set.elements); } } } @@ -372,29 +372,29 @@ char *glob_next_url(URLGlob *glob) pat = &glob->pattern[i]; switch (pat->type) { case UPTSet: - if (++pat->content.Set.ptr_s == pat->content.Set.size) { - pat->content.Set.ptr_s = 0; - carry = 1; - } - break; + if (++pat->content.Set.ptr_s == pat->content.Set.size) { + pat->content.Set.ptr_s = 0; + carry = 1; + } + break; case UPTCharRange: - if (++pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) { - pat->content.CharRange.ptr_c = pat->content.CharRange.min_c; - carry = 1; - } - break; + if (++pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) { + pat->content.CharRange.ptr_c = pat->content.CharRange.min_c; + carry = 1; + } + break; case UPTNumRange: - if (++pat->content.NumRange.ptr_n > pat->content.NumRange.max_n) { - pat->content.NumRange.ptr_n = pat->content.NumRange.min_n; - carry = 1; - } - break; + if (++pat->content.NumRange.ptr_n > pat->content.NumRange.max_n) { + pat->content.NumRange.ptr_n = pat->content.NumRange.min_n; + carry = 1; + } + break; default: - printf("internal error: invalid pattern type (%d)\n", (int)pat->type); - exit (CURLE_FAILED_INIT); + printf("internal error: invalid pattern type (%d)\n", (int)pat->type); + exit (CURLE_FAILED_INIT); } } - if (carry) /* first pattern ptr has run into overflow, done! */ + if (carry) /* first pattern ptr has run into overflow, done! */ return NULL; } @@ -404,24 +404,24 @@ char *glob_next_url(URLGlob *glob) strcpy(buf, lit); buf += strlen(lit); } - else { /* the rest (i odd) are patterns */ + else { /* the rest (i odd) are patterns */ pat = &glob->pattern[j/2]; switch(pat->type) { case UPTSet: - strcpy(buf, pat->content.Set.elements[pat->content.Set.ptr_s]); - buf += strlen(pat->content.Set.elements[pat->content.Set.ptr_s]); - break; + strcpy(buf, pat->content.Set.elements[pat->content.Set.ptr_s]); + buf += strlen(pat->content.Set.elements[pat->content.Set.ptr_s]); + break; case UPTCharRange: - *buf++ = pat->content.CharRange.ptr_c; - break; + *buf++ = pat->content.CharRange.ptr_c; + break; case UPTNumRange: - sprintf(buf, "%0*d", + sprintf(buf, "%0*d", pat->content.NumRange.padlength, pat->content.NumRange.ptr_n); buf += strlen(buf); /* make no sprint() return code assumptions */ - break; + break; default: - printf("internal error: invalid pattern type (%d)\n", (int)pat->type); - exit (CURLE_FAILED_INIT); + printf("internal error: invalid pattern type (%d)\n", (int)pat->type); + exit (CURLE_FAILED_INIT); } } } |