~ubuntu-branches/debian/stretch/alpine/stretch

« back to all changes in this revision

Viewing changes to pith/init.c

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2007-02-17 13:17:42 UTC
  • Revision ID: james.westby@ubuntu.com-20070217131742-99x5c6cpg1pbkdhw
Tags: upstream-0.82+dfsg
ImportĀ upstreamĀ versionĀ 0.82+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if !defined(lint) && !defined(DOS)
 
2
static char rcsid[] = "$Id: init.c 155 2006-09-29 23:28:46Z hubert@u.washington.edu $";
 
3
#endif
 
4
 
 
5
/*
 
6
 * ========================================================================
 
7
 * Copyright 2006 University of Washington
 
8
 *
 
9
 * Licensed under the Apache License, Version 2.0 (the "License");
 
10
 * you may not use this file except in compliance with the License.
 
11
 * You may obtain a copy of the License at
 
12
 *
 
13
 *     http://www.apache.org/licenses/LICENSE-2.0
 
14
 *
 
15
 * ========================================================================
 
16
 */
 
17
 
 
18
/*======================================================================
 
19
     init.c
 
20
     Routines for pine start up and initialization
 
21
  ====*/
 
22
 
 
23
 
 
24
#include "../pith/headers.h"
 
25
#include "../pith/init.h"
 
26
#include "../pith/conf.h"
 
27
#include "../pith/status.h"
 
28
#include "../pith/folder.h"
 
29
 
 
30
 
 
31
/*
 
32
 * Internal prototypes
 
33
 */
 
34
int      compare_sm_files(const qsort_t *, const qsort_t *);
 
35
 
 
36
 
 
37
 
 
38
/*----------------------------------------------------------------------
 
39
    Sets  login, full_username and home_dir
 
40
 
 
41
   Args: ps -- The Pine structure to put the user name, etc in
 
42
 
 
43
  Result: sets the fullname, login and home_dir field of the pine structure
 
44
          returns 0 on success, -1 if not.
 
45
  ----*/
 
46
 
 
47
init_username(struct pine *ps)
 
48
{
 
49
    char *expanded;
 
50
    int   rv;
 
51
 
 
52
    rv       = 0;
 
53
    expanded = NULL;
 
54
#if defined(DOS) || defined(OS2)
 
55
    if(ps->COM_USER_ID)
 
56
      expanded = expand_variables(tmp_20k_buf, SIZEOF_20KBUF,
 
57
                                  ps->COM_USER_ID, 0);
 
58
    
 
59
    if(!expanded && ps->vars[V_USER_ID].post_user_val.p)
 
60
      expanded = expand_variables(tmp_20k_buf, SIZEOF_20KBUF,
 
61
                                  ps->vars[V_USER_ID].post_user_val.p, 0);
 
62
 
 
63
    if(!expanded && ps->vars[V_USER_ID].main_user_val.p)
 
64
      expanded = expand_variables(tmp_20k_buf, SIZEOF_20KBUF,
 
65
                                  ps->vars[V_USER_ID].main_user_val.p, 0);
 
66
 
 
67
    if(!expanded)
 
68
      ps->blank_user_id = 1;
 
69
 
 
70
    ps->VAR_USER_ID = cpystr(expanded ? expanded : "");
 
71
#else
 
72
    ps->VAR_USER_ID = cpystr(ps->ui.login);
 
73
    if(!ps->VAR_USER_ID[0]){
 
74
        fprintf(stderr, "Who are you? (Unable to look up login name)\n");
 
75
        rv = -1;
 
76
    }
 
77
#endif
 
78
 
 
79
    expanded = NULL;
 
80
    if(ps->vars[V_PERSONAL_NAME].is_fixed){
 
81
        if(ps->FIX_PERSONAL_NAME){
 
82
            expanded = expand_variables(tmp_20k_buf, SIZEOF_20KBUF,
 
83
                                        ps->FIX_PERSONAL_NAME, 0);
 
84
        }
 
85
        if(ps->vars[V_PERSONAL_NAME].main_user_val.p ||
 
86
           ps->vars[V_PERSONAL_NAME].post_user_val.p){
 
87
            ps_global->give_fixed_warning = 1;
 
88
            ps_global->fix_fixed_warning = 1;
 
89
        }
 
90
        else if(ps->COM_PERSONAL_NAME)
 
91
          ps_global->give_fixed_warning = 1;
 
92
    }
 
93
    else{
 
94
        if(ps->COM_PERSONAL_NAME)
 
95
          expanded = expand_variables(tmp_20k_buf, SIZEOF_20KBUF,
 
96
                                      ps->COM_PERSONAL_NAME, 0);
 
97
 
 
98
        if(!expanded && ps->vars[V_PERSONAL_NAME].post_user_val.p)
 
99
          expanded = expand_variables(tmp_20k_buf, SIZEOF_20KBUF,
 
100
                              ps->vars[V_PERSONAL_NAME].post_user_val.p, 0);
 
101
 
 
102
        if(!expanded && ps->vars[V_PERSONAL_NAME].main_user_val.p)
 
103
          expanded = expand_variables(tmp_20k_buf, SIZEOF_20KBUF,
 
104
                              ps->vars[V_PERSONAL_NAME].main_user_val.p, 0);
 
105
    }
 
106
 
 
107
    if(!expanded){
 
108
        expanded = ps->ui.fullname;
 
109
#if defined(DOS) || defined(OS2)
 
110
        ps->blank_personal_name = 1;
 
111
#endif
 
112
    }
 
113
 
 
114
    ps->VAR_PERSONAL_NAME = cpystr(expanded ? expanded : "");
 
115
 
 
116
    dprint((1, "Userid: %s\nFullname: \"%s\"\n",
 
117
               ps->VAR_USER_ID, ps->VAR_PERSONAL_NAME));
 
118
    return(rv);
 
119
}
 
