Deleted Added
full compact
rc.subr (157710) rc.subr (157841)
1# $NetBSD: rc.subr,v 1.65 2004/10/12 14:45:29 lukem Exp $
2# $FreeBSD: head/etc/rc.subr 157710 2006-04-13 08:30:43Z flz $
1# $NetBSD: rc.subr,v 1.66 2006/04/01 10:05:50 he Exp $
2# $FreeBSD: head/etc/rc.subr 157841 2006-04-18 15:16:55Z flz $
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 229 unchanged lines hidden (view full) ---

240# `basename procname`
241# `basename procname` + ":"
242# "(" + `basename procname` + ")"
243# "[" + `basename procname` + "]"
244#
245# If interpreter != ".", read the first line of procname, remove the
246# leading #!, normalise whitespace, append procname, and attempt to
247# match that against each command, either as is, or with extra words
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 229 unchanged lines hidden (view full) ---

240# `basename procname`
241# `basename procname` + ":"
242# "(" + `basename procname` + ")"
243# "[" + `basename procname` + "]"
244#
245# If interpreter != ".", read the first line of procname, remove the
246# leading #!, normalise whitespace, append procname, and attempt to
247# match that against each command, either as is, or with extra words
248# at the end.
248# at the end. As an alternative, to deal with interpreted daemons
249# using perl, the basename of the interpreter plus a colon is also
250# tried as the prefix to procname.
249#
250_find_processes()
251{
252 if [ $# -ne 3 ]; then
253 err 3 'USAGE: _find_processes procname interpreter psargs'
254 fi
255 _procname=$1
256 _interpreter=$2
257 _psargs=$3
258
259 _pref=
260 if [ $_interpreter != "." ]; then # an interpreted script
261 read _interp < $_procname # read interpreter name
262 _interp=${_interp#\#!} # strip #!
263 set -- $_interp
264 if [ $_interpreter != $1 ]; then
265 warn "\$command_interpreter $_interpreter != $1"
266 fi
267 _interp="$* $_procname" # cleanup spaces, add _procname
251#
252_find_processes()
253{
254 if [ $# -ne 3 ]; then
255 err 3 'USAGE: _find_processes procname interpreter psargs'
256 fi
257 _procname=$1
258 _interpreter=$2
259 _psargs=$3
260
261 _pref=
262 if [ $_interpreter != "." ]; then # an interpreted script
263 read _interp < $_procname # read interpreter name
264 _interp=${_interp#\#!} # strip #!
265 set -- $_interp
266 if [ $_interpreter != $1 ]; then
267 warn "\$command_interpreter $_interpreter != $1"
268 fi
269 _interp="$* $_procname" # cleanup spaces, add _procname
270 _interpbn=${1##*/}
268 _fp_args='_argv'
269 _fp_match='case "$_argv" in
271 _fp_args='_argv'
272 _fp_match='case "$_argv" in
270 ${_interp}|"${_interp} "*)'
273 ${_interp}|"${_interp} "*|"${_interpbn}: ${_procname}"*)'
271 else # a normal daemon
272 _procnamebn=${_procname##*/}
273 _fp_args='_arg0 _argv'
274 _fp_match='case "$_arg0" in
275 $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")'
276 fi
277
278 _proccheck='

--- 835 unchanged lines hidden (view full) ---

1114 ;;
1115 remove)
1116 mv -f $_cur $_back
1117 ;;
1118 esac
1119 fi
1120}
1121
274 else # a normal daemon
275 _procnamebn=${_procname##*/}
276 _fp_args='_arg0 _argv'
277 _fp_match='case "$_arg0" in
278 $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")'
279 fi
280
281 _proccheck='

--- 835 unchanged lines hidden (view full) ---

1117 ;;
1118 remove)
1119 mv -f $_cur $_back
1120 ;;
1121 esac
1122 fi
1123}
1124
1122_rc_subr_loaded=:
1123
1124# make_symlink src link
1125# Make a symbolic link 'link' to src from basedir. If the
1126# directory in which link is to be created does not exist
1127# a warning will be displayed and an error will be returned.
1128# Returns 0 on sucess, 1 otherwise.
1129#
1130make_symlink()
1131{

--- 323 unchanged lines hidden (view full) ---

1455 ;;
1456 esac
1457 done
1458 fi
1459 done
1460}
1461
1462fi
1125# make_symlink src link
1126# Make a symbolic link 'link' to src from basedir. If the
1127# directory in which link is to be created does not exist
1128# a warning will be displayed and an error will be returned.
1129# Returns 0 on sucess, 1 otherwise.
1130#
1131make_symlink()
1132{

--- 323 unchanged lines hidden (view full) ---

1456 ;;
1457 esac
1458 done
1459 fi
1460 done
1461}
1462
1463fi
1464
1465_rc_subr_loaded=: