From ee6c3f9b4cf08a276c971dee66e1acdb32b3dff9 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 19 Jun 2017 14:38:44 -0500 Subject: Import Upstream version 0.4.2.3 --- Makefile.in | 10 ++--- arch/linux/common/alsa.h | 7 ++-- arch/linux/common/os.h | 9 +++++ arch/linux/common/pci.h | 32 ++++++++++++---- arch/linux/common/sensors.h | 2 +- arch/linux/common/storage.h | 8 +++- autopackage/default.apspec | 2 +- binreloc.c | 6 +++ callbacks.c | 8 ++-- computer.h | 1 + configure | 9 +++-- devices.c | 17 ++++++++- hardinfo.h | 2 + hardinfo.xml | 34 ----------------- iconcache.c | 10 ++++- report.c | 44 +++++++++++----------- shell.c | 91 +++++++++++++++++++++++++-------------------- stock.c | 14 +++---- syncmanager.c | 11 +++++- syncmanager.h | 1 + util.c | 29 +++++++++------ vendor.c | 1 + 22 files changed, 201 insertions(+), 147 deletions(-) delete mode 100644 hardinfo.xml diff --git a/Makefile.in b/Makefile.in index cc713aab..52158394 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -CC = gcc $(ARCHOPTS) -CCSLOW = gcc -O0 -CFLAGS = -fPIC -pipe -Wall $(GTK_CFLAGS) $(GLADE_CFLAGS) $(SOUP_CFLAGS) -I. +CC = gcc $(ARCHOPTS) -g +CCSLOW = gcc -O0 -g +CFLAGS = -fPIC -pipe -Wall -g $(GTK_CFLAGS) $(GLADE_CFLAGS) $(SOUP_CFLAGS) -I. # ---------------------------------------------------------------------------- @@ -61,7 +61,7 @@ install: all mkdir -p ${DESTDIR}/usr/bin mkdir -p ${DESTDIR}/usr/local mkdir -p ${DESTDIR}/usr/share/applications - mkdir -p ${DESTDIR}/usr/lib/hardinfo/modules + mkdir -p ${DESTDIR}${LIBDIR}/hardinfo/modules mkdir -p ${DESTDIR}/usr/share/hardinfo/pixmaps @echo '*** Installing icon...' @@ -71,7 +71,7 @@ install: all cp hardinfo ${DESTDIR}/usr/bin/hardinfo @echo '*** Installing modules...' - cp -Lr modules/*.so ${DESTDIR}/usr/lib/hardinfo/modules + cp -Lr modules/*.so ${DESTDIR}${LIBDIR}/hardinfo/modules @echo '*** Installing pixmaps...' cp -Lr pixmaps/* ${DESTDIR}/usr/share/hardinfo/pixmaps diff --git a/arch/linux/common/alsa.h b/arch/linux/common/alsa.h index 0c0744ae..8f4cc2ac 100644 --- a/arch/linux/common/alsa.h +++ b/arch/linux/common/alsa.h @@ -20,16 +20,15 @@ gchar * computer_get_alsacards(Computer * computer) { GSList *p; - gchar *tmp = ""; + gchar *tmp = g_strdup(""); gint n = 0; if (computer->alsa) { for (p = computer->alsa->cards; p; p = p->next) { AlsaCard *ac = (AlsaCard *) p->data; - tmp = - g_strdup_printf("Audio Adapter#%d=%s\n%s", ++n, - ac->friendly_name, tmp); + tmp = h_strdup_cprintf("Audio Adapter#%d=%s\n", + tmp, ++n, ac->friendly_name); } } diff --git a/arch/linux/common/os.h b/arch/linux/common/os.h index 0fe06709..e4f35e95 100644 --- a/arch/linux/common/os.h +++ b/arch/linux/common/os.h @@ -185,6 +185,15 @@ computer_get_os(void) os->distro = g_strdup(buf); } } + + if (g_str_equal(distro_db[i].codename, "ppy")) { + gchar *tmp; + + tmp = g_strdup_printf("Puppy Linux %.2f", atof(os->distro) / 100.0); + g_free(os->distro); + os->distro = tmp; + } + os->distrocode = g_strdup(distro_db[i].codename); break; diff --git a/arch/linux/common/pci.h b/arch/linux/common/pci.h index 554c3dca..388ce9aa 100644 --- a/arch/linux/common/pci.h +++ b/arch/linux/common/pci.h @@ -21,16 +21,32 @@ __scan_pci(void) { FILE *lspci; gchar buffer[256], *buf, *strhash = NULL, *strdevice = NULL; - gchar *category = NULL, *name = NULL; - gint n = 0; - - if (!(lspci = popen(LSPCI, "r"))) { - goto pci_error; + gchar *category = NULL, *name = NULL, *icon; + gint n = 0, x = 0; + + buf = g_build_filename(g_get_home_dir(), ".hardinfo", "pci.ids", NULL); + if (!g_file_test(buf, G_FILE_TEST_EXISTS)) { + DEBUG("using system-provided PCI IDs"); + g_free(buf); + if (!(lspci = popen(LSPCI, "r"))) { + goto pci_error; + } + } else { + gchar *tmp; + + tmp = g_strdup_printf("%s -i '%s'", LSPCI, buf); + g_free(buf); + buf = tmp; + + DEBUG("using updated PCI IDs (from %s)", buf); + if (!(lspci = popen(tmp, "r"))) { + g_free(buf); + goto pci_error; + } else { + g_free(buf); + } } - gchar *icon; - - int x = 0; /* unique Memory, Capability and I/O port */ while (fgets(buffer, 256, lspci)) { buf = g_strstrip(buffer); diff --git a/arch/linux/common/sensors.h b/arch/linux/common/sensors.h index bc84014b..1c4fd69f 100644 --- a/arch/linux/common/sensors.h +++ b/arch/linux/common/sensors.h @@ -254,7 +254,7 @@ static void read_sensors_acpi(void) if ((tz = g_dir_open(path_tz, 0, NULL))) { const gchar *entry; - gchar *temp = ""; + gchar *temp = g_strdup(""); while ((entry = g_dir_read_name(tz))) { diff --git a/arch/linux/common/storage.h b/arch/linux/common/storage.h index 6700984b..71c206cd 100644 --- a/arch/linux/common/storage.h +++ b/arch/linux/common/storage.h @@ -79,9 +79,13 @@ __scan_scsi_devices(void) model = g_strdup_printf("%s %s", vendor, model + 7); } else if (!strncmp(buf, "Type: ", 8)) { - char *p = strstr(buf, "ANSI SCSI revi"); + char *p; gchar *type = NULL, *icon = NULL; + if (!(p = strstr(buf, "ANSI SCSI revision"))) { + p = strstr(buf, "ANSI SCSI revision"); + } + if (p != NULL) { while (*(--p) == ' '); *(++p) = 0; @@ -335,7 +339,7 @@ __scan_ide_devices(void) g_hash_table_insert(moreinfo, devid, strhash); g_free(model); - model = ""; + model = g_strdup(""); } else g_free(device); diff --git a/autopackage/default.apspec b/autopackage/default.apspec index 9042d252..f12960c1 100644 --- a/autopackage/default.apspec +++ b/autopackage/default.apspec @@ -2,7 +2,7 @@ # Generated by mkapspec 0.2 [Meta] ShortName: hardinfo -SoftwareVersion: 0.4.2.2 +SoftwareVersion: 0.4.2.1 DisplayName: HardInfo $SOFTWAREVERSION RootName: @tia.mat.br/hardinfo:$SOFTWAREVERSION Summary: System profiler and benchmark tool diff --git a/binreloc.c b/binreloc.c index 358445cd..1d1acfe6 100644 --- a/binreloc.c +++ b/binreloc.c @@ -21,6 +21,7 @@ #include #include #include "binreloc.h" +#include "config.h" G_BEGIN_DECLS /** @internal @@ -592,7 +593,12 @@ gchar *gbr_find_lib_dir(const gchar * default_lib_dir) return NULL; } +#ifdef ARCH_x86_64 + dir = g_build_filename(prefix, "lib64", NULL); +#else dir = g_build_filename(prefix, "lib", NULL); +#endif + g_free(prefix); return dir; } diff --git a/callbacks.c b/callbacks.c index 6a84de79..32db0791 100644 --- a/callbacks.c +++ b/callbacks.c @@ -72,22 +72,22 @@ void cb_save_graphic() void cb_open_web_page() { - open_url("http://hardinfo.berlios.de"); + open_url("http://wiki.hardinfo.org"); } void cb_open_online_docs() { - open_url("http://hardinfo.berlios.de/web/Documentation"); + open_url("http://wiki.hardinfo.org/Documentation"); } void cb_report_bug() { - open_url("http://hardinfo.berlios.de/web/BugReports"); + open_url("http://wiki.hardinfo.org/BugReports"); } void cb_donate() { - open_url("http://hardinfo.berlios.de/web/Donate"); + open_url("http://wiki.hardinfo.org/Donate"); } void cb_refresh() diff --git a/computer.h b/computer.h index a6956122..ceb2b2a0 100644 --- a/computer.h +++ b/computer.h @@ -34,6 +34,7 @@ static struct { { DB_PREFIX "SuSE-release", "suse" }, { DB_PREFIX "sun-release", "sun" }, { DB_PREFIX "zenwalk-version", "zen" }, + { DB_PREFIX "puppyversion", "ppy" }, /* * RedHat must be the *last* one to be checked, since * some distros (like Mandrake) includes a redhat-relase diff --git a/configure b/configure index 42dfa9ad..ef2ed8ba 100755 --- a/configure +++ b/configure @@ -45,6 +45,7 @@ case $OS in esac PROC=`uname -m` +LIBDIR='/usr/lib' case $PROC in i?86) ln -sf linux/x86 arch/this @@ -54,7 +55,8 @@ case $PROC in ARCH="ARCH_PPC" ;; x86_64) ln -sf linux/x86_64 arch/this - ARCH="ARCH_x86_64" ;; + ARCH="ARCH_x86_64" + LIBDIR="/usr/lib64" ;; mips*) ln -sf linux/mips arch/this ARCH="ARCH_MIPS" ;; @@ -73,7 +75,7 @@ case $PROC in alpha) ln -sf linux/alpha arch/this ARCH="ARCH_ALPHA" ;; - s390) + s390*) ln -sf linux/s390 arch/this ARCH="ARCH_S390" ;; m68k) @@ -167,7 +169,7 @@ done # -------------------------------------------------------------------------- if [ $SOUP -eq -1 ]; then - echo "Disabling libsoup support. (Network Manager won't be available.)" + echo "Disabling libsoup support. (Network Updater won't be available.)" fi # -------------------------------------------------------------------------- @@ -214,6 +216,7 @@ echo "SOUP_LIBS = ${SOUP_LIBS}" >> Makefile echo "SOUP_CFLAGS = ${SOUP_FLAGS}" >> Makefile echo "PACKAGE = `basename ${PWD}`" >> Makefile echo "ARCHOPTS = " >> Makefile +echo "LIBDIR = $LIBDIR" >> Makefile cat Makefile.in >> Makefile diff --git a/devices.c b/devices.c index e1ccf6c9..6221769c 100644 --- a/devices.c +++ b/devices.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -346,8 +347,20 @@ guchar hi_module_get_weight(void) void hi_module_init(void) { - moreinfo = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + if (!g_file_test("/usr/share/misc/pci.ids", G_FILE_TEST_EXISTS)) { + static SyncEntry se[] = { + { + .fancy_name = "Update PCI ID listing", + .name = "GetPCIIds", + .save_to = "pci.ids", + .get_data = NULL + } + }; + + sync_manager_add_entry(&se[0]); + } + + moreinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); __init_memory_labels(); } diff --git a/hardinfo.h b/hardinfo.h index b621cbc9..36dbb6d6 100644 --- a/hardinfo.h +++ b/hardinfo.h @@ -98,6 +98,8 @@ gchar *seconds_to_string(unsigned int seconds); gchar *h_strdup_cprintf(const gchar *format, gchar *source, ...); gchar *h_strconcat(gchar *string1, ...); +void h_hash_table_remove_all (GHashTable *hash_table); + void module_entry_scan_all_except(ModuleEntry *entries, gint except_entry); void module_entry_scan_all(ModuleEntry *entries); diff --git a/hardinfo.xml b/hardinfo.xml deleted file mode 100644 index 82b3ac26..00000000 --- a/hardinfo.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - hardinfo - HardInfo 0.4.2.2 - System profiler and benchmark tool - - - - - - 2007-07-20 - - UNSTABLE - - Short declarative statement(s) about release for language en. - - Paragraphs describing the release for language en. - - - - /HardInfo%200.4.2.2%200.4.2.2.package - - - - diff --git a/iconcache.c b/iconcache.c index 49325e39..ed7ce209 100644 --- a/iconcache.c +++ b/iconcache.c @@ -26,6 +26,8 @@ void icon_cache_init(void) DEBUG("initializing icon cache"); if (!cache) { cache = g_hash_table_new(g_str_hash, g_str_equal); + } else { + DEBUG("already initialized? huh?"); } } @@ -48,7 +50,9 @@ GdkPixbuf *icon_cache_get_pixbuf(const gchar * file) g_free(path); } - g_object_ref(icon); + if (icon) { + g_object_ref(icon); + } return icon; } @@ -81,7 +85,9 @@ GdkPixbuf *icon_cache_get_pixbuf_at_size(const gchar * file, gint wid, g_free(path); } - g_object_ref(icon); + if (icon) { + g_object_ref(icon); + } return icon; } diff --git a/report.c b/report.c index 5e7e59a6..85653502 100644 --- a/report.c +++ b/report.c @@ -161,6 +161,7 @@ static void report_html_header(ReportContext * ctx) g_strdup_printf ("\n" "\n" "HardInfo (%s) System Report\n" + "\n" "