Rocco Rutte:
[apps/madmutt.git] / contrib / update-config.pl
1 #!/usr/bin/perl -w
2
3 # purpose:
4 # update var names for mutt-ng
5 # update:
6 # grep ', DT_SYN' init.h | awk -F , '{print $1 $4}' | sed -e 's/[{UL]//g' -e 's/"  "/" => "/g'
7
8 use strict;
9
10 my %opts = (
11   # left from the first run of cleanup+removal
12   " edit_hdrs"                   => " edit_headers",
13   " forw_decode"                 => " forward_decode",
14   " forw_format"                 => " forward_format",
15   " forw_quote"                  => " forward_quote",
16   " hdr_format"                  => " index_format",
17   " indent_str"                  => " indent_string",
18   " mime_fwd"                    => " mime_forward",
19   " msg_format"                  => " message_format",
20   " pgp_autosign"                => " crypt_autosign",
21   " pgp_autoencrypt"             => " crypt_autoencrypt",
22   " pgp_replyencrypt"            => " crypt_replyencrypt",
23   " pgp_replysign"               => " crypt_replysign",
24   " pgp_replysignencrypted"      => " crypt_replysignencrypted",
25   " pgp_verify_sig"              => " crypt_verify_sig",
26   " pgp_create_traditional"      => " pgp_autoinline",
27   " pgp_auto_traditional"        => " pgp_replyinline",
28   " forw_decrypt"                => " forward_decrypt",
29   " smime_sign_as"               => " smime_default_key",
30   " post_indent_str"             => " post_indent_string",
31   " print_cmd"                   => " print_command",
32   " shorten_hierarchy"           => " sidebar_shorten_hierarchy",
33   # current run
34   "ask_followup_to"              => "nntp_ask_followup_to", 
35   "ask_x_comment_to"             => "nntp_ask_x_comment_to", 
36   "catchup_newsgroup"            => "nntp_catchup", 
37   "followup_to_poster"           => "nntp_followup_to_poster", 
38   "group_index_format"           => "nntp_group_index_format", 
39   "inews"                        => "nntp_inews", 
40   "mime_subject"                 => "nntp_mime_subject", 
41   "news_cache_dir"               => "nntp_cache_dir", 
42   "news_server"                  => "nntp_host", 
43   "newsrc"                       => "nntp_newsrc", 
44   "nntp_poll"                    => "nntp_mail_check", 
45   "pop_checkinterval"            => "pop_mail_check", 
46   "post_moderated"               => "nntp_post_moderated", 
47   "save_unsubscribed"            => "nntp_save_unsubscribed", 
48   "show_new_news"                => "nntp_show_new_news", 
49   "show_only_unread"             => "nntp_show_only_unread", 
50   "x_comment_to"                 => "nntp_x_comment_to"
51 );
52
53 if (@ARGV == 0) {
54   die "Usage: $0 <conffiles>\n";
55 }
56
57 foreach my $f (@ARGV) {
58   if (open (INPUT, "<" . $f)) {
59     my @l = ();
60     while (<INPUT>) {
61       foreach my $v (keys %opts) {
62         $_ =~ s/($v)/$opts{$1}/;
63       }
64       push (@l, $_);
65     }
66     close (INPUT);
67     if (open (OUTPUT, ">" . $f)) {
68       print OUTPUT @l;
69       close (OUTPUT);
70     }
71   }
72 }