File: modconfig

package info (click to toggle)
eggdrop 1.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,596 kB
  • sloc: ansic: 65,863; javascript: 8,908; sh: 5,337; tcl: 3,801; makefile: 1,771; python: 121
file content (711 lines) | stat: -rwxr-xr-x 17,322 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
#! /bin/sh
#
# modconfig
#
# Copyright (C) 2000 - 2025 Eggheads Development Team
# Written by Fabian Knittel
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.


mc_pn=`echo $0 | sed -e 's/^.*\///'`
mc_top_srcdir=
mc_srcdir=
mc_bindir=.

mc_flag_quiet=no
mc_flag_onlynew=no


#  Read options
while true; do
	case ${1} in
	--top_srcdir=*)
		mc_top_srcdir=`echo ${1} | sed -e 's/^--top_srcdir=//'`
	;;
	--top_srcdir)
		shift
		mc_top_srcdir=${1}
	;;
	--srcdir=*)
		mc_srcdir=`echo ${1} | sed -e 's/^--srcdir=//'`
	;;
	--srcdir)
		shift
		mc_srcdir=${1}
	;;
	--bindir=*)
		mc_bindir=`echo ${1} | sed -e 's/^--bindir=//'`
	;;
	--bindir)
		shift
		mc_bindir=${1}
	;;
	--quiet|-q)
		mc_flag_quiet=yes
	;;
	--only-new|-n)
		mc_flag_onlynew=yes
	;;
	--*)
		echo "${mc_pn}: warning: unknown option \`${1}'." 2>&1
	;;
	*)
		#  Non-option parameter.
		break
	;;
	esac

	#  Break out of loop if there are no more arguments to process.
	if shift; then
		:
	else
		break;
	fi
done

#  Find srcdir and top_srcdir
if test "x${mc_srcdir}" = x; then
	if test "x${mc_top_srcdir}" != x; then
		mc_srcdir=${mc_top_srcdir}/src
	else
		echo "${mc_pn}: error: could not find src directory." 2>&1
		exit 1
	fi
fi
if test "x${mc_top_srcdir}" = x; then
	if test "x${mc_srcdir}" != x; then
		mc_top_srcdir=${mc_srcdir}/..
	else
		echo "${mc_pn}: error: could not find top src directory." 2>&1
		exit 1
	fi
fi


#
#  Files
#

#  List of all selected modules (including the `.mod' at the end)
mc_fmodules=${mc_bindir}/.modules

#  List of all modules we have detected so far.
mc_fknownmods=${mc_bindir}/.known_modules

#  List of modules disabled by default
mc_fdisabledmods=${mc_top_srcdir}/disabled_modules

mc_mod_dir=${mc_srcdir}/mod

mc_mod_bin_dir=${mc_bindir}/src/mod
mc_fMakefile=${mc_mod_bin_dir}/Makefile

mc_fstatic_h=${mc_mod_dir}/static.h


#  File descriptor usage:
#    1  Standard output
#    2  Errors
#
#    6  Misc messages and warnings
#    7  Goes to /dev/null
exec 7>/dev/null
if test "${mc_flag_quiet}" = yes; then
	exec 6>&7
else
	exec 6>&1
fi

#  Detect flags needed to achieve 'echo -n' (originally from GNU autoconf) ...
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
	#  Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
	if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null
	then
		mc_n= mc_c='
' mc_t='        '
	else
		mc_n=-n mc_c= mc_t=
	fi
else
	mc_n= mc_c='\c' mc_t=
fi

#  This helps us call ourself.
mc_self_call="$0 --srcdir=${mc_srcdir} --top_srcdir=${mc_topsrcdir}"

#  Assign parameters
mc_cmd=$1
if test "x${mc_cmd}" != x; then
	shift
	mc_paras=$*
fi

case x${mc_cmd} in
xhelp)
#
#  Display help
#

	cat 1>&6 <<EOF
Usage: ${mc_pn} [OPTIONS] COMMAND