120
 
 
121
 
 
122
/*----------------------------------------------------------------------
 
123
    Sets  home_dir
 
124
 
 
125
   Args: ps -- The Pine structure to put the user name, etc in
 
126
 
 
127
  Result: sets the home_dir field of the pine structure
 
128
          returns 0 on success, -1 if not.
 
129
  ----*/
 
130
 
 
131
init_userdir(struct pine *ps)
 
132
{
 
133
    char fld_dir[MAXPATH+1];
 
134
 
 
135
    if(strlen(ps->home_dir) + strlen(ps->VAR_MAIL_DIRECTORY)+2 > MAXPATH){
 
136
        printf(_("Folders directory name is longer than %d\n"), MAXPATH);
 
137
        printf(_("Directory name: \"%s/%s\"\n"),ps->home_dir,
 
138
               ps->VAR_MAIL_DIRECTORY);
 
139
        return(-1);
 
140
    }
 
141
#if defined(DOS) || defined(OS2)
 
142
    if(ps->VAR_MAIL_DIRECTORY[1] == ':'){
 
143
        strncpy(fld_dir, ps->VAR_MAIL_DIRECTORY, sizeof(fld_dir)-1);
 
144
        fld_dir[sizeof(fld_dir)-1] = '\0';
 
145
    }
 
146
    else
 
147
#endif
 
148
    build_path(fld_dir, ps->home_dir, ps->VAR_MAIL_DIRECTORY, sizeof(fld_dir));
 
149
    ps->folders_dir = cpystr(fld_dir);
 
150
 
 
151
    return(0);
 
152
}
 
