-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheject_idb.cpp
More file actions
38 lines (30 loc) · 924 Bytes
/
Copy patheject_idb.cpp
File metadata and controls
38 lines (30 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2019-2026 Elias Bachaalany
// SPDX-License-Identifier: LicenseRef-Human-Origin-Source-1.0
//
// This file is licensed under the Human-Origin Source License v1.0.
// See LICENSE.
#include <cstdio>
#include <libidacpp/ipc/named_semaphore.hpp>
#include "eject_core.hpp"
int main(int argc, char* argv[])
{
if (argc < 2)
{
printf("Usage: %s <IDB file path>\n", argv[0]);
return 1;
}
#ifdef __TESTING__
char input[100]; // buffer for user input
printf("eject_idb waiting...press ENTER to continue\n");
fgets(input, sizeof(input), stdin); // read a line, user must press enter
#endif
std::string sem_name = make_semaphore_name(argv[1]);
libidacpp::ipc::named_semaphore_t sem;
if (sem.open(sem_name.c_str()) && sem.post())
{
printf("Ejected %s\n", argv[1]);
return 0;
}
printf("Failed to eject %s\n", argv[1]);
return 1;
}