~ubuntu-branches/ubuntu/wily/libuser/wily

« back to all changes in this revision

Viewing changes to apps/lchage.c

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Habouzit
  • Date: 2006-09-03 21:58:15 UTC
  • mto: (2.1.1 edgy) (1.1.5 upstream) (3.1.1 lenny)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20060903215815-rtvvfzhaer8ymyp4
Tags: upstream-0.54.6-2.1.dfsg.1
ImportĀ upstreamĀ versionĀ 0.54.6-2.1.dfsg.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
17
 */
18
18
 
19
 
#ident "$Id: lchage.c,v 1.30 2005/09/12 18:21:34 mitr Exp $"
 
19
#ident "$Id: lchage.c,v 1.31 2005/10/09 05:15:47 mitr Exp $"
20
20
 
21
21
#ifdef HAVE_CONFIG_H
22
22
#include "config.h"
77
77
static void
78
78
date_to_string(gint n_days, char *buf, size_t len)
79
79
{
80
 
        GDate *date;
81
 
 
82
80
        if ((n_days >= 0) && (n_days < 99999)) {
 
81
                GDate *date;
 
82
 
83
83
                date = g_date_new_dmy(1, G_DATE_JANUARY, 1970);
84
84
                g_date_add_days(date, n_days);
85
85
                g_date_strftime(buf, len, "%x", date);
90
90
int
91
91
main(int argc, const char **argv)
92
92
{
93
 
        char buf[LINE_MAX];
94
93
        long shadowMin = INVALID_LONG, shadowMax = INVALID_LONG,
95
94
             shadowLastChange = INVALID_LONG, shadowInactive = INVALID_LONG,
96
95
             shadowExpire = INVALID_LONG, shadowWarning = INVALID_LONG;
97
 
        const char *user = NULL;
98
 
        struct lu_context *ctx = NULL;
99
 
        struct lu_ent *ent = NULL;
 
96
        const char *user;
 
97
        struct lu_context *ctx;
 
98
        struct lu_ent *ent;
100
99
        struct lu_error *error = NULL;
101
 
        GValueArray *values, *values2, *values3;
102
 
        GValue value;
103
100
        int interactive = FALSE;
104
101
        int list_only = FALSE;
105
102
        int c;
171
168
        }
172
169
 
173
170
        if (list_only) {
 
171
                char buf[LINE_MAX];
 
172
                GValueArray *values, *values2, *values3;
 
173
 
174
174
                /* Just print out what we can find out, in a format similar
175
175
                 * to the chage(1) utility from the shadow suite. */
176
176
                if (lu_user_islocked(ctx, ent, &error)) {
228
228
                        printf(_("Account Expires:\t%s\n"), buf);
229
229
                }
230
230
        } else {
 
231
                GValue value;
 
232
 
231
233
                /* Set values using parameters given on the command-line. */
232
234
                memset(&value, 0, sizeof(value));
233
235
                g_value_init(&value, G_TYPE_LONG);