153
 
 
154
 
 
155
/*----------------------------------------------------------------------
 
156
        Fetch the hostname of the current system and put it in pine struct
 
157
 
 
158
   Args: ps -- The pine structure to put the hostname, etc in
 
159
 
 
160
  Result: hostname, localdomain, userdomain and maildomain are set
 
161
 
 
162
 
 
163
** Pine uses the following set of names:
 
164
  hostname -    The fully-qualified hostname.  Obtained with
 
165
                gethostbyname() which reads /etc/hosts or does a DNS
 
166
                lookup.  This may be blank.
 
167
  localdomain - The domain name without the host.  Obtained from the
 
168
                above hostname if it has a "." in it.  Removes first
 
169
                segment.  If hostname has no "." in it then the hostname
 
170
                is used.  This may be blank.
 
171
  userdomain -  Explicitly configured domainname.  This is read out of the
 
172
                global pine.conf or user's .pinerc.  The user's entry in the
 
173
                .pinerc overrides.
 
174
 
 
175
** Pine has the following uses for such names:
 
176
 
 
177
  1. On outgoing messages in the From: line
 
178
        Uses userdomain if there is one.  If not uses, uses
 
179
        hostname unless Pine has been configured to use localdomain.
 
180
 
 
181
  2. When expanding/fully-qualifying unqualified addresses during
 
182
     composition
 
183
        (same as 1)
 
184
 
 
185
  3. When expanding/fully-qualifying unqualified addresses during
 
186
     composition when a local entry in the password file exists for
 
187
     name.
 
188
        If no userdomain is given, then this lookup is always done
 
189
        and the hostname is used unless Pine's been configured to 
 
190
        use the localdomain.  If userdomain is defined, it is used,
 
191
        but no local lookup is done.  We can't assume users on the
 
192
        local host are valid in the given domain (and, for simplicity,
 
193
        have chosen to ignore the cases userdomain matches localdomain
 
194
        or localhost).  Setting user-lookup-even-if-domain-mismatch
 
195
        feature will tell pine to override this behavior and perform
 
196
        the local lookup anyway.  The problem of a global "even-if"
 
197
        set and a .pinerc-defined user-domain of something odd causing
 
198
        the local lookup, but this will only effect the personal name, 
 
199
        and is not judged to be a significant problem.
 
200
 
 
201
  4. In determining if an address is that of the current pine user for
 
202
     formatting index and filtering addresses when replying
 
203
        If a userdomain is specified the address must match the
 
204
        userdomain exactly.  If a userdomain is not specified or the
 
205
        userdomain is the same as the hostname or domainname, then
 
206
        an address will be considered the users if it matches either
 
207
        the domainname or the hostname.  Of course, the userid must
 
208
        match too. 
 
209
 
 
210
  5. In Message ID's
 
211
        The fully-qualified hostname is always users here.
 
212
 
 
213
 
 
214
** Setting the domain names
 
215
  To set the domain name for all Pine users on the system to be
 
216
different from what Pine figures out from DNS, set the domain name in
 
217
the "user-domain" variable in pine.conf.  To set the domain name for an
 
218
individual user, set the "user-domain" variable in his .pinerc.
 
219
The .pinerc setting overrides any other setting.
 
220
 ----*/
 
221
init_hostname(struct pine *ps)
 
222
{
 
223
    char hostname[MAX_ADDRESS+1], domainname[MAX_ADDRESS+1];
 
224
 
 
225
    getdomainnames(hostname, sizeof(hostname)-1,
 
226
                   domainname, sizeof(domainname)-1);
 
227
 
 
228
    if(ps->hostname)
 
229
      fs_give((void **)&ps->hostname);
 
230
 
 
231
    ps->hostname = cpystr(hostname);
 
232
 
 
233
    if(ps->localdomain)
 
234
      fs_give((void **)&ps->localdomain);
 
235
 
 
236
    ps->localdomain = cpystr(domainname);
 
237
    ps->userdomain  = NULL;
 
238
 
 
239
    if(ps->VAR_USER_DOMAIN && ps->VAR_USER_DOMAIN[0]){
 
240
        ps->maildomain = ps->userdomain = ps->VAR_USER_DOMAIN;
 
241
    }else{
 
242
#if defined(DOS) || defined(OS2)
 
243
        if(ps->VAR_USER_DOMAIN)
 
244
          ps->blank_user_domain = 1;    /* user domain set to null string! */
 
245
 
 
246
        ps->maildomain = ps->localdomain[0] ? ps->localdomain : ps->hostname;
 
247
#else
 
248
        ps->maildomain = strucmp(ps->VAR_USE_ONLY_DOMAIN_NAME, "yes")
 
249
                          ? ps->hostname : ps->localdomain;
 
250
#endif
 
251
    }
 
252
 
 
253
    /*
 
254
     * Tell c-client what domain to use when completing unqualified
 
255
     * addresses it finds in local mailboxes.  Remember, it won't 
 
256
     * affect what's to the right of '@' for unqualified addresses in
 
257
     * remote folders...
 
258
     */
 
259
    mail_parameters(NULL, SET_LOCALHOST, (void *) ps->maildomain);
 
260
    if(F_OFF(F_QUELL_MAILDOMAIN_WARNING, ps) && !strchr(ps->maildomain, '.')){
 
261
        snprintf(tmp_20k_buf, SIZEOF_20KBUF, _("Incomplete maildomain \"%s\"."),
 
262
                ps->maildomain);
 
263
        init_error(ps, SM_ORDER | SM_DING, 3, 5, tmp_20k_buf);
 
264
        strncpy(tmp_20k_buf,
 
265
               _("Return address in mail you send may be incorrect."), SIZEOF_20KBUF);
 
266
        tmp_20k_buf[SIZEOF_20KBUF-1] = '\0';
 
267
        init_error(ps, SM_ORDER | SM_DING, 3, 5, tmp_20k_buf);
 
268
    }
 
269
 
 
270
    dprint((1,"User domain name being used \"%s\"\n",
 
271
               ps->userdomain == NULL ? "" : ps->userdomain));
 
272
    dprint((1,"Local Domain name being used \"%s\"\n",
 
273
               ps->localdomain ? ps->localdomain : "?"));
 
274
    dprint((1,"Host name being used \"%s\"\n",
 
275
               ps->hostname ? ps->hostname : "?"));
 
276
    dprint((1,
 
277
               "Mail Domain name being used (by c-client too) \"%s\"\n",
 
278
               ps->maildomain ? ps->maildomain : "?"));
 
279
 
 
280
    if(!ps->maildomain || !ps->maildomain[0]){
 
281
#if defined(DOS) || defined(OS2)
 
282
        if(ps->blank_user_domain)
 
283
          return(0);            /* prompt for this in send.c:dos_valid_from */
 
284
#endif
 
285
        fprintf(stderr, _("No host name or domain name set\n"));
 
286
        return(-1);
 
287
    }
 
288
    else
 
289
      return(0);
 
290
}
 
