some fixes to accented characters
[tangerine.git] / rom / dos / remsegment.c
blob40d85e390179b67981b7fb28e5a5ac8eb1899394
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Remove a segment from the system list.
6 Lang: English
7 */
9 #include "dos_intern.h"
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
15 #include <dos/dosextens.h>
16 #include <proto/dos.h>
18 AROS_LH1(LONG, RemSegment,
20 /* SYNOPSIS */
21 AROS_LHA(struct Segment *, seg, D1),
23 /* LOCATION */
24 struct DosLibrary *, DOSBase, 131, Dos)
26 /* FUNCTION
27 Remove the segment seg from the DOS resident command list.
29 The segment to be removed should be in the list, and should
30 have a usercount of 0. System or internal segment cannot be
31 removed (although they can be replaced).
33 INPUTS
34 seg - Segment to remove.
36 RESULT
37 != 0 Segment was removed
38 == 0 Segment was not removed (not in list, or not free).
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 AddSegment(), FindSegment()
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 /* Make sure segment is freeable */
56 #if AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT
57 if (seg->seg_UC == 0 || seg->seg_UC == 1)
58 #else
59 if (seg->seg_UC == 0)
60 #endif
62 struct Segment *next, *prev;
63 prev = NULL;
64 next = BADDR(DOSBase->dl_ResList);
65 while (next != NULL)
67 if (next == seg)
69 if (prev)
71 prev->seg_Next = next->seg_Next;
73 else
75 DOSBase->dl_ResList = MKBADDR(next->seg_Next);
78 return DOSTRUE;
81 prev = next;
82 next = BADDR(next->seg_Next);
86 return DOSFALSE;
88 AROS_LIBFUNC_EXIT
89 } /* RemSegment */