[gnome-builder] posix: add helpers for posix systems
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] posix: add helpers for posix systems
- Date: Mon, 15 Feb 2016 04:59:07 +0000 (UTC)
commit fc9f709873278019c57e969daba9b83ec837aa33
Author: Christian Hergert <chergert redhat com>
Date: Sun Feb 14 20:46:21 2016 -0800
posix: add helpers for posix systems
libide/util/ide-posix.c | 37 +++++++++++++++++++++++++++++++++++++
libide/util/ide-posix.h | 30 ++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/libide/util/ide-posix.c b/libide/util/ide-posix.c
new file mode 100644
index 0000000..f15ca39
--- /dev/null
+++ b/libide/util/ide-posix.c
@@ -0,0 +1,37 @@
+/* ide-posix.c
+ *
+ * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <string.h>
+#include <sys/utsname.h>
+
+#include "ide-posix.h"
+
+gchar *
+ide_get_system_arch (void)
+{
+ struct utsname u;
+ const char *machine;
+
+ if (uname (&u) < 0)
+ return g_strdup ("unknown");
+
+ /* config.sub doesn't accept amd64-OS */
+ machine = strcmp (u.machine, "amd64") ? u.machine : "x86_64";
+
+ return g_strdup (machine);
+}
diff --git a/libide/util/ide-posix.h b/libide/util/ide-posix.h
new file mode 100644
index 0000000..193d60f
--- /dev/null
+++ b/libide/util/ide-posix.h
@@ -0,0 +1,30 @@
+/* ide-posix.h
+ *
+ * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_POSIX_H
+#define IDE_POSIX_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gchar *ide_get_system_arch (void);
+
+G_END_DECLS
+
+#endif /* IDE_POSIX_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]