* New version 2.26
[alpine.git] / alpine / osdep / chnge_pw.c
blobb4612aeee2a7dd391d6d62dc5e0c6236087d3bcb
1 /*
2 * ========================================================================
3 * Copyright 2006-2007 University of Washington
4 * Copyright 2013-2022 Eduardo Chappa
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
15 #include <system.h> /* os-dep defs/includes */
16 #include <general.h> /* generally useful definitions */
18 #include "../../c-client/mail.h" /* for MAILSTREAM and friends */
19 #include "../../c-client/osdep.h"
20 #include "../../c-client/rfc822.h" /* for soutr_t and such */
21 #include "../../c-client/misc.h" /* for cpystr proto */
22 #include "../../c-client/utf8.h" /* for CHARSET and such*/
23 #include "../../c-client/imap4r1.h"
25 #include "../../pith/osdep/color.h"
26 #include "../../pith/state.h"
28 #include "termin.gen.h"
29 #include "termout.gen.h"
30 #include "chnge_pw.h"
32 /*----------------------------------------------------------------------
33 Call the system to change the passwd
35 It would be nice to talk to the passwd program via a pipe or ptty so the
36 user interface could be consistent, but we can't count on the the prompts
37 and responses from the passwd program to be regular so we just let the user
38 type at the passwd program with some screen space, hope he doesn't scroll
39 off the top and repaint when he's done.
40 ----*/
41 void
42 change_passwd(void)
44 #ifdef PASSWD_PROG
45 char cmd_buf[100];
47 ClearLines(1, ps_global->ttyo->screen_rows - 1);
49 MoveCursor(5, 0);
50 fflush(stdout);
52 PineRaw(0);
53 strncpy(cmd_buf, PASSWD_PROG, sizeof(cmd_buf));
54 cmd_buf[sizeof(cmd_buf)-1] = '\0';
55 system(cmd_buf);
56 sleep(3);
57 PineRaw(1);
58 #endif /* PASSWD_PROG */