3
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#include "sema.h"
|
|
22 |
#include "log.h"
|
|
23 |
|
|
24 |
#include <stdlib.h>
|
|
25 |
|
|
26 |
/* The output semaphore. */
|
|
27 |
sbs_semaphore talon_sem;
|
|
28 |
|
|
29 |
int main(int argc, char *argv[])
|
|
30 |
{
|
|
31 |
char *buildid_str = getenv("TALON_BUILDID");
|
|
32 |
|
|
33 |
if (!buildid_str)
|
|
34 |
{
|
|
35 |
error("error: TALON_BUILDID not set in environment\n");
|
|
36 |
return 1;
|
|
37 |
}
|
|
38 |
|
|
39 |
if (argc != 2)
|
|
40 |
{
|
|
41 |
error("error: one argument required: start|stop\n");
|
|
42 |
return 1;
|
|
43 |
}
|
|
44 |
|
|
45 |
talon_sem.name = buildid_str;
|
|
46 |
talon_sem.timeout=0;
|
|
47 |
|
|
48 |
if (strcasecmp("start", argv[1]) == 0)
|
|
49 |
{
|
|
50 |
sema_create(&talon_sem);
|
|
51 |
}
|
|
52 |
else if (strcasecmp("stop", argv[1]) == 0)
|
|
53 |
{
|
|
54 |
sema_destroy(&talon_sem);
|
|
55 |
} else {
|
|
56 |
error("error: argument must be: start|stop\n");
|
|
57 |
return 1;
|
|
58 |
}
|
|
59 |
|
|
60 |
return 0;
|
|
61 |
}
|