Commands:
    add                  Add a module to the list of active eggdrop modules.
    del                  Remove a module from that list.
    clear                Clear the list.
    static.h             Create \`src/mod/static.h'.
    Makefile             Create \`src/mod/Makefile'.
    configure            Interactively select modules.
    is-configured        Exits 0/1 depending on whether modules where
                           configured or not.
    update-depends       Check all module dependencies and add modules missing.
    help                 Displays this information.
    detect-modules       Find all available modules.
    modules-still-exist  Check whether all known modules still exist.

Options:
    --top_srcdir=DIR     Top directory         (At least one of these two
    --srcdir=DIR         Source directory       directories MUST be supplied.)
    --bindir=DIR         Binary directory
    --quiet [-q]         Quiet mode. Only show errors.

Options specific to the \`configure' command:

    --only-new [-n]      Only query new modules.
EOF
;;
xis-configured)
#
#  Determine whether the modules were configured yet.
#

	if test -r "${mc_fmodules}"; then
		exit 0
	else
		exit 1
	fi
;;
xmodules-still-exist)
#
#  Check whether all known modules still exist.
#

	if ${mc_self_call} -q is-configured; then
		mc_known_mods=`cat ${mc_fknownmods}`

		echo ${mc_n} "Checking for removed modules...${mc_c}" 1>&6
		#  Check whether all known mods still exist
		for mc_mod in ${mc_known_mods}; do
			echo ${mc_n} ".${mc_c}" >&6
			if test ! -d ${mc_mod_dir}/${mc_mod}; then
				grep -v "^${mc_mod}$" ${mc_fknownmods} > ${mc_fknownmods}_new
				mv ${mc_fknownmods}_new ${mc_fknownmods}
			fi
		done
		echo " done." 1>&6
	fi
;;
xdetect-modules)
#
#  Detect modules. Active modules will be added to the `.modules' file. The
#  behaviour changes as soon as `.modules' already exists.
#

	echo ${mc_n} "Detecting modules...${mc_c}" >&6

	if ${mc_self_call} -q is-configured; then
		mc_mods_configured=yes

		mv ${mc_fmodules} ${mc_fmodules}_old

		mc_fmodules_old=${mc_fmodules}
		mc_fmodules=${mc_fmodules}_old
	else
		mc_mods_configured=no

		mc_fmodules_old=
	fi

	mc_mods=`echo ${mc_srcdir}/mod/*.mod | sed -e 's/\.mod//g'`
	if test "${mc_mods}" = "${mc_srcdir}/mod/*"; then
		echo "${mc_pn}: error: no modules detected." >&2
		exit 1
	fi

	#  Add them again.
	mc_mods=`echo ${mc_mods} | sed -e 's/\.mod//g'`
	for mc_mod in ${mc_mods}; do
		mc_mod=`echo ${mc_mod} | sed -e 's/.*\///g'`
		mc_new_mod_state=disabled
		echo ${mc_n} ".${mc_c}" >&6

		#  Do we have an existing configuration?
		if (test "${mc_mods_configured}" = yes); then
			#  Is the module active?
			if (grep "^${mc_mod}\.mod\$" ${mc_fmodules} 1>&7 2>&1)
			then
				mc_new_mod_state=enabled
			else
				#  Was it configured before?
				if (grep "^${mc_mod}\.mod\$" ${mc_fknownmods} 1>&7 2>&1); then
					:
				else
					mc_new_mod_state=enabled
				fi
			fi
		else
			if (sed s/\ //g ${mc_fdisabledmods} 2>&1 | grep "^${mc_mod}\$" 1>&7 2>&1)
			then
				:
			else
				mc_new_mod_state=enabled
			fi
		fi
		if test "${mc_new_mod_state}" = enabled && test -n "`find $mc_mod_bin_dir/${mc_mod}.mod -name \*.c`"; then
			${mc_self_call} -q add ${mc_mod}
		else
			${mc_self_call} -q del ${mc_mod}
		fi
	done

	if test "x${mc_fmodules_old}" != x; then
		# mc_fmodules actually points to the .modules_old file.
		rm -f ${mc_fmodules}
		touch ${mc_fmodules_old}
	fi

	echo " done." >&6
;;
xMakefile)
#
#  Build `src/mod/Makefile'
#

	echo ${mc_n} "Building ${mc_fMakefile}... ${mc_c}" 1>&6

	#  Check for selected modules
	if test -r ${mc_fmodules}; then
		#  Convert newlines to spaces.
		mc_sel_modules=`cat ${mc_fmodules} | \
					awk '{ printf("%s ", $0); }'`
	else
		echo "${mc_pn}: error: no modules selected. You did not run \`make config' yet." 1>&2;
		exit 1
	fi

	mc_mod_objs=`echo ${mc_sel_modules} | sed -e 's/\.mod/.mod_o/g'`
	mc_mod_libs=`echo ${mc_sel_modules} | sed -e 's/\.mod/.mod_so/g'`

	if test ! -f ${mc_fMakefile}; then
		echo "failed." 1>&6
		echo "${mc_pn}: error: make file template not found." 1>&2
		exit 1
	fi

	#  The following sed expression modifies src/mod/Makefile to
	#  hold the new module names.
	if (cat "${mc_fMakefile}" | \
	    sed -e "s/^\(mods =\).*$/\1 ${mc_sel_modules}/g"  \
		-e "s/^\(mod_objs =\).*$/\1 ${mc_mod_objs}/g" \
		-e "s/^\(mod_libs =\).*$/\1 ${mc_mod_libs}/g" \
	    1> "${mc_fMakefile}_new"); then
		mv "${mc_fMakefile}_new" "${mc_fMakefile}"
	else
		echo "failed." 1>&6
		echo "${mc_pn}: sed failed to build ${mc_fMakefile}." 1>&2
		exit 1
	fi

	echo "done." 1>&6
