113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
-
+
-
+
-
+
-
+
|
generator.site = [[optionsParser remainingArguments] firstObject];
if (lengthStr != nil) {
bool invalid = false;
@try {
generator.length = (size_t)[lengthStr decimalValue];
} @catch (OFInvalidArgumentException *e) {
} @catch (OFInvalidFormatException *e) {
invalid = true;
} @catch (OFInvalidFormatException *e) {
} @catch (OFOutOfRangeException *e) {
invalid = true;
}
if (invalid) {
[of_stderr writeFormat:
@"%@: Invalid length: %@\n",
[OFApplication programName], lengthStr];
[OFApplication terminateWithStatus: 1];
}
}
prompt = [OFString stringWithFormat: @"Passphrase for site \"%@\": ",
generator.site];
passphrase = getpass(
[prompt cStringWithEncoding: [OFSystemInfo native8BitEncoding]]);
[prompt cStringWithEncoding: [OFLocalization encoding]]);
@try {
if (_repeat) {
char *passphraseCopy = of_strdup(passphrase);
if (passphraseCopy == NULL)
@throw [OFOutOfMemoryException exception];
@try {
of_string_encoding_t encoding =
[OFSystemInfo native8BitEncoding];
[OFLocalization encoding];
prompt = [OFString stringWithFormat:
@"Repeat passphrase for site \"%@\": ",
generator.site];
passphrase = getpass(
[prompt cStringWithEncoding: encoding]);
|