diff options
| author | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 15:19:47 -0500 | 
|---|---|---|
| committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 15:19:47 -0500 | 
| commit | 79c11b29d78a70ae1b04af3b7ca4ec9bb12dd8d7 (patch) | |
| tree | c4577e59ae13a8031f937991dcc3a63f68d18db5 /arch/common | |
| parent | 62eb92d94fa902b4a34dafce45547680a2655b40 (diff) | |
| parent | 7aacc9f2510901c9e97b30fa9bcb550bb7f99c03 (diff) | |
Merge tag 'upstream/0.5.1+git20170605'
Upstream version 0.5.1+git20170605
Diffstat (limited to 'arch/common')
| -rw-r--r-- | arch/common/blowfish.h | 63 | ||||
| -rw-r--r-- | arch/common/cryptohash.h | 78 | ||||
| -rw-r--r-- | arch/common/display.h | 143 | ||||
| -rw-r--r-- | arch/common/environment.h | 42 | ||||
| -rw-r--r-- | arch/common/fft.h | 47 | ||||
| -rw-r--r-- | arch/common/fib.h | 48 | ||||
| -rw-r--r-- | arch/common/languages.h | 107 | ||||
| -rw-r--r-- | arch/common/nqueens.h | 45 | ||||
| -rw-r--r-- | arch/common/printers.h | 261 | ||||
| -rw-r--r-- | arch/common/raytrace.h | 45 | ||||
| -rw-r--r-- | arch/common/users.h | 50 | 
11 files changed, 0 insertions, 929 deletions
| diff --git a/arch/common/blowfish.h b/arch/common/blowfish.h deleted file mode 100644 index 5fea2e22..00000000 --- a/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, GTimer *timer) -{ -    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/arch/common/cryptohash.h b/arch/common/cryptohash.h deleted file mode 100644 index 9897bb6b..00000000 --- a/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, GTimer *timer) -{ -    unsigned int i; -     -    for (i = start; i <= end; i++) {  -        if (i % 2 == 0) { -            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/arch/common/display.h b/arch/common/display.h deleted file mode 100644 index 075a0a24..00000000 --- a/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/arch/common/environment.h b/arch/common/environment.h deleted file mode 100644 index c78c4a73..00000000 --- a/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 _env; -} diff --git a/arch/common/fft.h b/arch/common/fft.h deleted file mode 100644 index 62daa9fe..00000000 --- a/arch/common/fft.h +++ /dev/null @@ -1,47 +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, GTimer *timer) -{ -    unsigned int i; -     -    for (i = start; i <= end; i++) {  -        fft_bench_start(); -    } -     -    return NULL; -} - -static void -benchmark_fft(void) -{ -    gdouble elapsed = 0; -     -    shell_view_set_enabled(FALSE); -    shell_status_update("Running FFT benchmark..."); -         -    fft_bench_init(); -    elapsed = benchmark_parallel_for(0, 4, fft_for, NULL); -    fft_bench_finish(); -     -    bench_results[BENCHMARK_FFT] = elapsed; -} - - diff --git a/arch/common/fib.h b/arch/common/fib.h deleted file mode 100644 index 6a216afe..00000000 --- a/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/arch/common/languages.h b/arch/common/languages.h deleted file mode 100644 index c1839ee9..00000000 --- a/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", "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/arch/common/nqueens.h b/arch/common/nqueens.h deleted file mode 100644 index 2a233722..00000000 --- a/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, GTimer *timer) -{ -    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/arch/common/printers.h b/arch/common/printers.h deleted file mode 100644 index 2f221252..00000000 --- a/arch/common/printers.h +++ /dev/null @@ -1,261 +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 gboolean -remove_printer_devices(gpointer key, gpointer value, gpointer data) -{ -    return g_str_has_prefix(key, "PRN"); -} - -static void -__init_cups(void) -{ -    static GModule *cups = NULL; -    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); - -    if (!cups_init) { -        __init_cups(); -         -        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"); -	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>" : ""); - -            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(strreplace(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/arch/common/raytrace.h b/arch/common/raytrace.h deleted file mode 100644 index 7fdc5e21..00000000 --- a/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) -{ -    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/arch/common/users.h b/arch/common/users.h deleted file mode 100644 index 2361a4bf..00000000 --- a/arch/common/users.h +++ /dev/null @@ -1,50 +0,0 @@ -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) -{ -    FILE *passwd; -    char buffer[512]; -     -    passwd = fopen("/etc/passwd", "r"); -    if (!passwd) -      return; -     -    if (users) { -      g_free(users); - -      g_hash_table_foreach_remove(moreinfo, remove_users, NULL); -    } -   -    users = g_strdup(""); -     -    while (fgets(buffer, 512, passwd)) { -      gchar **tmp; -      gint uid; -       -      tmp = g_strsplit(buffer, ":", 0); -       -      gchar *key = g_strdup_printf("USER%s", tmp[0]); -      gchar *val = g_strdup_printf("[User Information]\n" -                                   "User ID=%s\n" -                                   "Group ID=%s\n" -                                   "Home directory=%s\n" -                                   "Default shell=%s\n", -                                   tmp[2], tmp[3], tmp[5], tmp[6]); -      g_hash_table_insert(moreinfo, key, val); - -      uid = atoi(tmp[2]); -      strend(tmp[4], ','); -      users = h_strdup_cprintf("$%s$%s=%s\n", users, key, tmp[0], tmp[4]); -       -      g_strfreev(tmp); -    } -     -    fclose(passwd); -} | 