291
 
 
292
 
 
293
/*----------------------------------------------------------------------
 
294
  Make sure the default save folders exist in the default
 
295
  save context.
 
296
  ----*/
 
297
void
 
298
init_save_defaults(void)
 
299
{
 
300
    CONTEXT_S  *save_cntxt;
 
301
 
 
302
    if(!ps_global->VAR_DEFAULT_FCC ||
 
303
       !*ps_global->VAR_DEFAULT_FCC ||
 
304
       !ps_global->VAR_DEFAULT_SAVE_FOLDER ||
 
305
       !*ps_global->VAR_DEFAULT_SAVE_FOLDER)
 
306
      return;
 
307
 
 
308
    if(!(save_cntxt = default_save_context(ps_global->context_list)))
 
309
      save_cntxt = ps_global->context_list;
 
310
 
 
311
    if(!(folder_exists(save_cntxt, ps_global->VAR_DEFAULT_FCC) & FEX_ISFILE))
 
312
      context_create(save_cntxt, NULL, ps_global->VAR_DEFAULT_FCC);
 
313
 
 
314
    if(!(folder_exists(save_cntxt, ps_global->VAR_DEFAULT_SAVE_FOLDER) &
 
315
                                                                 FEX_ISFILE))
 
316
      context_create(save_cntxt, NULL, ps_global->VAR_DEFAULT_SAVE_FOLDER);
 
317
 
 
318
    free_folder_list(save_cntxt);
 
319
}
 
320
 
 
321
 
 
322
/*----------------------------------------------------------------------
 
323
      Put sent-mail files in date order 
 
324
 
 
325
   Args: a, b  -- The names of two files.  Expects names to be sent-mail-mmm-yy
 
326
                  Other names will sort in order and come before those
 
327
                  in above format.
 
328
 ----*/
 
329
int   
 
330
compare_sm_files(const qsort_t *aa, const qsort_t *bb)
 
331
{
 
332
    struct sm_folder *a = (struct sm_folder *)aa,
 
333
                     *b = (struct sm_folder *)bb;
 
334
 
 
335
    if(a->month_num == -1 && b->month_num == -1)
 
336
      return(strucmp(a->name, b->name));
 
337
    if(a->month_num == -1)      return(-1);
 
338
    if(b->month_num == -1)      return(1);
 
339
 
 
340
    return(a->month_num - b->month_num);
 
341
}
 
342
 
 
343
 
 
344
 
 
345
/*----------------------------------------------------------------------
 
346
      Create an ordered list of sent-mail folders and their month numbers
 
347
 
 
348
   Args: dir -- The directory to find the list of files in
 
349
 
 
350
 Result: Pointer to list of files is returned. 
 
351
 
 
352
This list includes all files that start with "sent-mail", but not "sent-mail" 
 
353
itself.
 
354
  ----*/
 
355
struct sm_folder *
 
356
get_mail_list(CONTEXT_S *list_cntxt, char *folder_base)
 
