Commit e73a0283 authored by Clément Stenac's avatar Clément Stenac

* modules/LIST: Updated all modules

* modules/list.sh: piggy list consistency checker
 (should probably be added to toolbox or trashed)

* modules/access/slp.c : Fixed service detection
	(findsrvtypes returns a comma-separated list of services)
parent f64bdcc0
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* slp.c: SLP access plugin * slp.c: SLP access plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: slp.c,v 1.13 2003/07/23 01:13:47 gbazin Exp $ * $Id: slp.c,v 1.14 2003/08/10 12:45:52 zorglub Exp $
* *
* Authors: Loc Minier <lool@videolan.org> * Authors: Loc Minier <lool@videolan.org>
* *
...@@ -146,6 +146,8 @@ static SLPBoolean SrvUrlCallback( SLPHandle slph_slp, ...@@ -146,6 +146,8 @@ static SLPBoolean SrvUrlCallback( SLPHandle slph_slp,
return SLP_TRUE; return SLP_TRUE;
} }
msg_Dbg(p_input,"URL: %s",psz_srvurl);
/* or there was a problem with getting the data we requested */ /* or there was a problem with getting the data we requested */
if( (slpe_errcode != SLP_OK) ) if( (slpe_errcode != SLP_OK) )
{ {
...@@ -247,13 +249,18 @@ static SLPBoolean SrvTypeCallback( SLPHandle slph_slp, ...@@ -247,13 +249,18 @@ static SLPBoolean SrvTypeCallback( SLPHandle slph_slp,
input_thread_t * p_input = (input_thread_t *)p_cookie; input_thread_t * p_input = (input_thread_t *)p_cookie;
SLPError slpe_result; SLPError slpe_result;
SLPHandle slph_slp2; SLPHandle slph_slp2;
char *psz_eos;
char *psz_service;
msg_Dbg(p_input,"Services: %s",psz_srvurl);
/* our callback was only called to tell us there's nothing more to read */ /* our callback was only called to tell us there's nothing more to read */
if( slpe_errcode == SLP_LAST_CALL ) if( slpe_errcode == SLP_LAST_CALL )
{ {
return SLP_TRUE; return SLP_TRUE;
} }
msg_Dbg(p_input,"Services: %s",psz_srvurl);
/* or there was a problem with getting the data we requested */ /* or there was a problem with getting the data we requested */
if( slpe_errcode != SLP_OK ) if( slpe_errcode != SLP_OK )
{ {
...@@ -270,23 +277,50 @@ static SLPBoolean SrvTypeCallback( SLPHandle slph_slp, ...@@ -270,23 +277,50 @@ static SLPBoolean SrvTypeCallback( SLPHandle slph_slp,
&slph_slp2 ) == SLP_OK ) &slph_slp2 ) == SLP_OK )
{ {
/* search for services */ /* search for services */
while(1)
{
if( *psz_srvurl == '\0') break;
if( !strncasecmp( psz_srvurl, "service:", 8 ) )
{
while(1)
{
psz_eos = strchr( psz_srvurl, ',');
if(!psz_eos) break;
if(!strncasecmp(psz_eos+1,"service:",8)) break;
}
if(psz_eos)
*psz_eos = '\0';
psz_service = strdup( psz_srvurl);
msg_Dbg(p_input,"Getting details for %s",psz_service);
slpe_result = SLPFindSrvs( slph_slp2, slpe_result = SLPFindSrvs( slph_slp2,
psz_srvurl, psz_service,
config_GetPsz( p_input, "slp-scopelist" ), config_GetPsz( p_input, "slp-scopelist" ),
config_GetPsz( p_input, "slp-filter" ), config_GetPsz( p_input, "slp-filter" ),
SrvUrlCallback, SrvUrlCallback,
p_input ); p_input );
SLPClose( slph_slp2 ); if(psz_eos)
psz_srvurl = psz_eos;
// SLPClose( slph_slp2 );
if( slpe_result != SLP_OK ) if( slpe_result != SLP_OK )
{ {
msg_Err( p_input, msg_Err( p_input,
"SLPFindSrvs error %i finding servers of type %s", "SLPFindSrvs error %i finding servers of type %s",
slpe_result, slpe_result,
psz_srvurl ); psz_service );
}
} }
psz_srvurl++;
} }
}
SLPClose( slph_slp2 );
return SLP_TRUE; return SLP_TRUE;
} }
......
#! /bin/sh
# Piggy list consistency checker
TEMPFILE=/tmp/list.tmp
LISTFILE=LIST
LISTFILE2=/tmp/list2.tmp
LISTFILE3=/tmp/list3.tmp
rm -f $TEMPFILE
touch $TEMPFILE
echo "------------------------------------"
echo "Checking that all modules are listed"
echo "------------------------------------"
i=0
for modfile in `find . -name "Modules.am"`
do
for module in `grep "SOURCES_" $modfile|awk '{print $1}'|awk 'BEGIN {FS="SOURCES_"};{print $2}'`
do
echo $module >> $TEMPFILE
if [ `grep " \* $module:" $LISTFILE |wc -l` == 0 ]
then
echo "$module exists in $modfile, but not listed"
i=1
fi
done
done
if [ $i == 0 ]
then
echo "OK"
fi
i=0
echo
echo "--------------------------------------"
echo "Checking that all listed modules exist"
echo "--------------------------------------"
for module in `grep " \* " $LISTFILE|awk '{print $2}'|sed s,':',,g `
do
if [`grep $module $TEMPFILE|wc -l` == 0 ]
then
i=1
echo "$module is listed but does not exist"
fi
done
if [ $i == 0 ]
then
echo "OK"
fi
echo
echo "-------------------------------"
echo "Checking for alphabetical order"
echo "-------------------------------"
rm -f $LISTFILE2
touch $LISTFILE2
rm -f $LISTFILE3
touch $LISTFILE3
grep " \* " $LISTFILE >> $LISTFILE2
sort -n $LISTFILE2 >> $LISTFILE3
i=`diff $LISTFILE2 $LISTFILE3|wc -l`
diff $LISTFILE2 $LISTFILE3
if [ $i == 0 ]
then
echo "OK"
fi
echo ""
echo "`cat $TEMPFILE| wc -l` modules listed in Modules.am files"
rm -f $TEMPFILE
rm -f $LISTFILE2
rm -f $LISTFILE3
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment