mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Multiple portability fixes
darcs-hash:20051010161255-ac50b-e732f18c1dfa610e34b56bb4ff1a3d4d2ef078a1.gz
This commit is contained in:
parent
b6e7133ba6
commit
0a4b983afa
8 changed files with 32 additions and 21 deletions
|
@ -33,7 +33,7 @@
|
||||||
CC := @CC@
|
CC := @CC@
|
||||||
CFLAGS := @CFLAGS@ @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing
|
CFLAGS := @CFLAGS@ @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing
|
||||||
CPPFLAGS=@CPPFLAGS@
|
CPPFLAGS=@CPPFLAGS@
|
||||||
LDFLAGS:= -l@CURSESLIB@ @LDFLAGS@ @LIBDIR@
|
LDFLAGS:= -l@CURSESLIB@ @LIBS@ @LDFLAGS@ @LIBDIR@
|
||||||
INSTALL:=@INSTALL@
|
INSTALL:=@INSTALL@
|
||||||
|
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
|
@ -69,7 +69,7 @@ FISHD_OBJS := fishd.o env_universal_common.o common.o util.o wutil.o \
|
||||||
|
|
||||||
#All objects that the system needs to build mimedb
|
#All objects that the system needs to build mimedb
|
||||||
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
|
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
|
||||||
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o
|
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o
|
||||||
|
|
||||||
#
|
#
|
||||||
# Files containing documentation for builtins. Should be listed
|
# Files containing documentation for builtins. Should be listed
|
||||||
|
|
|
@ -15,6 +15,12 @@
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `rt' library (-lrt). */
|
||||||
|
#undef HAVE_LIBRT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `socket' library (-lsocket). */
|
||||||
|
#undef HAVE_LIBSOCKET
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
#undef HAVE_MEMORY_H
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,11 @@
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#if HAVE_NCURSES_H
|
||||||
|
#include <ncurses.h>
|
||||||
|
#else
|
||||||
|
#include <curses.h>
|
||||||
|
#endif
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
|
@ -509,7 +509,7 @@ static void enqueue( const void *k,
|
||||||
{
|
{
|
||||||
const wchar_t *key = (const wchar_t *)k;
|
const wchar_t *key = (const wchar_t *)k;
|
||||||
const var_entry_t *val = (const var_entry_t *)v;
|
const var_entry_t *val = (const var_entry_t *)v;
|
||||||
queue_t *queue = (queue_t *)q;
|
dyn_queue_t *queue = (dyn_queue_t *)q;
|
||||||
|
|
||||||
message_t *msg = create_message( val->export?SET_EXPORT:SET, key, val->val );
|
message_t *msg = create_message( val->export?SET_EXPORT:SET, key, val->val );
|
||||||
msg->count=1;
|
msg->count=1;
|
||||||
|
|
|
@ -61,7 +61,7 @@ typedef struct connection
|
||||||
/**
|
/**
|
||||||
Queue of onsent messages
|
Queue of onsent messages
|
||||||
*/
|
*/
|
||||||
queue_t unsent;
|
dyn_queue_t unsent;
|
||||||
/**
|
/**
|
||||||
Set to one when this connection should be killed
|
Set to one when this connection should be killed
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# into a C string literal.
|
# into a C string literal.
|
||||||
|
|
||||||
# NAME is the name of the function we are generating documentation for.
|
# NAME is the name of the function we are generating documentation for.
|
||||||
NAME=$(basename $1 .doxygen)
|
NAME=`basename $1 .doxygen`
|
||||||
|
|
||||||
# Render the page
|
# Render the page
|
||||||
nroff -man doc_src/builtin_doc/man/man1/${NAME}.1 | col -b | cat -s | sed -e '$d' | ./gen_hdr2
|
nroff -man doc_src/builtin_doc/man/man1/${NAME}.1 | col -b | cat -s | sed -e '$d' | ./gen_hdr2
|
||||||
|
|
16
util.c
16
util.c
|
@ -72,20 +72,20 @@ int maxi( int a,
|
||||||
/* Queue functions */
|
/* Queue functions */
|
||||||
|
|
||||||
|
|
||||||
void q_init( queue_t *q )
|
void q_init( dyn_queue_t *q )
|
||||||
{
|
{
|
||||||
q->start = (void **)malloc( sizeof(void*)*1 );
|
q->start = (void **)malloc( sizeof(void*)*1 );
|
||||||
q->stop = &q->start[1];
|
q->stop = &q->start[1];
|
||||||
q->put_pos = q->get_pos = q->start;
|
q->put_pos = q->get_pos = q->start;
|
||||||
}
|
}
|
||||||
|
|
||||||
void q_destroy( queue_t *q )
|
void q_destroy( dyn_queue_t *q )
|
||||||
{
|
{
|
||||||
free( q->start );
|
free( q->start );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static q_print( queue_t *q )
|
static q_print( dyn_queue_t *q )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int size = (q->stop-q->start);
|
int size = (q->stop-q->start);
|
||||||
|
@ -106,7 +106,7 @@ void q_destroy( queue_t *q )
|
||||||
/**
|
/**
|
||||||
Reallocate the queue_t
|
Reallocate the queue_t
|
||||||
*/
|
*/
|
||||||
static int q_realloc( queue_t *q )
|
static int q_realloc( dyn_queue_t *q )
|
||||||
{
|
{
|
||||||
void **old_start = q->start;
|
void **old_start = q->start;
|
||||||
void **old_stop = q->stop;
|
void **old_stop = q->stop;
|
||||||
|
@ -131,7 +131,7 @@ static int q_realloc( queue_t *q )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int q_put( queue_t *q, void *e )
|
int q_put( dyn_queue_t *q, void *e )
|
||||||
{
|
{
|
||||||
*q->put_pos = e;
|
*q->put_pos = e;
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ int q_put( queue_t *q, void *e )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *q_get( queue_t *q)
|
void *q_get( dyn_queue_t *q)
|
||||||
{
|
{
|
||||||
void *e = *q->get_pos;
|
void *e = *q->get_pos;
|
||||||
if( ++q->get_pos == q->stop )
|
if( ++q->get_pos == q->stop )
|
||||||
|
@ -152,12 +152,12 @@ void *q_get( queue_t *q)
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *q_peek( queue_t *q )
|
void *q_peek( dyn_queue_t *q )
|
||||||
{
|
{
|
||||||
return *q->get_pos;
|
return *q->get_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
int q_empty( queue_t *q )
|
int q_empty( dyn_queue_t *q )
|
||||||
{
|
{
|
||||||
// fprintf( stderr, "Queue %d is %s\n", q, (q->put_pos == q->get_pos)?"empty":"non-empty" );
|
// fprintf( stderr, "Queue %d is %s\n", q, (q->put_pos == q->get_pos)?"empty":"non-empty" );
|
||||||
return q->put_pos == q->get_pos;
|
return q->put_pos == q->get_pos;
|
||||||
|
|
16
util.h
16
util.h
|
@ -10,7 +10,7 @@
|
||||||
/**
|
/**
|
||||||
Data structure for an automatically resizing dynamically allocated queue,
|
Data structure for an automatically resizing dynamically allocated queue,
|
||||||
*/
|
*/
|
||||||
typedef struct queue
|
typedef struct dyn_queue
|
||||||
{
|
{
|
||||||
/** Start of the array */
|
/** Start of the array */
|
||||||
void **start;
|
void **start;
|
||||||
|
@ -21,7 +21,7 @@ typedef struct queue
|
||||||
/** Where to remove elements */
|
/** Where to remove elements */
|
||||||
void **get_pos;
|
void **get_pos;
|
||||||
}
|
}
|
||||||
queue_t;
|
dyn_queue_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Internal struct used by hash_table_t.
|
Internal struct used by hash_table_t.
|
||||||
|
@ -159,17 +159,17 @@ float minf( float a, float b );
|
||||||
element to be inserted into the buffer is the first element to be
|
element to be inserted into the buffer is the first element to be
|
||||||
returned.
|
returned.
|
||||||
*/
|
*/
|
||||||
void q_init( queue_t *q );
|
void q_init( dyn_queue_t *q );
|
||||||
/** Destroy the queue */
|
/** Destroy the queue */
|
||||||
void q_destroy( queue_t *q );
|
void q_destroy( dyn_queue_t *q );
|
||||||
/** Insert element into queue */
|
/** Insert element into queue */
|
||||||
int q_put( queue_t *q, void *e );
|
int q_put( dyn_queue_t *q, void *e );
|
||||||
/** Remove and return next element from queue */
|
/** Remove and return next element from queue */
|
||||||
void *q_get( queue_t *q);
|
void *q_get( dyn_queue_t *q);
|
||||||
/** Return next element from queue without removing it */
|
/** Return next element from queue without removing it */
|
||||||
void *q_peek( queue_t *q);
|
void *q_peek( dyn_queue_t *q);
|
||||||
/** Returns 1 if the queue is empty, 0 otherwise */
|
/** Returns 1 if the queue is empty, 0 otherwise */
|
||||||
int q_empty( queue_t *q );
|
int q_empty( dyn_queue_t *q );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize a hash table. The hash function must never return the value 0.
|
Initialize a hash table. The hash function must never return the value 0.
|
||||||
|
|
Loading…
Reference in a new issue