* Update to version 2.19.5
[alpine.git] / alpine / osdep / chnge_pw.c
blob6bbff177c5cf80bf5319264c369fc43e64bfb3b4
1 #if !defined(lint) && !defined(DOS)
2 static char rcsid[] = "$Id: chnge_pw.c 769 2007-10-24 00:15:40Z hubert@u.washington.edu $";
3 #endif
5 /*
6 * ========================================================================
7 * Copyright 2006-2007 University of Washington
8 * Copyright 2013-2014 Eduardo Chappa
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * ========================================================================
19 #include <system.h> /* os-dep defs/includes */
20 #include <general.h> /* generally useful definitions */
22 #include "../../c-client/mail.h" /* for MAILSTREAM and friends */
23 #include "../../c-client/osdep.h"
24 #include "../../c-client/rfc822.h" /* for soutr_t and such */
25 #include "../../c-client/misc.h" /* for cpystr proto */
26 #include "../../c-client/utf8.h" /* for CHARSET and such*/
27 #include "../../c-client/imap4r1.h"
29 #include "../../pith/osdep/color.h"
30 #include "../../pith/state.h"
32 #include "termin.gen.h"
33 #include "termout.gen.h"
34 #include "chnge_pw.h"
36 /*----------------------------------------------------------------------
37 Call the system to change the passwd
39 It would be nice to talk to the passwd program via a pipe or ptty so the
40 user interface could be consistent, but we can't count on the the prompts
41 and responses from the passwd program to be regular so we just let the user
42 type at the passwd program with some screen space, hope he doesn't scroll
43 off the top and repaint when he's done.
44 ----*/
45 void
46 change_passwd(void)
48 #ifdef PASSWD_PROG
49 char cmd_buf[100];
51 ClearLines(1, ps_global->ttyo->screen_rows - 1);
53 MoveCursor(5, 0);
54 fflush(stdout);
56 PineRaw(0);
57 strncpy(cmd_buf, PASSWD_PROG, sizeof(cmd_buf));
58 cmd_buf[sizeof(cmd_buf)-1] = '\0';
59 system(cmd_buf);
60 sleep(3);
61 PineRaw(1);
62 #endif /* PASSWD_PROG */