Debian Codegraph @

src/_dos.c

raw symbols SCIP
1 // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code.
2 // Copyright (C) 1998-2024 Marco Baye
3 // Have a look at "acme.c" for further info
4 //
5 // Platform specific stuff (in this case, for DOS, OS/2 and Windows)
6 #ifndef platform_C
7 #define platform_C
8
9
10 // convert UNIX-style path name to local platform style path name and decide
11 // whether path is absolute or relative. p points to the terminated input
12 // string, to be overwritten with the terminated output string.
13 // conversions done for DOS:
14 // "path/to/file" -> "path\to\file"
15 void platform_convert_path(boolean *is_absolute, char *p)
16 {
17 // leading '/' means absolute path
18 *is_absolute = (*p == '/');
19 // stuff like "c:whatever" also means absolute
20 if ((*p) && (p[1] == ':'))
21 *is_absolute = TRUE;
22 // exchange forward and backward slashes
23 while (*p) {
24 if (*p == '/') {
25 *p = '\\';
26 } else if (*p == '\\') {
27 *p = '/';
28 }
29 ++p;
30 }
31 }
32
33
34 #endif