+ case '\010': case '\177': /* Backspace */
+ {
+ /* kludgey way to get the number of "logical" characters. */
+ int nchars = strlen (pw->typed_passwd_char_size);
+ int nbytes = strlen (pw->typed_passwd);
+ if (nbytes <= 0)
+ XBell (si->dpy, 0);
+ else
+ {
+ int i;
+ for (i = pw->typed_passwd_char_size[nchars-1]; i >= 0; i--)
+ {
+ if (nbytes < 0) abort();
+ pw->typed_passwd[nbytes--] = 0;
+ }
+ pw->typed_passwd_char_size[nchars-1] = 0;
+ }
+ }
+ break;
+
+ case '\012': case '\015': /* Enter */
+ finished_typing_passwd (si, pw);
+ break;
+
+ case '\033': /* Escape */
+ si->unlock_state = ul_cancel;
+ break;
+
+ case '\025': case '\030': /* Erase line */
+ memset (pw->typed_passwd, 0, sizeof (pw->typed_passwd));
+ memset (pw->typed_passwd_char_size, 0,
+ sizeof (pw->typed_passwd_char_size));
+ break;
+
+ default:
+ if (*decoded < ' ' && *decoded != '\t') /* Other ctrl char */