mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-22 10:29:31 +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
|
LIBRARIES = scsi/libstream.a floppy/libstream.a full/libstream.a
|
||||||
|
|
||||||
SOURCES = stream_close.c stream_open.c stream_read.c stream_lseek.c \
|
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
|
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_close(stream_t *stream);
|
||||||
extern int stream_uncompress(stream_t *stream);
|
extern int stream_uncompress(stream_t *stream);
|
||||||
extern int stream_fstat(stream_t *stream, struct stream_stat *buf);
|
extern int stream_fstat(stream_t *stream, struct stream_stat *buf);
|
||||||
|
extern void stream_set_default(int unit);
|
||||||
|
|
||||||
#endif /* __LIBSTREAM_H__ */
|
#endif /* __LIBSTREAM_H__ */
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include <libmap.h>
|
#include <libmap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int default_unit;
|
||||||
|
|
||||||
static char* get_fs(char *path, fs_t *fs)
|
static char* get_fs(char *path, fs_t *fs)
|
||||||
{
|
{
|
||||||
#ifdef BLOCK_SUPPORT
|
#ifdef BLOCK_SUPPORT
|
||||||
@ -70,8 +72,13 @@ static char *get_device(char* path,
|
|||||||
{
|
{
|
||||||
int nb;
|
int nb;
|
||||||
|
|
||||||
if (*path != '(')
|
if (*path != '(') {
|
||||||
|
if (default_unit == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
*device = device_SCSI;
|
||||||
|
*unit = default_unit;
|
||||||
|
*partition = -1;
|
||||||
|
}
|
||||||
path++;
|
path++;
|
||||||
|
|
||||||
#ifdef FLOPPY_SUPPORT
|
#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