+static int
+text_auth_conv (
+ int num_msg,
+ const struct auth_message *auth_msgs,
+ struct auth_response **resp,
+ saver_info *si)
+{
+ char *input;
+ char buf[255];
+ struct auth_response *responses;
+ int i;
+
+ responses = calloc(num_msg, sizeof(struct auth_response));
+ if (!responses)
+ return -1;
+
+ /* The unlock state won't actually be used until this function returns and
+ * the auth module processes the response, but set it anyway for consistency
+ */
+ si->unlock_state = ul_read;
+
+ for (i = 0; i < num_msg; ++i)
+ {
+ printf ("\n%s: %s", progname, auth_msgs[i].msg);
+ if ( auth_msgs[i].type == AUTH_MSGTYPE_PROMPT_NOECHO
+ || auth_msgs[i].type == AUTH_MSGTYPE_PROMPT_ECHO)
+ {
+ input = fgets (buf, sizeof(buf)-1, stdin);
+ if (!input || !*input)
+ exit (0);
+ if (input[strlen(input)-1] == '\n')
+ input[strlen(input)-1] = 0;
+
+ responses[i].response = strdup(input);
+ }
+ }
+
+ *resp = responses;
+
+ si->unlock_state = ul_finished;
+
+ return 0;
+}
+
+
+#ifdef __GNUC__
+ __extension__ /* shut up about "string length is greater than the length
+ ISO C89 compilers are required to support" when including
+ the .ad file... */
+#endif
+