357
{
 
358
#define MAX_FILES  (150)
 
359
    register struct sm_folder *sm  = NULL;
 
360
    struct sm_folder          *sml = NULL;
 
361
    char                      *filename;
 
362
    int                        i, folder_base_len;
 
363
    char                       searchname[MAXPATH+1];
 
364
 
 
365
    sml = sm = (struct sm_folder *)fs_get(sizeof(struct sm_folder)*MAX_FILES);
 
366
    memset((void *)sml, 0, sizeof(struct sm_folder) * MAX_FILES);
 
367
    if((folder_base_len = strlen(folder_base)) == 0 || !list_cntxt){
 
368
        sml->name = cpystr("");
 
369
        return(sml);
 
370
    }
 
371
 
 
372
#ifdef  DOS
 
373
    if(*list_cntxt->context != '{'){    /* NOT an IMAP collection! */
 
374
        snprintf(searchname, sizeof(searchname), "%4.4s*", folder_base);
 
375
        folder_base_len = strlen(searchname) - 1;
 
376
    }
 
377
    else
 
378
#endif
 
379
    snprintf(searchname, sizeof(searchname), "%.*s*", sizeof(searchname)-2, folder_base);
 
380
 
 
381
    build_folder_list(NULL, list_cntxt, searchname, NULL, BFL_FLDRONLY);
 
382
    for(i = 0; i < folder_total(FOLDERS(list_cntxt)); i++){
 
383
        filename = folder_entry(i, FOLDERS(list_cntxt))->name;
 
384
#ifdef  DOS
 
385
        if(struncmp(filename, folder_base, folder_base_len) == 0
 
386
           && strucmp(filename, folder_base)){
 
387
 
 
388
        if(*list_cntxt->context != '{'){
 
389
            int j;
 
390
            for(j = 0; j < 4; j++)
 
391
              if(!isdigit((unsigned char)filename[folder_base_len + j]))
 
392
                break;
 
393
 
 
394
           if(j < 4)            /* not proper date format! */
 
395
             continue;          /* keep trying */
 
396
        }
 
397
#else
 
398
#ifdef OS2
 
399
        if(strnicmp(filename, folder_base, folder_base_len) == 0
 
400
           && stricmp(filename, folder_base)){
 
401
#else
 
402
        if(strncmp(filename, folder_base, folder_base_len) == 0
 
403
           && strcmp(filename, folder_base)){
 
404
#endif
 
405
#endif
 
406
            sm->name = cpystr(filename);
 
407
#ifdef  DOS
 
408
            if(*list_cntxt->context != '{'){ /* NOT an IMAP collection! */
 
409
                sm->month_num  = (sm->name[folder_base_len] - '0') * 10;
 
410
                sm->month_num += sm->name[folder_base_len + 1] - '0';
 
411
            }
 
412
            else
 
413
#endif
 
414
            sm->month_num = month_num(sm->name + (size_t)folder_base_len + 1);
 
415
            sm++;
 
416
            if(sm >= &sml[MAX_FILES - 1])
 
417
               break; /* Too many files, ignore the rest ; shouldn't occur */
 
418
        }
 
419
    }
 
420
 
 
421
    sm->name = cpystr("");
 
422
 
 
423
    /* anything to sort?? */
 
424
    if(sml->name && *(sml->name) && (sml+1)->name && *((sml+1)->name)){
 
425
        qsort(sml,
 
426
              sm - sml,
 
427
              sizeof(struct sm_folder),
 
428
              compare_sm_files);
 
429
    }
 
430
 
 
431
    return(sml);
 
432
}
 
433
 
 
434
 
 
435
 
 
436
int
 
437
check_prune_time(time_t *now, struct tm **tm_now)
 
438
{
 
439
    char tmp[50];
 
440
 
 
441
    *now = time((time_t *) 0);
 
442
    *tm_now = localtime(now);
 
443
 
 
444
    /*
 
445
     * If the last time we did this is blank (as if pine's run for
 
446
     * first time), don't go thru list asking, but just note it for 
 
447
     * the next time...
 
448
     */
 
449
    if(ps_global->VAR_LAST_TIME_PRUNE_QUESTION == NULL){
 
450
        ps_global->last_expire_year = (*tm_now)->tm_year;
 
451
        ps_global->last_expire_month = (*tm_now)->tm_mon;
 
452
        snprintf(tmp, sizeof(tmp), "%d.%d", ps_global->last_expire_year,
 
453
                ps_global->last_expire_month + 1);
 
454
        set_variable(V_LAST_TIME_PRUNE_QUESTION, tmp, 1, 1, Main);
 
455
        return(0);
 
456
    }
 
457
 
 
458
    if(ps_global->last_expire_year != -1 &&
 
459
      ((*tm_now)->tm_year <  ps_global->last_expire_year ||
 
460
       ((*tm_now)->tm_year == ps_global->last_expire_year &&
 
461
        (*tm_now)->tm_mon <= ps_global->last_expire_month)))
 
462
      return(0); 
 
463
    
 
464
    return(1);
 
465
}
 
466
 
 
467
 
 
468
int
 
469
first_run_of_month(void)
 
470
{
 
471
    time_t     now;
 
472
    struct tm *tm_now;
 
473
 
 
474
    now = time((time_t *) 0);
 
475
    tm_now = localtime(&now);
 
476
 
 
477
    if(ps_global->last_expire_year == -1 ||
 
478
      (tm_now->tm_year <  ps_global->last_expire_year ||
 
479
       (tm_now->tm_year == ps_global->last_expire_year &&
 
480
        tm_now->tm_mon <= ps_global->last_expire_month)))
 
481
      return(0); 
 
482
 
 
483
    return(1);
 
484
}
 
485
 
 
486
 
 
487
int
 
488
first_run_of_year(void)
 
489
{
 
490
    time_t     now;
 
491
    struct tm *tm_now;
 
492
 
 
493
    now = time((time_t *) 0);
 
494
    tm_now = localtime(&now);
 
495
 
 
496
    if(ps_global->last_expire_year == -1 ||
 
497
      (tm_now->tm_year <=  ps_global->last_expire_year))
 
498
      return(0); 
 
499
 
 
500
    return(1);
 
501
}
 
502
 
 
503
 
 
504
/*----------------------------------------------------------------------
 
505
     Check pruned-folders for validity, making sure they are in the 
 
506
     same context as sent-mail.
 
507
 
 
508
  ----*/
 
509
int
 
510
prune_folders_ok(void)
 
511
{
 
512
    char **p;
 
513
 
 
514
    for(p = ps_global->VAR_PRUNED_FOLDERS; p && *p && **p; p++)
 
515
      if(!context_isambig(*p))
 
516
        return(0);
 
517
 
 
518
    return(1);
 
519
}
 
520
 
 
521
 
 
522
/*
 
523
 * prune_move_folder - rename folder in context and delete old copy
 
524
 * Returns -1 if unsuccessful.
 
525
 */
 
526
int
 
527
prune_move_folder(char *oldpath, char *newpath, CONTEXT_S *prune_cntxt)
 
528
{
 
529
    MAILSTREAM *prune_stream = NULL;
 
530
    char spath[MAXPATH+1];
 
531
 
 
532
    strncpy(spath, oldpath, sizeof(spath)-1);
 
533
    spath[sizeof(spath)-1] = '\0';
 
534
 
 
535
    /*--- User says OK to rename ---*/
 
536
    dprint((5, "rename \"%.100s\" to \"%.100s\"\n",
 
537
           spath ? spath : "?", newpath ? newpath : "?"));
 
538
    q_status_message1(SM_ORDER, 1, 3,
 
539
                      /* TRANSLATORS: arg is a filename */
 
540
                      _("Renaming \"%.200s\" at start of month"),
 
541
                      pretty_fn(spath ? spath : "?"));
 
542
 
 
543
    if(!context_rename(prune_cntxt, NULL, spath, newpath)){
 
544
        q_status_message2(SM_ORDER | SM_DING, 3, 4,
 
545
                          /* TRANSLATORS: 1st arg is filename, 2nd is error message */
 
546
                          _("Error renaming \"%.200s\": %.200s"),
 
547
                          pretty_fn(spath ? spath : "?"),
 
548
                          error_description(errno));
 
549
        dprint((1, "Error renaming %.100s to %.100s: %.100s\n",
 
550
                   spath ? spath : "?", newpath ? newpath : "?",
 
551
                   error_description(errno)));
 
552
        display_message('x');
 
553
        return -1;
 
554
    }
 
555
 
 
556
    context_create(prune_cntxt, NULL, spath);
 
557
 
 
558
    return 0;
 
559
}