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