1case $CONFIG in
2    '') . ./config.sh ;;
3esac
4echo "Extracting newsetup (with variable substitutions)"
5$spitshell >newsetup <<!GROK!THIS!
6$startsh
7# $Id: newsetup.SH,v 3.0 1992/02/01 03:09:32 davison Trn $
8#
9# This software is Copyright 1991 by Stan Barber.
10#
11# Permission is hereby granted to copy, reproduce, redistribute or otherwise
12# use this software as long as: there is no monetary profit gained
13# specifically from the use or reproduction of this software, it is not
14# sold, rented, traded or otherwise marketed, and this copyright notice is
15# included prominently in any copy made.
16#
17# The author make no claims as to the fitness or correctness of this software
18# for any use whatsoever, and it is provided as is. Any use of this software
19# is at the user's own risk.
20
21export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
22
23: syntax: newsetup
24
25case $d_portable in
26define)
27    # where recordings, distributions and moderators are kept
28    lib=\`$filexp $newslib\`
29    # where important rn things are kept
30    rnlib=\`$filexp $privlib\`
31    nntplist=nntplist
32    ;;
33undef)
34    # where recordings, distributions and moderators are kept
35    lib="$newslib"
36    # where important rn things are kept
37    rnlib="$privlib"
38    nntplist=$bin/nntplist
39    ;;
40esac
41
42test=${test-test}
43echo=${echo-echo}
44cat=${cat-cat}
45mv=${mv-mv}
46rm=${rm-rm}
47cp=${cp-cp}
48
49!GROK!THIS!
50$cat >>newsetup <<'!NO!SUBS!'
51dotdir="${DOTDIR-${HOME-$LOGDIR}}"
52newsrc="$dotdir/.newsrc"
53tmp="${TMPDIR-/tmp}"
54
55subs="$lib/subscriptions"
56tmpsubs="$tmp/trnsubs.$$"
57
58$cat <<'EOH'
59
60Welcome to trn.  Here's some important things to remember:
61
62  o  Trn is an extension of rn and has a similar command syntax.
63  o  To access all the new features, specify the options -x and -X.  These
64     options MAY be on by default, but it won't hurt to be redundant.
65  o  Single-character commands don't require a carriage return -- only
66     commands that let you type in an argument.
67  o  At ANY prompt, you may type 'h' for help.  There are many different help
68     menus, depending on the context.  Also, typing <esc>h in the middle of a
69     multi-character command will list escape substitutions.
70  o  Typing a space to any prompt means to do the normal thing.  You could
71     spend all day reading news and never hit anything but the space bar.
72  o  If you have never used the news system before, you may find the articles
73     in news.announce.newusers to be helpful.
74  o  Please consult the man page for complete information.
75
76EOH
77
78$rm -f $newsrc-old
79$echo "Creating $newsrc to be used by news programs."
80
81if $test -s "$newsrc"; then
82    $echo "Saving your current one as $newsrc-old..."
83    $mv -f $newsrc $newsrc-old
84fi
85
86if $test -r $subs; then
87    $cp $subs $newsrc
88else
89    ($nntplist -o $tmpsubs subscriptions) >/dev/null 2>&1
90    if $test -s $tmpsubs; then
91	$cp $tmpsubs $newsrc
92    else
93	$cat <<EOM >$newsrc
94news.announce.newusers:
95EOM
96    fi
97    $rm -f $tmpsubs
98fi
99
100$cat <<'EOH'
101Done.
102
103To add new group use "a pattern" or "g newsgroup.name".  To get rid of
104newsgroups you aren't interested in, use the 'u' command.
105EOH
106!NO!SUBS!
107$eunicefix newsetup
108chmod 755 newsetup
109