;;
xstatic.h)
#
#  Build `static.h'
#

	echo ${mc_n} "Building static.h..." 1>&6

	#  Check for selected modules
	if test ! -r ${mc_fmodules}; then
		echo " failed." 1>&6
		echo "${mc_pn}: error: no modules selected. You did not run \`make config' yet." 1>&2;
		exit 1
	fi
	mc_sel_modules=`cat ${mc_fmodules} | sed -e 's/\.mod//g'`


	#  Note:  All data is written to `src/mod/static.h' which is
	#         later included into `src/main.c'.

	#  Remove old static.h
	rm -f ${mc_fstatic_h}

	#  Header
	cat 1>> ${mc_fstatic_h} << EOF
/* src/mod/static.h -- header file for static compiles.
 *
 * NOTE: Do not edit directly. Instead, re-run \`make config'.
 */

#ifndef _EGG_MOD_STATIC_H
#define _EGG_MOD_STATIC_H

EOF

	#  Create declarations for module _start functions
	for mc_mod in ${mc_sel_modules}; do
		echo ${mc_n} ".${mc_c}" 1>&6
		echo "char *${mc_mod}_start();" 1>> ${mc_fstatic_h}
	done
	echo 1>> ${mc_fstatic_h}

	#  The link_statics() function ...
	echo "static void link_statics()" 1>> ${mc_fstatic_h}
	echo "{" 1>> ${mc_fstatic_h}
	for mc_mod in ${mc_sel_modules}; do
		echo "  check_static(\"${mc_mod}\", ${mc_mod}_start);" 1>> ${mc_fstatic_h}
	done
	cat 1>> ${mc_fstatic_h} << EOF
}

#endif /* _EGG_MOD_STATIC_H */
EOF

	echo " done." 1>&6
;;
xdel)
#
#  Remove a module from the list
#

	if test "x${mc_paras}" = x; then
		echo "${mc_pn}: error: no modules specified." 2>&1
		exit 1
	fi

	mc_nfmodules="${mc_fmodules}_new"

	#  Remove trailing `.mod'
	mc_mods=`echo ${mc_paras} | sed -e 's/\.mod//g'`
	for mc_mod in ${mc_mods}; do
		#  Remove any path information
		mc_mod=`echo ${mc_mod} | sed -e 's/.*\///'`
		echo "${mc_pn}: disabling eggdrop module: ${mc_mod}" 1>&6

		#  Add module to the list of known modules.
		if grep "^${mc_mod}\.mod$" ${mc_fknownmods} 1>&7 2>&7; then
			if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
				grep -v "^${mc_mod}\.mod$" ${mc_fknownmods} \
					> ${mc_fknownmods}_new
				mv ${mc_fknownmods}_new ${mc_fknownmods}
			fi
		else
			if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
				:
			else
				echo ${mc_mod}.mod 1>> ${mc_fknownmods}
			fi
		fi

		# In case there are any active modules ...
		if test -r ${mc_fmodules}; then
			#  Remove module from list of active modules.
			if grep -v "^${mc_mod}\.mod$" ${mc_fmodules} \
				1> ${mc_nfmodules}
			then
				:
			else
				echo "${mc_pn}: error: building new module file failed" 1>&2
				echo "Grepping for ${mc_mod}.mod in ${mc_fmodules} and writing to ${mc_nfmodules}."
				kill -STOP $$
				exit 1
			fi
			mv ${mc_nfmodules} ${mc_fmodules}
		fi
	done
