diff --git a/setter/CMakeLists.txt b/setter/CMakeLists.txt index 70da8e6..9c8aebb 100644 --- a/setter/CMakeLists.txt +++ b/setter/CMakeLists.txt @@ -33,9 +33,12 @@ message("Detected system processor: ${CMAKE_SYSTEM_PROCESSOR}") add_subdirectory(src) -add_subdirectory(src/dos) -add_subdirectory(src/unix) -add_subdirectory(src/linux) -add_subdirectory(src/win32) add_subdirectory(src/macos) +add_subdirectory(src/dos) +add_subdirectory(src/win32) + +add_subdirectory(src/unix) +add_subdirectory(src/darwin) +add_subdirectory(src/linux) + diff --git a/setter/src/darwin/CMakeLists.txt b/setter/src/darwin/CMakeLists.txt new file mode 100644 index 0000000..d664dec --- /dev/null +++ b/setter/src/darwin/CMakeLists.txt @@ -0,0 +1,42 @@ +# /**************************************************************************** +# Aaru Data Preservation Suite +# ----------------------------------------------------------------------------- +# +# Author(s) : Natalia Portillo +# +# --[ License ] --------------------------------------------------------------- +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ----------------------------------------------------------------------------- +# Copyright (C) 2011-2021 Natalia Portillo +# *****************************************************************************/ + +if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + return() +endif() + +project( + fssetter-darwin + DESCRIPTION "Filesystem test creator for Darwin" + LANGUAGES C) + +add_definitions(-DHAVE_SYS_MOUNT_H) + +set(PLATFORM_SOURCES os.c darwin.h) + +set(EXECUTABLE_NAME "fssetter-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") + +add_executable(${EXECUTABLE_NAME} ${PLATFORM_SOURCES}) + +target_link_libraries(${EXECUTABLE_NAME} core unix) \ No newline at end of file diff --git a/setter/src/darwin/darwin.h b/setter/src/darwin/darwin.h new file mode 100644 index 0000000..d8b43ad --- /dev/null +++ b/setter/src/darwin/darwin.h @@ -0,0 +1,10 @@ +// +// Created by claunia on 14/3/21. +// + +#ifndef SETTER_SRC_DARWIN_DARWIN_H_ +#define SETTER_SRC_DARWIN_DARWIN_H_ + +void DarwinGetOsInfo(); + +#endif // SETTER_SRC_DARWIN_DARWIN_H_ diff --git a/setter/src/darwin/os.c b/setter/src/darwin/os.c new file mode 100644 index 0000000..e675e14 --- /dev/null +++ b/setter/src/darwin/os.c @@ -0,0 +1,52 @@ +/**************************************************************************** +Aaru Data Preservation Suite +----------------------------------------------------------------------------- + + Author(s) : Natalia Portillo + +--[ License ] --------------------------------------------------------------- + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +----------------------------------------------------------------------------- +Copyright (C) 2011-2021 Natalia Portillo +*****************************************************************************/ + +#include +#include +#include +#include + +#include "../include/defs.h" +#include "../log.h" + +void DarwinGetOsInfo() +{ + struct utsname buf; + int ret; + struct stat finder; + + ret = uname(&buf); + + if(ret) + { + log_write("Error %d retrieving OS information.\n", errno); + return; + } + + log_write("OS information:\n"); + log_write("\tOS name: %s\n", buf.sysname); + log_write("\tRelease: %s\n", buf.release); + log_write("\tVersion: %s\n", buf.version); + log_write("\tMachine: %s\n", buf.machine); +} diff --git a/setter/src/unix/CMakeLists.txt b/setter/src/unix/CMakeLists.txt index 0266a98..1655e88 100644 --- a/setter/src/unix/CMakeLists.txt +++ b/setter/src/unix/CMakeLists.txt @@ -22,7 +22,7 @@ # Copyright (C) 2011-2021 Natalia Portillo # *****************************************************************************/ -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") return() endif()