--- sympa.in.orig	2013-03-02 16:15:18.049655615 +0000
+++ sympa.in	2013-03-02 16:33:03.961656252 +0000
@@ -1,11 +1,11 @@
 #!/bin/sh
 #
-# sympa			Mailing Lists Management System
-#
 # PROVIDE: sympa
 # REQUIRE: LOGIN cleanvar %%REQ_MYSQL%% %%REQ_PGSQL%% 
 # KEYWORD: shutdown
 #
+# $FreeBSD$
+#
 # Written by Michel Bouissou  20/07/2000
 #
 # Modified by Olivier Salaun 27/07/2000
@@ -17,53 +17,57 @@
 # Modified by Eimar Koort 27/02/2013
 # 	- optimized for FreeBSD
 #
-# sympa_enable  (bool):   Set to NO by default.
-#                Set it to YES to enable sympa.
+# sympa_enable (bool):	Set to NO by default.
+# 			Set it to YES to enable sympa.
 #
 
 . /etc/rc.subr
 
-name="sympa"
-start_cmd="${name}_start"
-stop_cmd="${name}_stop"
-status_cmd="${name}_status"
-extra_commands="status"
+name=sympa
 rcvar=sympa_enable
 
 load_rc_config $name
 
-sympadir="%%PREFIX%%/libexec/sympa"
+: ${sympa_enable:=no}
+
+start_cmd=sympa_start
+stop_cmd=sympa_stop
+status_cmd=sympa_status
+extra_commands=status
 
-# Sympa config files directory
-sympaconf="%%PREFIX%%/etc/sympa.conf"
-wwsympaconf="%%PREFIX%%/etc/wwsympa.conf"
-
-# Current state of the module
-sub_status() {
-        # Test syntax.
-        if [ $# = 0 ] ; then
-                echo "Usage: sub_status {program}"
-                return 1
-        fi
-       # First try "/u1/home/sympa/*.pid" files
-       if [ -f /var/run/sympa/$1.pid ] ; then
-                pid=`head -1 /var/run/sympa/$1.pid | tr -s ' ' '|'`
-                if [ "$pid" != "" ] ; then
-                        running=`ps -A | egrep "$pid"`
-                        if [ "$running" != "" ]; then
-                                echo "$1 (pid(s) $pid) is active..."
-                                return 0
-                        else
-                                echo "$1 died, pid file remains."
-                                return 1
-                        fi
-                fi
-        fi
-        echo "$1 is stopped."
-        return 3
+sympadir=%%PREFIX%%/libexec/sympa
+
+sympaconf=%%PREFIX%%/etc/sympa.conf
+wwsympaconf=%%PREFIX%%/etc/wwsympa.conf
+
+sub_status()
+{
+	# Test syntax.
+	if [ $# = 0 ] ; then
+		echo "Usage: sub_status {program}"
+		return 1
+	fi
+	# First try "/u1/home/sympa/*.pid" files
+	if [ -f /var/run/sympa/$1.pid ] ; then
+		pid=`head -1 /var/run/sympa/$1.pid | tr -s ' ' '|'`
+		if [ "$pid" != "" ] ; then
+			running=`ps -A | egrep "$pid"`
+			if [ "$running" != "" ]; then
+				echo "$1 (pid(s) $pid) is active..."
+				return 0
+					else
+				echo "$1 died, pid file remains."
+				return 1
+			fi
+		fi
+	fi
+	echo "$1 is stopped."
+	return 3
 }
-# Start a module
-sub_module_start() {
+
+sub_module_start()
+{
+	# Start a module
 	if [ $# = 0 ] ; then
 		echo "Usage: sub_module_start {program}"
 		return 1
@@ -72,8 +76,9 @@
 	echo
 }
 
-# Test state of module before startup
-sub_start() {
+sub_start()
+{
+	# Test state of module before startup
 	if [ $# = 0 ] ; then
 		echo "Usage: sub_start {program}"
 		return 1
@@ -95,11 +100,12 @@
 	esac
 }
 
-# Stop a module
-sub_stop() {
+sub_stop()
+{
+    # Stop a module
     if [ $# = 0 ] ; then
-        echo "Usage: sub_stop {program}"
-        return 1
+	echo "Usage: sub_stop {program}"
+	return 1
     fi
  
     if [ -f /var/run/sympa/$1.pid ]; then
@@ -112,7 +118,7 @@
 		running=`ps -A | grep "^[[:space:]]*$pid[[:space:]].*$1\\.pl"`
 		while [ "$running" != "" ]; do
 		    if [ $killcount -gt 10 ]; then
-		        echo 'failure'
+			echo 'failure'
 			return 3
 		    fi
 
@@ -144,13 +150,17 @@
     return 0
 }
 
-# Check config files
-[ -d $sympadir ] || exit 0
-[ -f $sympaconf ] || exit 0
-[ -f $wwsympaconf ] || exit 0
+sympa_check_config()
+{
+	# Check config files
+	[ -d $sympadir ] || exit 0
+	[ -f $sympaconf ] || exit 0
+	[ -f $wwsympaconf ] || exit 0
+}
 
-sympa_start() 
-	{
+sympa_start()
+{
+	sympa_check_config
 	if [ ! -f /var/spool/lock/sympa ]; then
 		echo "Starting Sympa subsystem: "
 		sub_start sympa
@@ -161,14 +171,14 @@
 		touch /var/spool/lock/sympa
 		echo
 	else
-
 		echo "Sympa seems active. No action will be taken."
 		echo "Try \"sympa status\" or \"sympa restart"\".
-
 	fi
-	}
+}
+
 sympa_stop()
-	{
+{
+	sympa_check_config
 	echo "Stopping Sympa subsystem: "
 	sub_stop bounced
 	sub_stop archived
@@ -181,27 +191,21 @@
 	if [ -f /var/spool/lock/sympa ]; then
 		rm -f /var/spool/lock/sympa
 	fi
-	}
-sympa_status()
-        {
-        echo "Status of Sympa subsystem: "
-        if [ -f /var/spool/lock/sympa ]; then
-                echo "Status file for subsystem found."
-        else
-                echo "Status file for subsystem NOT found."
-        fi
-        sub_status sympa
-        sub_status bulk
-        sub_status archived
-        sub_status bounced
-        sub_status task_manager
-        }
-sympa_restart()
-	{
-	echo "Restarting Sympa subsystem: "
-	$0 stop && $0 start
-	echo
-	}
+}
 
-run_rc_command "$1"
+sympa_status()
+{
+	echo "Status of Sympa subsystem: "
+	if [ -f /var/spool/lock/sympa ]; then
+		echo "Status file for subsystem found."
+	else
+		echo "Status file for subsystem NOT found."
+	fi
+	sub_status sympa
+	sub_status bulk
+	sub_status archived
+	sub_status bounced
+	sub_status task_manager
+}
 
+run_rc_command $1
