13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 |
* General Public License for more details. |
* General Public License for more details. |
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with WinPT; if not, write to the Free Software Foundation, |
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
16 |
*/ |
*/ |
|
|
|
17 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
18 |
#include <config.h> |
#include <config.h> |
19 |
#endif |
#endif |
29 |
#include "wptContext.h" |
#include "wptContext.h" |
30 |
#include "wptKeyEdit.h" |
#include "wptKeyEdit.h" |
31 |
#include "wptErrors.h" |
#include "wptErrors.h" |
32 |
|
#include "wptTypes.h" |
33 |
|
|
34 |
|
|
35 |
/* Possible errors for the edit key operation. */ |
/* Possible errors for the edit key operation. */ |
36 |
enum editkey_error_t { |
enum editkey_error_t { |
51 |
int uid = ctx->getUseridIndex (); |
int uid = ctx->getUseridIndex (); |
52 |
ctx->cmd_sent = 1; |
ctx->cmd_sent = 1; |
53 |
if (uid != -1) { |
if (uid != -1) { |
54 |
sprintf (buf, "uid %d", ctx->getUseridIndex ()); |
_snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ()); |
55 |
return buf; |
return buf; |
56 |
} |
} |
57 |
} |
} |
78 |
int uid = ctx->getUseridIndex (); |
int uid = ctx->getUseridIndex (); |
79 |
ctx->cmd_sent = 1; |
ctx->cmd_sent = 1; |
80 |
if (uid != -1) { |
if (uid != -1) { |
81 |
sprintf (buf, "uid %d", ctx->getUseridIndex ()); |
_snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ()); |
82 |
return buf; |
return buf; |
83 |
} |
} |
84 |
} |
} |
110 |
if (ctx->getUseridIndex () != -1 && |
if (ctx->getUseridIndex () != -1 && |
111 |
ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
112 |
ctx->cnt++; |
ctx->cnt++; |
113 |
sprintf (buf, "uid %d", ctx->getUseridIndex ()); |
_snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ()); |
114 |
return buf; |
return buf; |
115 |
} |
} |
116 |
|
|
213 |
static char buf[64]; |
static char buf[64]; |
214 |
|
|
215 |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
216 |
sprintf (buf, "uid %d", ctx->getUseridIndex ()); |
_snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ()); |
217 |
ctx->cnt = 1; |
ctx->cnt = 1; |
218 |
return buf; |
return buf; |
219 |
} |
} |
241 |
static int sig_cnt = 0; |
static int sig_cnt = 0; |
242 |
|
|
243 |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
244 |
sprintf (buf, "uid %d", ctx->getUseridIndex ()); |
_snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ()); |
245 |
ctx->cnt = 1; |
ctx->cnt = 1; |
246 |
return buf; |
return buf; |
247 |
} |
} |
275 |
static char buf[64]; |
static char buf[64]; |
276 |
|
|
277 |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
278 |
sprintf (buf, "key %d", ctx->getKeyIndex ()); |
_snprintf (buf, DIM (buf)-1, "key %d", ctx->getKeyIndex ()); |
279 |
ctx->cnt = 1; |
ctx->cnt = 1; |
280 |
return buf; |
return buf; |
281 |
} |
} |
429 |
static char buf[64]; |
static char buf[64]; |
430 |
|
|
431 |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
432 |
sprintf (buf, "uid %d", ctx->getUseridIndex ()); |
_snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ()); |
433 |
ctx->cnt = 1; |
ctx->cnt = 1; |
434 |
return buf; |
return buf; |
435 |
} |
} |
457 |
static char buf[64]; |
static char buf[64]; |
458 |
|
|
459 |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
460 |
sprintf (buf, "key %d", ctx->getKeyIndex ()); |
_snprintf (buf, DIM (buf)-1, "key %d", ctx->getKeyIndex ()); |
461 |
ctx->cnt = 1; |
ctx->cnt = 1; |
462 |
return buf; |
return buf; |
463 |
} |
} |
492 |
|
|
493 |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) { |
494 |
ctx->cnt = 1; |
ctx->cnt = 1; |
495 |
sprintf (buf, "uid %d", ctx->getUseridIndex ()); |
_snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ()); |
496 |
return buf; |
return buf; |
497 |
} |
} |
498 |
else if (ctx->cnt == 1 && !strcmp (key, "keyedit.prompt")) { |
else if (ctx->cnt == 1 && !strcmp (key, "keyedit.prompt")) { |
534 |
static char buf[64]; |
static char buf[64]; |
535 |
|
|
536 |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt" )) { |
if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt" )) { |
537 |
sprintf( buf, "uid %d", ctx->getUseridIndex ()); |
_snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ()); |
538 |
ctx->cnt = 1; |
ctx->cnt = 1; |
539 |
return buf; |
return buf; |
540 |
} |
} |
583 |
static char buf[64]; |
static char buf[64]; |
584 |
|
|
585 |
if (ctx->cnt == 0 && !strcmp ( key, "keyedit.prompt" ) ) { |
if (ctx->cnt == 0 && !strcmp ( key, "keyedit.prompt" ) ) { |
586 |
sprintf( buf, "key %d", ctx->getKeyIndex ()); |
_snprintf (buf, DIM (buf)-1, "key %d", ctx->getKeyIndex ()); |
587 |
ctx->cnt = 1; |
ctx->cnt = 1; |
588 |
return buf; |
return buf; |
589 |
} |
} |