aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2/arch/common
diff options
context:
space:
mode:
Diffstat (limited to 'hardinfo2/arch/common')
-rw-r--r--hardinfo2/arch/common/blowfish.h63
-rw-r--r--hardinfo2/arch/common/cryptohash.h78
-rw-r--r--hardinfo2/arch/common/display.h143
-rw-r--r--hardinfo2/arch/common/drawing.h28
-rw-r--r--hardinfo2/arch/common/environment.h42
-rw-r--r--hardinfo2/arch/common/fft.h65
-rw-r--r--hardinfo2/arch/common/fib.h48
-rw-r--r--hardinfo2/arch/common/languages.h107
-rw-r--r--hardinfo2/arch/common/nqueens.h45
-rw-r--r--hardinfo2/arch/common/printers.h268
-rw-r--r--hardinfo2/arch/common/raytrace.h45
-rw-r--r--hardinfo2/arch/common/users.h63
12 files changed, 0 insertions, 995 deletions
diff --git a/hardinfo2/arch/common/blowfish.h b/hardinfo2/arch/common/blowfish.h
deleted file mode 100644
index 333fb157..00000000
--- a/hardinfo2/arch/common/blowfish.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <blowfish.h>
-
-static gpointer
-parallel_blowfish(unsigned int start, unsigned int end, void *data, gint thread_number)
-{
- BLOWFISH_CTX ctx;
- unsigned int i;
- unsigned long L, R;
-
- L = 0xBEBACAFE;
- R = 0xDEADBEEF;
-
- for (i = start; i <= end; i++) {
- Blowfish_Init(&ctx, (unsigned char*)data, 65536);
- Blowfish_Encrypt(&ctx, &L, &R);
- Blowfish_Decrypt(&ctx, &L, &R);
- }
-
- return NULL;
-}
-
-static void
-benchmark_fish(void)
-{
- gdouble elapsed = 0;
- gchar *tmpsrc;
-
- gchar *bdata_path;
-
- bdata_path = g_build_filename(params.path_data, "benchmark.data", NULL);
- if (!g_file_get_contents(bdata_path, &tmpsrc, NULL, NULL)) {
- g_free(bdata_path);
- return;
- }
-
- shell_view_set_enabled(FALSE);
- shell_status_update("Performing Blowfish benchmark...");
-
- elapsed = benchmark_parallel_for(0, 50000, parallel_blowfish, tmpsrc);
-
- g_free(bdata_path);
- g_free(tmpsrc);
-
- bench_results[BENCHMARK_BLOWFISH] = elapsed;
-}
diff --git a/hardinfo2/arch/common/cryptohash.h b/hardinfo2/arch/common/cryptohash.h
deleted file mode 100644
index 2c917c9b..00000000
--- a/hardinfo2/arch/common/cryptohash.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <md5.h>
-#include <sha1.h>
-
-static void inline md5_step(char *data, glong srclen)
-{
- struct MD5Context ctx;
- guchar checksum[16];
-
- MD5Init(&ctx);
- MD5Update(&ctx, (guchar *)data, srclen);
- MD5Final(checksum, &ctx);
-}
-
-static void inline sha1_step(char *data, glong srclen)
-{
- SHA1_CTX ctx;
- guchar checksum[20];
-
- SHA1Init(&ctx);
- SHA1Update(&ctx, (guchar*)data, srclen);
- SHA1Final(checksum, &ctx);
-}
-
-static gpointer cryptohash_for(unsigned int start, unsigned int end, void *data, gint thread_number)
-{
- unsigned int i;
-
- for (i = start; i <= end; i++) {
- if (i & 1) {
- md5_step(data, 65536);
- } else {
- sha1_step(data, 65536);
- }
- }
-
- return NULL;
-}
-
-static void
-benchmark_cryptohash(void)
-{
- gdouble elapsed = 0;
- gchar *tmpsrc, *bdata_path;
-
- bdata_path = g_build_filename(params.path_data, "benchmark.data", NULL);
- if (!g_file_get_contents(bdata_path, &tmpsrc, NULL, NULL)) {
- g_free(bdata_path);
- return;
- }
-
- shell_view_set_enabled(FALSE);
- shell_status_update("Running CryptoHash benchmark...");
-
- elapsed = benchmark_parallel_for(0, 5000, cryptohash_for, tmpsrc);
-
- g_free(bdata_path);
- g_free(tmpsrc);
-
- bench_results[BENCHMARK_CRYPTOHASH] = 312.0 / elapsed;
-}
diff --git a/hardinfo2/arch/common/display.h b/hardinfo2/arch/common/display.h
deleted file mode 100644
index 075a0a24..00000000
--- a/hardinfo2/arch/common/display.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-static void
-get_glx_info(DisplayInfo *di)
-{
- gchar *output;
- if (g_spawn_command_line_sync("glxinfo", &output, NULL, NULL, NULL)) {
- gchar **output_lines;
- gint i = 0;
-
- for (output_lines = g_strsplit(output, "\n", 0);
- output_lines && output_lines[i];
- i++) {
- if (strstr(output_lines[i], "OpenGL")) {
- gchar **tmp = g_strsplit(output_lines[i], ":", 0);
-
- tmp[1] = g_strchug(tmp[1]);
-
- get_str("OpenGL vendor str", di->ogl_vendor);
- get_str("OpenGL renderer str", di->ogl_renderer);
- get_str("OpenGL version str", di->ogl_version);
-
- g_strfreev(tmp);
- } else if (strstr(output_lines[i], "direct rendering: Yes")) {
- di->dri = TRUE;
- }
- }
-
- g_free(output);
- g_strfreev(output_lines);
-
- if (!di->ogl_vendor)
- di->ogl_vendor = "Unknown";
- if (!di->ogl_renderer)
- di->ogl_renderer = "Unknown";
- if (!di->ogl_version)
- di->ogl_version = "Unknown";
- } else {
- di->ogl_vendor = di->ogl_renderer = di->ogl_version = "Unknown";
- }
-
-}
-
-static void
-get_x11_info(DisplayInfo *di)
-{
- gchar *output;
-
- if (g_spawn_command_line_sync("xdpyinfo", &output, NULL, NULL, NULL)) {
- gchar **output_lines, **old;
-
- output_lines = g_strsplit(output, "\n", 0);
- g_free(output);
-
- old = output_lines;
- while (*(output_lines++)) {
- gchar **tmp = g_strsplit(*output_lines, ":", 0);
-
- if (tmp[1] && tmp[0]) {
- tmp[1] = g_strchug(tmp[1]);
-
- get_str("vendor string", di->vendor);
- get_str("X.Org version", di->version);
- get_str("XFree86 version", di->version);
-
- if (g_str_has_prefix(tmp[0], "number of extensions")) {
- int n;
-
- di->extensions = g_strdup("");
-
- for (n = atoi(tmp[1]); n; n--) {
- di->extensions = h_strconcat(di->extensions,
- g_strstrip(*(++output_lines)),
- "=\n",
- NULL);
- }
- g_strfreev(tmp);
-
- break;
- }
- }
-
- g_strfreev(tmp);
- }
-
- g_strfreev(old);
- }
-
- GdkScreen *screen = gdk_screen_get_default();
-
- if (screen && GDK_IS_SCREEN(screen)) {
- gint n_monitors = gdk_screen_get_n_monitors(screen);
- gint i;
-
- di->monitors = NULL;
- for (i = 0; i < n_monitors; i++) {
- GdkRectangle rect;
-
- gdk_screen_get_monitor_geometry(screen, i, &rect);
-
- di->monitors = h_strdup_cprintf("Monitor %d=%dx%d pixels\n",
- di->monitors, i, rect.width, rect.height);
- }
- } else {
- di->monitors = "";
- }
-}
-
-static DisplayInfo *
-computer_get_display(void)
-{
- DisplayInfo *di = g_new0(DisplayInfo, 1);
-
- GdkScreen *screen = gdk_screen_get_default();
-
- if (screen && GDK_IS_SCREEN(screen)) {
- di->width = gdk_screen_get_width(screen);
- di->height = gdk_screen_get_height(screen);
- } else {
- di->width = di->height = 0;
- }
-
- get_glx_info(di);
- get_x11_info(di);
-
- return di;
-}
diff --git a/hardinfo2/arch/common/drawing.h b/hardinfo2/arch/common/drawing.h
deleted file mode 100644
index 4ebfb3b5..00000000
--- a/hardinfo2/arch/common/drawing.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "guibench.h"
-
-static void
-benchmark_gui(void)
-{
- shell_view_set_enabled(FALSE);
- shell_status_update("Running drawing benchmark...");
-
- bench_results[BENCHMARK_GUI] = guibench();
-}
diff --git a/hardinfo2/arch/common/environment.h b/hardinfo2/arch/common/environment.h
deleted file mode 100644
index 669be6d1..00000000
--- a/hardinfo2/arch/common/environment.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2008 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-static gchar *_env = NULL;
-void scan_env_var(gboolean reload)
-{
- SCAN_START();
-
- gchar **envlist;
- gint i;
-
- g_free(_env);
-
- _env = g_strdup("[Environment Variables]\n");
- for (i = 0, envlist = g_listenv(); envlist[i]; i++) {
- _env = h_strdup_cprintf("%s=%s\n", _env,
- envlist[i], g_getenv(envlist[i]));
- }
- g_strfreev(envlist);
-
- SCAN_END();
-}
-
-gchar *callback_env_var(void)
-{
- return g_strdup(_env);
-}
diff --git a/hardinfo2/arch/common/fft.h b/hardinfo2/arch/common/fft.h
deleted file mode 100644
index f1a0ced8..00000000
--- a/hardinfo2/arch/common/fft.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <fftbench.h>
-
-static gpointer fft_for(unsigned int start, unsigned int end, void *data, gint thread_number)
-{
- unsigned int i;
- FFTBench **benches = (FFTBench **)data;
- FFTBench *fftbench = (FFTBench *)(benches[thread_number]);
-
- for (i = start; i <= end; i++) {
- fft_bench_run(fftbench);
- }
-
- return NULL;
-}
-
-static void
-benchmark_fft(void)
-{
- gdouble elapsed = 0;
- int n_cores, i;
- gchar *temp;
- FFTBench **benches;
-
- shell_view_set_enabled(FALSE);
- shell_status_update("Running FFT benchmark...");
-
- /* Pre-allocate all benchmarks */
- temp = module_call_method("devices::getProcessorCount");
- n_cores = temp ? atoi(temp) : 1;
- g_free(temp);
-
- benches = g_new0(FFTBench *, n_cores);
- for (i = 0; i < n_cores; i++) {
- benches[i] = fft_bench_new();
- }
-
- /* Run the benchmark */
- elapsed = benchmark_parallel_for(0, 4, fft_for, benches);
-
- /* Free up the memory */
- for (i = 0; i < n_cores; i++) {
- fft_bench_free(benches[i]);
- }
- g_free(benches);
-
- bench_results[BENCHMARK_FFT] = elapsed;
-}
diff --git a/hardinfo2/arch/common/fib.h b/hardinfo2/arch/common/fib.h
deleted file mode 100644
index 6a216afe..00000000
--- a/hardinfo2/arch/common/fib.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-static gulong
-fib(gulong n)
-{
- if (n == 0)
- return 0;
- else if (n <= 2)
- return 1;
- return fib(n - 1) + fib(n - 2);
-}
-
-static void
-benchmark_fib(void)
-{
- GTimer *timer = g_timer_new();
- gdouble elapsed;
-
- shell_view_set_enabled(FALSE);
- shell_status_update("Calculating the 42nd Fibonacci number...");
-
- g_timer_reset(timer);
- g_timer_start(timer);
-
- fib(42);
-
- g_timer_stop(timer);
- elapsed = g_timer_elapsed(timer, NULL);
- g_timer_destroy(timer);
-
- bench_results[BENCHMARK_FIB] = elapsed;
-}
diff --git a/hardinfo2/arch/common/languages.h b/hardinfo2/arch/common/languages.h
deleted file mode 100644
index 39e557fc..00000000
--- a/hardinfo2/arch/common/languages.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-void
-scan_languages(OperatingSystem * os)
-{
- FILE *locale;
- gchar buf[512], *retval = NULL;
-
- locale = popen("locale -va && echo", "r");
- if (!locale)
- return;
-
- gchar name[32];
- gchar *title = NULL,
- *source = NULL,
- *address = NULL,
- *email = NULL,
- *language = NULL,
- *territory = NULL,
- *revision = NULL,
- *date = NULL,
- *codeset = NULL;
-
- while (fgets(buf, 512, locale)) {
- if (!strncmp(buf, "locale:", 7)) {
- sscanf(buf, "locale: %s", name);
- (void)fgets(buf, 128, locale);
- } else if (strchr(buf, '|')) {
- gchar **tmp = g_strsplit(buf, "|", 2);
-
- tmp[0] = g_strstrip(tmp[0]);
-
- if (tmp[1]) {
- tmp[1] = g_strstrip(tmp[1]);
-
- get_str("title", title);
- get_str("source", source);
- get_str("address", address);
- get_str("email", email);
- get_str("language", language);
- get_str("territory", territory);
- get_str("revision", revision);
- get_str("date", date);
- get_str("codeset", codeset);
- }
-
- g_strfreev(tmp);
- } else {
- gchar *currlocale;
-
- retval = h_strdup_cprintf("$%s$%s=%s\n", retval, name, name, title);
-
-#define FIELD(f) f ? f : "(Unknown)"
- currlocale = g_strdup_printf("[Locale Information]\n"
- "Name=%s (%s)\n"
- "Source=%s\n"
- "Address=%s\n"
- "Email=%s\n"
- "Language=%s\n"
- "Territory=%s\n"
- "Revision=%s\n"
- "Date=%s\n"
- "Codeset=%s\n",
- name, FIELD(title),
- FIELD(source), FIELD(address),
- FIELD(email), FIELD(language),
- FIELD(territory), FIELD(revision),
- FIELD(date), FIELD(codeset));
-#undef FIELD
-
- g_hash_table_insert(moreinfo, g_strdup(name), currlocale);
-
- g_free(title);
- g_free(source);
- g_free(address);
- g_free(email);
- g_free(language);
- g_free(territory);
- g_free(revision);
- g_free(date);
- g_free(codeset);
-
- title = source = address = email = language = territory = \
- revision = date = codeset = NULL;
- }
- }
-
- fclose(locale);
-
- os->languages = retval;
-}
diff --git a/hardinfo2/arch/common/nqueens.h b/hardinfo2/arch/common/nqueens.h
deleted file mode 100644
index 6ad5b4fd..00000000
--- a/hardinfo2/arch/common/nqueens.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <nqueens.h>
-
-static gpointer nqueens_for(unsigned int start, unsigned int end, void *data, gint thread_number)
-{
- unsigned int i;
-
- for (i = start; i <= end; i++) {
- nqueens(0);
- }
-
- return NULL;
-}
-
-static void
-benchmark_nqueens(void)
-{
- gdouble elapsed = 0;
-
- shell_view_set_enabled(FALSE);
- shell_status_update("Running N-Queens benchmark...");
-
- elapsed = benchmark_parallel_for(0, 10, nqueens_for, NULL);
-
- bench_results[BENCHMARK_NQUEENS] = elapsed;
-}
-
-
diff --git a/hardinfo2/arch/common/printers.h b/hardinfo2/arch/common/printers.h
deleted file mode 100644
index 0e865c04..00000000
--- a/hardinfo2/arch/common/printers.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-typedef struct _CUPSDest CUPSDest;
-typedef struct _CUPSOption CUPSOption;
-
-struct _CUPSOption {
- char *name, *value;
-};
-
-struct _CUPSDest {
- char *name, *instance;
- int is_default;
- int num_options;
- CUPSOption *options;
-};
-
-static int (*cups_dests_get) (CUPSDest **dests) = NULL;
-static int (*cups_dests_free) (int num_dests, CUPSDest *dests) = NULL;
-static gboolean cups_init = FALSE;
-static GModule *cups = NULL;
-
-static gboolean
-remove_printer_devices(gpointer key, gpointer value, gpointer data)
-{
- return g_str_has_prefix(key, "PRN");
-}
-
-static void
-__init_cups(void)
-{
- const char *libcups[] = { "libcups", "libcups.so", "libcups.so.1", "libcups.so.2", NULL };
-
- if (!(cups_dests_get && cups_dests_free)) {
- int i;
-
- for (i = 0; libcups[i] != NULL; i++) {
- cups = g_module_open(libcups[i], G_MODULE_BIND_LAZY);
- if (cups)
- break;
- }
-
- if (!cups) {
- cups_init = FALSE;
- return;
- }
-
- if (!g_module_symbol(cups, "cupsGetDests", (gpointer) & cups_dests_get)
- || !g_module_symbol(cups, "cupsFreeDests", (gpointer) & cups_dests_free)) {
- g_module_close(cups);
- cups_init = FALSE;
- }
- }
-
- cups_init = TRUE;
-}
-
-gchar *__cups_callback_ptype(gchar *strvalue)
-{
- if (strvalue) {
- unsigned value = atoi(strvalue);
- gchar *output = g_strdup("\n");
-
- if (value & 0x0004)
- output = h_strdup_cprintf("\342\232\254 Can do black and white printing=\n", output);
- if (value & 0x0008)
- output = h_strdup_cprintf("\342\232\254 Can do color printing=\n", output);
- if (value & 0x0010)
- output = h_strdup_cprintf("\342\232\254 Can do duplexing=\n", output);
- if (value & 0x0020)
- output = h_strdup_cprintf("\342\232\254 Can do staple output=\n", output);
- if (value & 0x0040)
- output = h_strdup_cprintf("\342\232\254 Can do copies=\n", output);
- if (value & 0x0080)
- output = h_strdup_cprintf("\342\232\254 Can collate copies=\n", output);
- if (value & 0x80000)
- output = h_strdup_cprintf("\342\232\254 Printer is rejecting jobs=\n", output);
- if (value & 0x1000000)
- output = h_strdup_cprintf("\342\232\254 Printer was automatically discovered and added=\n", output);
-
- return output;
- } else {
- return g_strdup("Unknown");
- }
-}
-
-gchar *__cups_callback_state(gchar *value)
-{
- if (!value) {
- return g_strdup("Unknown");
- }
-
- if (g_str_equal(value, "3")) {
- return g_strdup("Idle");
- } else if (g_str_equal(value, "4")) {
- return g_strdup("Printing a Job");
- } else if (g_str_equal(value, "5")) {
- return g_strdup("Stopped");
- } else {
- return g_strdup("Unknown");
- }
-}
-
-gchar *__cups_callback_state_change_time(gchar *value)
-{
- struct tm tm;
- char buf[255];
-
- if (value) {
- strptime(value, "%s", &tm);
- strftime(buf, sizeof(buf), "%c", &tm);
-
- return g_strdup(buf);
- } else {
- return g_strdup("Unknown");
- }
-}
-
-gchar *__cups_callback_boolean(gchar *value)
-{
- if (value) {
- return g_strdup(g_str_equal(value, "1") ? "Yes" : "No");
- } else {
- return g_strdup("Unknown");
- }
-}
-
-const struct {
- char *key, *name;
- gchar *(*callback)(gchar *value);
-} cups_fields[] = {
- { "Printer Information", NULL, NULL },
- { "printer-info", "Destination Name", NULL },
- { "printer-make-and-model", "Make and Model", NULL },
-
- { "Capabilities", NULL, NULL },
- { "printer-type", "#", __cups_callback_ptype },
-
- { "Printer State", NULL, NULL },
- { "printer-state", "State", __cups_callback_state },
- { "printer-state-change-time", "Change Time", __cups_callback_state_change_time },
- { "printer-state-reasons", "State Reasons" },
-
- { "Sharing Information", NULL, NULL },
- { "printer-is-shared", "Shared?", __cups_callback_boolean },
- { "printer-location", "Physical Location" },
- { "auth-info-required", "Authentication Required", __cups_callback_boolean },
-
- { "Jobs", NULL, NULL },
- { "job-hold-until", "Hold Until", NULL },
- { "job-priority", "Priority", NULL },
- { "printer-is-accepting-jobs", "Accepting Jobs", __cups_callback_boolean },
-
- { "Media", NULL, NULL },
- { "media", "Media", NULL },
- { "finishings", "Finishings", NULL },
- { "copies", "Copies", NULL },
-};
-
-void
-__scan_printers(void)
-{
- int num_dests, i, j;
- CUPSDest *dests;
- gchar *prn_id, *prn_moreinfo;
-
- g_free(printer_list);
- g_free(printer_icons);
-
- if (!cups_init) {
- __init_cups();
-
- printer_icons = g_strdup("");
- printer_list = g_strdup("[Printers]\n"
- "No suitable CUPS library found=");
- return;
- }
-
- /* remove old devices from global device table */
- g_hash_table_foreach_remove(moreinfo, remove_printer_devices, NULL);
-
- num_dests = cups_dests_get(&dests);
- if (num_dests > 0) {
- printer_list = g_strdup_printf("[Printers (CUPS)]\n");
- printer_icons = g_strdup("");
- for (i = 0; i < num_dests; i++) {
- GHashTable *options;
-
- options = g_hash_table_new(g_str_hash, g_str_equal);
-
- for (j = 0; j < dests[i].num_options; j++) {
- g_hash_table_insert(options,
- g_strdup(dests[i].options[j].name),
- g_strdup(dests[i].options[j].value));
- }
-
- prn_id = g_strdup_printf("PRN%d", i);
-
- printer_list = h_strdup_cprintf("\n$%s$%s=%s\n",
- printer_list,
- prn_id,
- dests[i].name,
- dests[i].is_default ? "<i>Default</i>" : "");
- printer_icons = h_strdup_cprintf("\nIcon$%s$%s=printer.png",
- printer_icons,
- prn_id,
- dests[i].name);
-
- prn_moreinfo = g_strdup("");
- for (j = 0; j < G_N_ELEMENTS(cups_fields); j++) {
- if (!cups_fields[j].name) {
- prn_moreinfo = h_strdup_cprintf("[%s]\n",
- prn_moreinfo,
- cups_fields[j].key);
- } else {
- gchar *temp;
-
- temp = g_hash_table_lookup(options, cups_fields[j].key);
-
- if (cups_fields[j].callback) {
- temp = cups_fields[j].callback(temp);
- } else {
- if (temp) {
- /* FIXME Do proper escaping */
- temp = g_strdup(strreplacechr(temp, "&=", ' '));
- } else {
- temp = g_strdup("Unknown");
- }
- }
-
- prn_moreinfo = h_strdup_cprintf("%s=%s\n",
- prn_moreinfo,
- cups_fields[j].name,
- temp);
-
- g_free(temp);
- }
- }
-
- g_hash_table_insert(moreinfo, prn_id, prn_moreinfo);
- g_hash_table_destroy(options);
- }
-
- cups_dests_free(num_dests, dests);
- } else {
- printer_list = g_strdup("[Printers]\n"
- "No printers found=\n");
- }
-}
diff --git a/hardinfo2/arch/common/raytrace.h b/hardinfo2/arch/common/raytrace.h
deleted file mode 100644
index fe2fda91..00000000
--- a/hardinfo2/arch/common/raytrace.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-void fbench(); /* fbench.c */
-
-static gpointer
-parallel_raytrace(unsigned int start, unsigned int end, gpointer data, gint thread_number)
-{
- unsigned int i;
-
- for (i = start; i <= end; i++) {
- fbench();
- }
-
- return NULL;
-}
-
-static void
-benchmark_raytrace(void)
-{
- gdouble elapsed = 0;
-
- shell_view_set_enabled(FALSE);
- shell_status_update("Performing John Walker's FBENCH...");
-
- elapsed = benchmark_parallel_for(0, 1000, parallel_raytrace, NULL);
-
- bench_results[BENCHMARK_RAYTRACE] = elapsed;
-}
-
diff --git a/hardinfo2/arch/common/users.h b/hardinfo2/arch/common/users.h
deleted file mode 100644
index 8d087fa5..00000000
--- a/hardinfo2/arch/common/users.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2003-2009 Leandro A. F. Pereira <leandro@hardinfo.org>
- *
- * 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, version 2.
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <pwd.h>
-
-static gchar *users = NULL;
-
-static gboolean
-remove_users(gpointer key, gpointer value, gpointer data)
-{
- return g_str_has_prefix(key, "USER");
-}
-
-static void
-scan_users_do(void)
-{
- struct passwd *passwd_;
- passwd_ = getpwent();
- if (!passwd_)
- return;
-
- if (users) {
- g_free(users);
- g_hash_table_foreach_remove(moreinfo, remove_users, NULL);
- }
-
- users = g_strdup("");
-
- while (passwd_) {
- gchar *key = g_strdup_printf("USER%s", passwd_->pw_name);
- gchar *val = g_strdup_printf("[User Information]\n"
- "User ID=%d\n"
- "Group ID=%d\n"
- "Home directory=%s\n"
- "Default shell=%s\n",
- (gint) passwd_->pw_uid,
- (gint) passwd_->pw_gid,
- passwd_->pw_dir,
- passwd_->pw_shell);
- g_hash_table_insert(moreinfo, key, val);
-
- strend(passwd_->pw_gecos, ',');
- users = h_strdup_cprintf("$%s$%s=%s\n", users, key, passwd_->pw_name, passwd_->pw_gecos);
- passwd_ = getpwent();
- }
-
- endpwent();
-}