2013-09-26 17:14:40 +02:00

86 lines
2.7 KiB
Plaintext

$NetBSD: patch-af,v 1.3 2011/07/05 03:27:22 dholland Exp $
Dragonfly support.
Use correct sysctl mibs on NetBSD.
Fix LP64 problems.
Fix illegal C.
--- tvutil.c.orig 2000-10-23 02:43:46.000000000 +0000
+++ tvutil.c
@@ -35,7 +35,7 @@
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
# include <sys/sysctl.h>
#elif defined(__bsdi__) || defined(__NetBSD__) || defined(__OpenBSD__)
# include <sys/param.h>
@@ -105,14 +105,14 @@ void CleanupChildFileDesc()
{
static int Max_files_per_proc = -1;
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
int mib[2] = { CTL_KERN, KERN_MAXFILESPERPROC };
#elif defined(linux)
int mib[2] = { CTL_KERN, FOPEN_MAX };
#elif defined(__bsdi__)
int mib[2] = { CTL_KERN, KERN_MAXFILES };
#elif defined(__NetBSD__)
- int mib[2] = { CTL_KERN, OPEN_MAX };
+ int mib[2] = { CTL_KERN, KERN_MAXFILES };
#elif defined(__OpenBSD__)
int mib[2] = { CTL_KERN, OPEN_MAX };
#endif
@@ -184,14 +184,14 @@ void TVUTILCmdStrToArgList(
*argbuf = NULL;
while ( *s != '\0' ) { /* For all args */
- while ( isspace( *s ) ) /* Skip spaces */
+ while ( isspace( (unsigned char)*s ) ) /* Skip spaces */
s++;
if ( *s == '\0' )
continue;
in_quote = FALSE; /* Extract an arg */
p = arg;
- while ( (in_quote || !isspace(*s)) && (*s != '\0') ) {
+ while ( (in_quote || !isspace((unsigned char)*s)) && (*s != '\0') ) {
ignore = FALSE;
if (( *s == '\'' ) || ( *s == '\"' ))
@@ -450,7 +450,7 @@ void TVUTILPipeCleanup( pid_t
(( end[2].fd >= 0 ) && end[2].is_pipe &&
( close( end[2].fd ) < 0 )) ||
- ( waitpid( child_pid, &status, NULL ) < 0 ) ||
+ ( waitpid( child_pid, &status, 0 ) < 0 ) ||
(( end[0].fd >= 0 ) && end[1].is_pipe &&
(( dup2( end[0].fd_saved, end[0].fd ) < 0 ) ||
@@ -475,15 +475,19 @@ void TVUTILPipeCleanup( pid_t
/* TVUTILstrupr - Convert a string to upper case */
void TVUTILstrupr( char *str )
{
- while ( *str != '\0' )
- *(str++) = toupper( *str );
+ while ( *str != '\0' ) {
+ *str = toupper( (unsigned char)*str );
+ str++;
+ }
}
/* TVUTILstrlwr - Convert a string to lower case */
void TVUTILstrlwr( char *str )
{
- while ( *str != '\0' )
- *(str++) = tolower( *str );
+ while ( *str != '\0' ) {
+ *str = tolower( (unsigned char)*str );
+ str++;
+ }
}
/* TVUTILStrStrip - Strip selected characters out of a string */