tabs->spaces
[AROS.git] / arch / m68k-amiga / setpatch / addpatch.c
blobb1656e36c93101e06e58474b87eb9656f983b44b
1 /*
2 Copyright © <year>, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <string.h>
8 #include <proto/exec.h>
10 #include LC_LIBDEFS_FILE
12 /*****************************************************************************
14 NAME */
15 #include <proto/setpatch.h>
17 AROS_LH1(BOOL, AddPatch,
19 /* SYNOPSIS */
20 AROS_LHA(struct PatchEntry *, pe, A0),
22 /* LOCATION */
23 struct SetPatchBase *, SetPatchBase, 5, Setpatch)
25 /* FUNCTION
27 INPUTS
29 pe - Patch entry header
31 RESULT
33 TRUE - Patch entry is added to the master patch list
34 FALSE - Patch with matching name already in the list
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
44 INTERNALS
46 HISTORY
48 *****************************************************************************/
50 AROS_LIBFUNC_INIT
52 BOOL found = FALSE;
53 struct PatchEntry *tmp;
55 ObtainSemaphore(&SetPatchBase->sp_Patch3.sp_Semaphore);
57 ForeachNode(&SetPatchBase->sp_Patch3.sp_PatchList, tmp) {
58 if (strcmp(pe->pe_Name, tmp->pe_Name) == 0) {
59 found = TRUE;
60 break;
64 if (!found)
65 AddTail((struct List *)&SetPatchBase->sp_Patch3.sp_PatchList, (struct Node *)pe);
67 ReleaseSemaphore(&SetPatchBase->sp_Patch3.sp_Semaphore);
69 return !found;
71 AROS_LIBFUNC_EXIT