;;
xadd)
#
#  Add a module to the list
#

	if test "x${mc_paras}" = x; then
		echo "${mc_pn}: error: no modules specified." 2>&1
		exit 1
	fi

	#  Remove trailing `.mod'
	mc_mods=`echo ${mc_paras} | sed -e 's/\.mod//g'`
	for mc_mod in ${mc_mods}; do
		#  Remove any path information
		mc_mod=`echo ${mc_mod} | sed -e 's/.*\///'`

		#  Add module to the list of known modules.
		if grep "^${mc_mod}\.mod$" ${mc_fknownmods} 1>&7 2>&7; then
			if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
				grep -v "^${mc_mod}\.mod$" ${mc_fknownmods} \
					> ${mc_fknownmods}_new
				mv ${mc_fknownmods}_new ${mc_fknownmods}
			fi
		else
			if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
				:
			else
				echo ${mc_mod}.mod 1>> ${mc_fknownmods}
			fi
		fi

		#  Add module to the list of active modules.
		if grep "^${mc_mod}\.mod$" ${mc_fmodules} 1>&7 2>&7; then
			:
		else
			if test ! -d ${mc_mod_dir}/${mc_mod}.mod; then
				echo "${mc_pn}: warning: module does not exist: \`${mc_mod}', ignoring." 1>&2
			else
				echo "${mc_pn}: enabling eggdrop module: ${mc_mod}" 1>&6

				#  Add it to the file
				echo ${mc_mod}.mod 1>> ${mc_fmodules}
			fi
		fi
	done
;;
xclear)
#
#  Clear list of modules
#

	echo "${mc_pn}: cleared list of eggdrop modules." 1>&6
	rm -f ${mc_fmodules}
	touch ${mc_fmodules}
;;
xupdate-depends)
#
#  Check the dependencies and add modules which are depended on, but
#  aren't enabled.
#

	mc_all_depends=
	mc_missing=

	echo ${mc_n} "Calculating dependencies...${mc_c}" 1>&6

	#  Check for selected modules
	if test ! -r ${mc_fmodules}; then
		echo " failed." 1>&6
		echo "${mc_pn}: error: no modules selected. You did not run configure yet." 1>&2
		exit 1
	fi
	mc_sel_modules=`cat ${mc_fmodules}`

	mc_new_mods="${mc_sel_modules}"
	while (test "x${mc_new_mods}" != x); do
		mc_mod_list="${mc_new_mods}"
		mc_new_mods=

		#  Go through every module in the list
		for mc_mod in ${mc_mod_list}; do
			echo ${mc_n} ".${mc_c}" 1>&6

			#  We have an info file, don't we?
			if (test ! -f ${mc_mod_dir}/${mc_mod}/modinfo); then
				continue
			fi

			#  Figure out the module's dependencies
			mc_mod_depends=`grep "^DEPENDS:" ${mc_mod_dir}/${mc_mod}/modinfo | sed -e 's/^DEPENDS://'`

			#  Check whether the dependencies are fulfilled
			for mc_m_depend in ${mc_mod_depends}; do
				if (echo ${mc_sel_modules} | \
					grep " ${mc_m_depend}" 1>&7 2>&7) || \
				    (echo ${mc_sel_modules} | \
					grep "^${mc_m_depend}" 1>&7 2>&7)
				then
					:
				else
					#  Does the module actually exist?
					if test ! -d ${mc_mod_dir}/${mc_m_depend}.mod
					then
						mc_missing="${mc_missing} ${mc_m_depend}"
						continue
					fi

					#  This one is missing. Add it to the
					#  list.
					mc_all_depends="${mc_all_depends} ${mc_m_depend}"
					mc_sel_modules="${mc_sel_modules} ${mc_m_depend}"

					#  Add to list of modules to check in
					#  next dependency cycle.
					mc_new_mods="${mc_new_mods} ${mc_m_depend}.mod"
				fi
			done
		done
	done
	echo " done." 1>&6

	#  Warn about missing modules.
	if test "x${mc_missing}" != x; then
		cat 1>&2 <<EOF
${mc_pn}: warning:

   The following modules were not found but are needed:

      `echo ${mc_missing} | sed -e 's/ /, /g'`

EOF
		echo ${mc_n} "Press enter to continue... ${mc_c}"
		read mc_ask_response
	fi

	if test "x${mc_all_depends}" != x; then
		echo ${mc_n} "Adding modules needed to match dependencies... ${mc_c}" 1>&6
		echo ${mc_all_depends} | sed -e 's/ /, /g' 1>&6

		#  Add the modules
		${mc_self_call} -q add ${mc_all_depends}

		#  Update the makefile
		${mc_self_call} -q Makefile
	fi
