25 |
|
#include <dos/dosextens.h> |
26 |
|
#include <dos/dostags.h> |
27 |
|
#include <devices/sana2.h> |
28 |
+ |
#define __USE_SYSBASE |
29 |
|
#include <proto/exec.h> |
30 |
|
#include <proto/dos.h> |
31 |
+ |
#include <inline/exec.h> |
32 |
+ |
#include <inline/dos.h> |
33 |
+ |
#include <clib/alib_protos.h> |
34 |
|
|
35 |
|
#include "sysdeps.h" |
36 |
|
#include "cpu_emulation.h" |
396 |
|
ULONG dev_unit; |
397 |
|
|
398 |
|
str = PrefsFindString("ether"); |
399 |
< |
if (str) |
396 |
< |
{ |
399 |
> |
if (str) { |
400 |
|
const char *FirstSlash = strchr(str, '/'); |
401 |
|
const char *LastSlash = strrchr(str, '/'); |
402 |
|
|
403 |
< |
if (FirstSlash && FirstSlash && FirstSlash != LastSlash) |
404 |
< |
{ |
403 |
> |
if (FirstSlash && FirstSlash && FirstSlash != LastSlash) { |
404 |
> |
|
405 |
|
// Device name contains path, i.e. "Networks/xyzzy.device" |
406 |
|
const char *lp = str; |
407 |
|
char *dp = dev_name; |
413 |
|
if (strlen(dev_name) < 1) |
414 |
|
goto quit; |
415 |
|
|
416 |
< |
if (1 != sscanf(LastSlash, "/%ld", &dev_unit)) |
416 |
> |
if (sscanf(LastSlash, "/%ld", &dev_unit) != 1) |
417 |
|
goto quit; |
418 |
< |
|
419 |
< |
// printf("dev=<%s> unit=%d\n", dev_name, dev_unit); |
417 |
< |
} |
418 |
< |
else |
419 |
< |
{ |
420 |
< |
if (2 != sscanf(str, "%[^/]/%ld", dev_name, &dev_unit)) |
418 |
> |
} else { |
419 |
> |
if (sscanf(str, "%[^/]/%ld", dev_name, &dev_unit) != 2) |
420 |
|
goto quit; |
422 |
– |
} |
421 |
|
} |
422 |
< |
else |
422 |
> |
} else |
423 |
|
goto quit; |
424 |
|
|
425 |
|
// Open device |
426 |
|
control_io->ios2_BufferManagement = buffer_tags; |
427 |
< |
od_error = OpenDevice((UBYTE *)dev_name, dev_unit, (struct IORequest *)control_io, 0); |
428 |
< |
if (0 != od_error || control_io->ios2_Req.io_Device == 0) |
431 |
< |
{ |
427 |
> |
od_error = OpenDevice((UBYTE *) dev_name, dev_unit, (struct IORequest *)control_io, 0); |
428 |
> |
if (od_error != 0 || control_io->ios2_Req.io_Device == 0) { |
429 |
|
printf("WARNING: OpenDevice(<%s>, unit=%d) returned error %d)\n", (UBYTE *)dev_name, dev_unit, od_error); |
430 |
|
goto quit; |
431 |
< |
} |
431 |
> |
} |
432 |
|
opened = true; |
433 |
|
|
434 |
|
// Is it Ethernet? |