+
+ /* find python-tracebacks, and extract " File "-strings */
+ size_t start = 0;
+
+ char crash_emailaddr[256] = CRASH_EMAILADDR;
+ char crash_component[256] = "enigma2";
+
+ if (component)
+ snprintf(crash_component, 256, component);
+ else
+ {
+ while ((start = lines.find("\n File \"", start)) != std::string::npos)
+ {
+ start += 9;
+ size_t end = lines.find("\"", start);
+ if (end == std::string::npos)
+ break;
+ end = lines.rfind("/", end);
+ if (end == std::string::npos)
+ break;
+ if (end - start >= (256 - strlen(INFOFILE)))
+ continue;
+ char filename[256];
+ snprintf(filename, 256, "%s%s", lines.substr(start, end - start).c_str(), INFOFILE);
+ FILE *cf = fopen(filename, "r");
+ if (cf)
+ {
+ fgets(crash_emailaddr, sizeof crash_emailaddr, cf);
+ if (*crash_emailaddr && crash_emailaddr[strlen(crash_emailaddr)-1] == '\n')
+ crash_emailaddr[strlen(crash_emailaddr)-1] = 0;
+
+ fgets(crash_component, sizeof crash_component, cf);
+ if (*crash_component && crash_component[strlen(crash_component)-1] == '\n')
+ crash_component[strlen(crash_component)-1] = 0;
+ fclose(cf);
+ }
+ }
+ }