;;
xconfigure)
#
#  Interactive module selection
#

	cat 1>&6 <<EOF

            -*-    Eggdrop Interactive Module Selection    -*-

EOF

	#  Check for selected modules
	if test ! -r ${mc_fmodules}; then
		echo "${mc_pn}: error: no modules selected. You did not run configure yet." 1>&2
		exit 1
	fi

	#  Read current list
	mc_sel_modules=`cat ${mc_fmodules}`

	#  Detect available modules
	mc_mods=`echo ${mc_mod_dir}/*.mod`

	#  Error out if we have no available modules
	if test "${mc_mods}" = "echo ${mc_mod_dir}/*.mod"; then
		echo "${mc_pn}: error: no modules found." 1>&2
		exit 1
	fi

	#  Loop through each available module
	for mc_mod in ${mc_mods}; do
		#  Remove directory information from name
		mc_mod=`echo ${mc_mod} | sed -e 's/.*\///'`

		#  Only ask for new modules?
		if test "${mc_flag_onlynew}" = yes; then
			#  Did we already query for that module?
			if grep "^${mc_mod}$" ${mc_fknownmods} 1>&7 2>&7; then
				continue
			fi
		fi

		#  Remove .mod ending
		mc_modname=`echo ${mc_mod} | sed -e 's/\.mod//g'`

		#  Note: We need to make sure that we only catch module names
		#        that match _exactly_. e.g. don't mix bseen and seen.
		if (echo ${mc_sel_modules} | grep " ${mc_mod}" 1>&7 2>&7) ||
		    (echo ${mc_sel_modules} | grep "^${mc_mod}" 1>&7 2>&7)

		then
			#  The module is selected.
			mc_mstate="enabled"
			mc_mdisp="(E)nable / (d)isable [E/d] ->"
		else
			#  The module is NOT selected.
			mc_mstate="disabled"
			mc_mdisp="(e)nable / (D)isable [e/D] ->"
		fi

		#  Display description
		if test -r ${mc_mod_dir}/${mc_mod}/modinfo; then
			echo "" 1>&6
			grep "^DESC:" ${mc_mod_dir}/${mc_mod}/modinfo | \
				sed -e 's/^DESC:/   /' 1>&6
			echo "" 1>&6
		fi

		while true; do
			echo ${mc_n} "\`${mc_modname}' is ${mc_mstate}: ${mc_mdisp} ${mc_c} " 1>&6
			read mc_ask_response;

			if (test "${mc_ask_response}" = D); then
				mc_ask_response=d;
			fi
			if (test "${mc_ask_response}" = E); then
				mc_ask_response=e;
			fi

			#  If the user just presses [return] or
			#  if the selected state matches the old state,
			#  then we change nothing.
			if test "x${mc_ask_response}" = x || \
			    (test "${mc_ask_response}" = d && \
			     test "${mc_mstate}" = disabled) || \
			    (test "${mc_ask_response}" = e && \
			     test "${mc_mstate}" = enabled); then
				echo "Changing nothing." 1>&6
				break;
			fi
			if (test "${mc_ask_response}" = e); then
				#  Add it to the list.
				mc_sel_modules="${mc_sel_modules} ${mc_mod}"
				echo "Enabled module '${mc_modname}'." 1>&6
				break;
			fi
			if (test "${mc_ask_response}" = d); then
				#  Remove module from list.
				mc_sel_modules=`echo ${mc_sel_modules} | sed -e "s/ ${mc_mod}//g" -e "s/^${mc_mod}//g"`
				echo "Disabled module '${mc_modname}'." 1>&6
				break;
			fi
		done
		echo "" 1>&6
	done

	echo ${mc_n} "Recreating list of active modules...${mc_c}" 1>&6
	${mc_self_call} -q clear
	if (${mc_self_call} -q add ${mc_sel_modules}); then
		echo " done." 1>&6
	else
		echo " failed!" 1>&6
		exit 1
	fi
;;
*)
	if test "x${mc_cmd}" = x; then
		echo "${mc_pn}: error: no command supplied." 1>&2
	else
		echo "${mc_pn}: error: ${mc_cmd}: unknown command." 1>&2
	fi
	${mc_self_call} help
;;
esac

exit 0