talonctl.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include "sema.h"
  18. #include "log.h"
  19. #include <stdlib.h>
  20. /* The output semaphore. */
  21. sbs_semaphore talon_sem;
  22. int main(int argc, char *argv[])
  23. {
  24. char *buildid_str = getenv("TALON_BUILDID");
  25. if (!buildid_str)
  26. {
  27. error("error: TALON_BUILDID not set in environment\n");
  28. return 1;
  29. }
  30. if (argc != 2)
  31. {
  32. error("error: one argument required: start|stop\n");
  33. return 1;
  34. }
  35. talon_sem.name = buildid_str;
  36. talon_sem.timeout=0;
  37. if (strcasecmp("start", argv[1]) == 0)
  38. {
  39. sema_create(&talon_sem);
  40. }
  41. else if (strcasecmp("stop", argv[1]) == 0)
  42. {
  43. sema_destroy(&talon_sem);
  44. } else {
  45. error("error: argument must be: start|stop\n");
  46. return 1;
  47. }
  48. return 0;
  49. }