components/cyrus-sasl/patches/106-remove-WIN-module.patch
changeset 5055 9daf220c1a9a
equal deleted inserted replaced
5054:91b97df27c58 5055:9daf220c1a9a
       
     1 Remove code with IBM license per Legal.
       
     2 Not for upstream
       
     3 
       
     4 diff -rupN old/lib/saslutil.c new/lib/saslutil.c
       
     5 --- old/lib/saslutil.c	2015-02-25 20:27:58.438601475 -0800
       
     6 +++ new/lib/saslutil.c	2015-03-12 11:36:32.932286680 -0700
       
     7 @@ -601,207 +601,3 @@ LOWERCASE:
       
     8      sasl_strlower (name);
       
     9      return (0);
       
    10  }
       
    11 -
       
    12 -#ifdef WIN32
       
    13 -/***************************************************************************** 
       
    14 - * 
       
    15 - *  MODULE NAME : GETOPT.C 
       
    16 - * 
       
    17 - *  COPYRIGHTS: 
       
    18 - *             This module contains code made available by IBM 
       
    19 - *             Corporation on an AS IS basis.  Any one receiving the 
       
    20 - *             module is considered to be licensed under IBM copyrights 
       
    21 - *             to use the IBM-provided source code in any way he or she 
       
    22 - *             deems fit, including copying it, compiling it, modifying 
       
    23 - *             it, and redistributing it, with or without 
       
    24 - *             modifications.  No license under any IBM patents or 
       
    25 - *             patent applications is to be implied from this copyright 
       
    26 - *             license. 
       
    27 - * 
       
    28 - *             A user of the module should understand that IBM cannot 
       
    29 - *             provide technical support for the module and will not be 
       
    30 - *             responsible for any consequences of use of the program. 
       
    31 - * 
       
    32 - *             Any notices, including this one, are not to be removed 
       
    33 - *             from the module without the prior written consent of 
       
    34 - *             IBM. 
       
    35 - * 
       
    36 - *  AUTHOR:   Original author: 
       
    37 - *                 G. R. Blair (BOBBLAIR at AUSVM1) 
       
    38 - *                 Internet: [email protected] 
       
    39 - * 
       
    40 - *            Extensively revised by: 
       
    41 - *                 John Q. Walker II, Ph.D. (JOHHQ at RALVM6) 
       
    42 - *                 Internet: [email protected] 
       
    43 - * 
       
    44 - *****************************************************************************/ 
       
    45 - 
       
    46 -/****************************************************************************** 
       
    47 - * getopt() 
       
    48 - * 
       
    49 - * The getopt() function is a command line parser.  It returns the next 
       
    50 - * option character in argv that matches an option character in opstring. 
       
    51 - * 
       
    52 - * The argv argument points to an array of argc+1 elements containing argc 
       
    53 - * pointers to character strings followed by a null pointer. 
       
    54 - * 
       
    55 - * The opstring argument points to a string of option characters; if an 
       
    56 - * option character is followed by a colon, the option is expected to have 
       
    57 - * an argument that may or may not be separated from it by white space. 
       
    58 - * The external variable optarg is set to point to the start of the option 
       
    59 - * argument on return from getopt(). 
       
    60 - * 
       
    61 - * The getopt() function places in optind the argv index of the next argument 
       
    62 - * to be processed.  The system initializes the external variable optind to 
       
    63 - * 1 before the first call to getopt(). 
       
    64 - * 
       
    65 - * When all options have been processed (that is, up to the first nonoption 
       
    66 - * argument), getopt() returns EOF.  The special option "--" may be used to 
       
    67 - * delimit the end of the options; EOF will be returned, and "--" will be 
       
    68 - * skipped. 
       
    69 - * 
       
    70 - * The getopt() function returns a question mark (?) when it encounters an 
       
    71 - * option character not included in opstring.  This error message can be 
       
    72 - * disabled by setting opterr to zero.  Otherwise, it returns the option 
       
    73 - * character that was detected. 
       
    74 - * 
       
    75 - * If the special option "--" is detected, or all options have been 
       
    76 - * processed, EOF is returned. 
       
    77 - * 
       
    78 - * Options are marked by either a minus sign (-) or a slash (/). 
       
    79 - * 
       
    80 - * No errors are defined. 
       
    81 - *****************************************************************************/ 
       
    82 - 
       
    83 -#include <string.h>                 /* for strchr() */ 
       
    84 - 
       
    85 -/* static (global) variables that are specified as exported by getopt() */ 
       
    86 -__declspec(dllexport) char *optarg = NULL;    /* pointer to the start of the option argument  */ 
       
    87 -__declspec(dllexport) int   optind = 1;       /* number of the next argv[] to be evaluated    */ 
       
    88 -__declspec(dllexport) int   opterr = 1;       /* non-zero if a question mark should be returned */
       
    89 -
       
    90 - 
       
    91 -/* handle possible future character set concerns by putting this in a macro */ 
       
    92 -#define _next_char(string)  (char)(*(string+1)) 
       
    93 - 
       
    94 -int getopt(int argc, char *argv[], char *opstring) 
       
    95 -{ 
       
    96 -    static char *pIndexPosition = NULL; /* place inside current argv string */ 
       
    97 -    char *pArgString = NULL;        /* where to start from next */ 
       
    98 -    char *pOptString;               /* the string in our program */ 
       
    99 - 
       
   100 - 
       
   101 -    if (pIndexPosition != NULL) { 
       
   102 -        /* we last left off inside an argv string */ 
       
   103 -        if (*(++pIndexPosition)) { 
       
   104 -            /* there is more to come in the most recent argv */ 
       
   105 -            pArgString = pIndexPosition; 
       
   106 -        } 
       
   107 -    } 
       
   108 - 
       
   109 -    if (pArgString == NULL) { 
       
   110 -        /* we didn't leave off in the middle of an argv string */ 
       
   111 -        if (optind >= argc) { 
       
   112 -            /* more command-line arguments than the argument count */ 
       
   113 -            pIndexPosition = NULL;  /* not in the middle of anything */ 
       
   114 -            return EOF;             /* used up all command-line arguments */ 
       
   115 -        } 
       
   116 - 
       
   117 -        /*--------------------------------------------------------------------- 
       
   118 -         * If the next argv[] is not an option, there can be no more options. 
       
   119 -         *-------------------------------------------------------------------*/ 
       
   120 -        pArgString = argv[optind++]; /* set this to the next argument ptr */ 
       
   121 - 
       
   122 -        if (('/' != *pArgString) && /* doesn't start with a slash or a dash? */ 
       
   123 -            ('-' != *pArgString)) { 
       
   124 -            --optind;               /* point to current arg once we're done */ 
       
   125 -            optarg = NULL;          /* no argument follows the option */ 
       
   126 -            pIndexPosition = NULL;  /* not in the middle of anything */ 
       
   127 -            return EOF;             /* used up all the command-line flags */ 
       
   128 -        } 
       
   129 - 
       
   130 -        /* check for special end-of-flags markers */ 
       
   131 -        if ((strcmp(pArgString, "-") == 0) || 
       
   132 -            (strcmp(pArgString, "--") == 0)) { 
       
   133 -            optarg = NULL;          /* no argument follows the option */ 
       
   134 -            pIndexPosition = NULL;  /* not in the middle of anything */ 
       
   135 -            return EOF;             /* encountered the special flag */ 
       
   136 -        } 
       
   137 - 
       
   138 -        pArgString++;               /* look past the / or - */ 
       
   139 -    } 
       
   140 - 
       
   141 -    if (':' == *pArgString) {       /* is it a colon? */ 
       
   142 -        /*--------------------------------------------------------------------- 
       
   143 -         * Rare case: if opterr is non-zero, return a question mark; 
       
   144 -         * otherwise, just return the colon we're on. 
       
   145 -         *-------------------------------------------------------------------*/ 
       
   146 -        return (opterr ? (int)'?' : (int)':'); 
       
   147 -    } 
       
   148 -    else if ((pOptString = strchr(opstring, *pArgString)) == 0) { 
       
   149 -        /*--------------------------------------------------------------------- 
       
   150 -         * The letter on the command-line wasn't any good. 
       
   151 -         *-------------------------------------------------------------------*/ 
       
   152 -        optarg = NULL;              /* no argument follows the option */ 
       
   153 -        pIndexPosition = NULL;      /* not in the middle of anything */ 
       
   154 -        return (opterr ? (int)'?' : (int)*pArgString); 
       
   155 -    } 
       
   156 -    else { 
       
   157 -        /*--------------------------------------------------------------------- 
       
   158 -         * The letter on the command-line matches one we expect to see 
       
   159 -         *-------------------------------------------------------------------*/ 
       
   160 -        if (':' == _next_char(pOptString)) { /* is the next letter a colon? */ 
       
   161 -            /* It is a colon.  Look for an argument string. */ 
       
   162 -            if ('\0' != _next_char(pArgString)) {  /* argument in this argv? */ 
       
   163 -                optarg = &pArgString[1];   /* Yes, it is */ 
       
   164 -            } 
       
   165 -            else { 
       
   166 -                /*------------------------------------------------------------- 
       
   167 -                 * The argument string must be in the next argv. 
       
   168 -                 * But, what if there is none (bad input from the user)? 
       
   169 -                 * In that case, return the letter, and optarg as NULL. 
       
   170 -                 *-----------------------------------------------------------*/ 
       
   171 -                if (optind < argc) 
       
   172 -                    optarg = argv[optind++]; 
       
   173 -                else { 
       
   174 -                    optarg = NULL; 
       
   175 -                    return (opterr ? (int)'?' : (int)*pArgString); 
       
   176 -                } 
       
   177 -            } 
       
   178 -            pIndexPosition = NULL;  /* not in the middle of anything */ 
       
   179 -        } 
       
   180 -        else { 
       
   181 -            /* it's not a colon, so just return the letter */ 
       
   182 -            optarg = NULL;          /* no argument follows the option */ 
       
   183 -            pIndexPosition = pArgString;    /* point to the letter we're on */ 
       
   184 -        } 
       
   185 -        return (int)*pArgString;    /* return the letter that matched */ 
       
   186 -    } 
       
   187 -} 
       
   188 -
       
   189 -#ifndef PASSWORD_MAX
       
   190 -#  define PASSWORD_MAX 255
       
   191 -#endif
       
   192 -
       
   193 -#include <conio.h>
       
   194 -char *
       
   195 -getpass(prompt)
       
   196 -const char *prompt;
       
   197 -{
       
   198 -	register char *p;
       
   199 -	register int c;
       
   200 -	static char pbuf[PASSWORD_MAX];
       
   201 -
       
   202 -	fprintf(stderr, "%s", prompt); (void) fflush(stderr);
       
   203 -	for (p=pbuf; (c = _getch())!=13 && c!=EOF;) {
       
   204 -		if (p < &pbuf[sizeof(pbuf)-1])
       
   205 -			*p++ = (char) c;
       
   206 -	}
       
   207 -	*p = '\0';
       
   208 -	fprintf(stderr, "\n"); (void) fflush(stderr);
       
   209 -	return(pbuf);
       
   210 -}
       
   211 -
       
   212 -
       
   213 -
       
   214 -#endif /* WIN32 */