mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-21 18:30:20 +00:00
Allow to define a default unit to use if none is provided
This commit is contained in:
parent
7ff51a725e
commit
689316713e
@ -12,7 +12,7 @@ CPPFLAGS = -I$(TOP)/../libmacos -I$(TOP) -I$(TOP)/../libgzip
|
||||
LIBRARIES = scsi/libstream.a floppy/libstream.a full/libstream.a
|
||||
|
||||
SOURCES = stream_close.c stream_open.c stream_read.c stream_lseek.c \
|
||||
stream_uncompress.c gzio.c stream_fstat.c
|
||||
stream_uncompress.c gzio.c stream_fstat.c stream_set_default.c
|
||||
|
||||
HEADERS = libstream.h
|
||||
|
||||
|
@ -95,4 +95,6 @@ extern int stream_lseek(stream_t *stream, long offset, int whence);
|
||||
extern int stream_close(stream_t *stream);
|
||||
extern int stream_uncompress(stream_t *stream);
|
||||
extern int stream_fstat(stream_t *stream, struct stream_stat *buf);
|
||||
extern void stream_set_default(int unit);
|
||||
|
||||
#endif /* __LIBSTREAM_H__ */
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <libmap.h>
|
||||
#endif
|
||||
|
||||
extern int default_unit;
|
||||
|
||||
static char* get_fs(char *path, fs_t *fs)
|
||||
{
|
||||
#ifdef BLOCK_SUPPORT
|
||||
@ -70,8 +72,13 @@ static char *get_device(char* path,
|
||||
{
|
||||
int nb;
|
||||
|
||||
if (*path != '(')
|
||||
return NULL;
|
||||
if (*path != '(') {
|
||||
if (default_unit == -1)
|
||||
return NULL;
|
||||
*device = device_SCSI;
|
||||
*unit = default_unit;
|
||||
*partition = -1;
|
||||
}
|
||||
path++;
|
||||
|
||||
#ifdef FLOPPY_SUPPORT
|
||||
|
14
libstream/stream_set_default.c
Normal file
14
libstream/stream_set_default.c
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
*
|
||||
* (c) 2008 Laurent Vivier <Laurent@lvivier.info>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int default_unit = -1;
|
||||
|
||||
void stream_set_default(int unit)
|
||||
{
|
||||
default_unit = unit;
|
||||
}
|
Loading…
Reference in New Issue
Block a user