/*****************************************************************************
* acl.c:
*****************************************************************************
- * Copyright (C) 2005 Rémi Denis-Courmont
+ * Copyright © 2005-2007 Rémi Denis-Courmont
* $Id$
*
* Authors: Rémi Denis-Courmont <rem # videolan.org>
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
#include <vlc/vlc.h>
-#include "vlc_acl.h"
+#include <ctype.h>
+#include <vlc_acl.h>
#include <errno.h>
-#include "network.h"
-#include "charset.h"
+#include <vlc_network.h>
+#include <vlc_charset.h>
/* FIXME: rwlock on acl, but libvlc doesn't implement rwlock */
typedef struct vlc_acl_entry_t
}
}
-#ifndef isblank
-# define isblank(c) ((c) == ' ' || (c) == '\t')
-#endif
/**
* Reads ACL entries from a file.
psz_path);
do
{
- fgets( line, sizeof( line ), file );
- if( ferror( file ) || feof( file ) )
+ if( fgets( line, sizeof( line ), file ) == NULL )
{
- msg_Err( p_acl->p_owner, "error reading %s : %s\n",
- psz_path, strerror( errno ) );
- goto error;
+ if( ferror( file ) )
+ {
+ msg_Err( p_acl->p_owner, "error reading %s : %s\n",
+ psz_path, strerror( errno ) );
+ }
+ goto error;
}
}
while( strchr( line, '\n' ) == NULL);
*ptr++ = '\0'; /* separate address from mask length */
if( (ptr != NULL)
- ? ACL_AddNet( p_acl, psz_ip, atoi( ptr ), VLC_TRUE )
+ ? ACL_AddNet( p_acl, psz_ip, atoi( ptr ), VLC_TRUE )
: ACL_AddHost( p_acl, psz_ip, VLC_TRUE ) )
{
msg_Err( p_acl->p_owner, "cannot add ACL from %s", psz_path );