Changeset 30174
- Timestamp:
- 09/27/14 16:50:51 (8 years ago)
- Location:
- titan/titan
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/about.h
r23206 r30174 4 4 int screenabout(void) 5 5 { 6 char *text = NULL, *tmpstr = NULL;7 struct dvbdev* dvbnode = dvbdev;6 char* tmpstr = NULL; 7 tmpstr = getabout(); 8 8 9 text = ostrcat(_("Image"), ": ", 0, 0); 10 text = ostrcat(text, PROGNAME, 1, 0); 11 text = ostrcat(text, "\n", 1, 0); 12 text = ostrcat(text, _("Version"), 1, 0); 13 text = ostrcat(text, ": ", 1, 0); 14 text = ostrcat(text, OVERSION, 1, 0); 15 text = ostrcat(text, "\n", 1, 0); 16 text = ostrcat(text, _("Copyright"), 1, 0); 17 text = ostrcat(text, ": ", 1, 0); 18 text = ostrcat(text, COPYRIGHT, 1, 0); 19 text = ostrcat(text, "\n\n", 1, 0); 20 21 while(dvbnode != NULL) 22 { 23 if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo != NULL) 24 { 25 text = ostrcat(text, _("Tuner"), 1, 0); 26 text = ostrcat(text, ": ", 1, 0); 27 if(dvbnode->feinfo->name != NULL) 28 text = ostrcat(text, dvbnode->feinfo->name, 1, 0); 29 else 30 text = ostrcat(text, _("unknown"), 1, 0); 31 text = ostrcat(text, "\n", 1, 0); 32 text = ostrcat(text, _("Tunertype"), 1, 0); 33 text = ostrcat(text, ": ", 1, 0); 34 35 tmpstr = fegettypestr(dvbnode); 36 text = ostrcat(text, tmpstr, 1, 1); 37 text = ostrcat(text, "\n\n", 1, 0); 38 } 39 dvbnode = dvbnode->next; 40 } 41 42 char* flog = readfiletomem("/tmp/.firmware.log", 0); 43 text = ostrcat(text, flog, 1, 1); 44 45 textbox(_("System-Info"), text, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 600, 0, 0); 46 free(text); 9 textbox(_("System-Info"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 600, 0, 0); 10 free(tmpstr); 47 11 48 12 return 0; -
titan/titan/global.h
r29681 r30174 6419 6419 } 6420 6420 6421 char* system_infos(int mode) 6422 { 6423 char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL; 6424 6425 if(mode == 0) 6426 { 6427 tmpstr1 = ostrcat("Date = ", "", 0, 0); 6428 tmpstr1 = ostrcat(tmpstr1, gettime(NULL, "%d %B %Y"), 1, 1); 6429 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 6430 6431 tmpstr1 = ostrcat("\nTime = ", "", 0, 0); 6432 tmpstr1 = ostrcat(tmpstr1, gettime(NULL, "%H:%M:%S"), 1, 1); 6433 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 6434 6435 tmpstr1 = ostrcat("\nUptime = ", "", 0, 0); 6436 tmpstr2 = command("uptime"); 6437 if(tmpstr2 != NULL) tmpstr2 = strtok(tmpstr2, ","); 6438 tmpstr1 = ostrcat(tmpstr1, tmpstr2, 1, 1); 6439 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 6440 6441 tmpstr1 = ostrcat("\nBoxtype = ", "", 0, 0); 6442 tmpstr2 = string_toupper(command("cat /etc/model")); 6443 tmpstr1 = ostrcat(tmpstr1, tmpstr2, 1, 1); 6444 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 6445 6446 tmpstr1 = ostrcat("\nLoad = ", "", 0, 0); 6447 tmpstr2 = command("cat /proc/loadavg"); 6448 tmpstr1 = ostrcat(tmpstr1, tmpstr2, 1, 1); 6449 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 6450 } 6451 6452 if(mode == 1) 6453 { 6454 system("ls /media/usb/* >/dev/null"); 6455 system("ls /media/net/* >/dev/null"); 6456 system("ls /var/swap/* >/dev/null"); 6457 system("ls /mnt/swapextension/* >/dev/null"); 6458 system("ls /var/backup/* >/dev/null"); 6459 system("ls /media/hdd/* >/dev/null"); 6460 tmpstr = command("df -h"); 6461 } 6462 6463 if(mode == 2) 6464 tmpstr = command("cat /proc/version"); 6465 6466 if(mode == 3) 6467 { 6468 system("ls /media/usb/* >/dev/null"); 6469 system("ls /media/net/* >/dev/null"); 6470 system("ls /var/swap/* >/dev/null"); 6471 system("ls /mnt/swapextension/* >/dev/null"); 6472 system("ls /var/backup/* >/dev/null"); 6473 system("ls /media/hdd/* >/dev/null"); 6474 tmpstr = command("mount"); 6475 } 6476 6477 if(mode == 4) 6478 { 6479 tmpstr1 = command("ifconfig"); 6480 tmpstr2 = command("route -n"); 6481 tmpstr = ostrcat(tmpstr1, tmpstr2, 1, 1); 6482 } 6483 6484 if(mode == 5) 6485 tmpstr = command("free"); 6486 6487 return tmpstr; 6488 } 6489 6490 char* system_infos_sysinfo(int mode) 6491 { 6492 char* tmpstr = NULL; 6493 6494 if(mode == 0) 6495 tmpstr = command("cat /proc/cpuinfo | sed 's/\t\t/\t/'"); 6496 else if(mode == 1) 6497 tmpstr = command("cat /proc/meminfo"); 6498 else if(mode == 2) 6499 tmpstr = command("cat /proc/mtd"); 6500 else if(mode == 3) 6501 tmpstr = command("cat /proc/modules"); 6502 else if(mode == 4) 6503 tmpstr = command("cat /proc/devices"); 6504 else if(mode == 5) 6505 { 6506 char* tmpstr1 = NULL, **tmpstr2 = NULL, **tmpstr3 = NULL; 6507 int i = 0, ii = 0; 6508 char* swap[] = {"Name: ", "Type: ", "Size: ", "Used: ", "Prio: "}; 6509 6510 tmpstr1 = command("cat /proc/swaps | sed 's/\t/ /g; s/[ ]* / /g'"); 6511 tmpstr2 = str_split(tmpstr1, "\n"); 6512 if(tmpstr2 != NULL) 6513 { 6514 free(tmpstr2[0]); tmpstr2[0] = NULL; 6515 6516 for(i = 1; tmpstr2[i] != NULL; i++) 6517 { 6518 tmpstr3 = str_split(tmpstr2[i], " "); 6519 if(tmpstr3 != NULL) 6520 { 6521 6522 for(ii = 0; tmpstr3[ii] != NULL; ii++) 6523 { 6524 tmpstr = ostrcat(tmpstr, swap[ii], 1, 0); 6525 tmpstr = ostrcat(tmpstr, tmpstr3[ii], 1, 1); 6526 tmpstr = ostrcat(tmpstr, "\n", 1, 0); 6527 } 6528 } 6529 6530 tmpstr = ostrcat(tmpstr, "\n", 1, 0); 6531 free(tmpstr2[i]); tmpstr2[i] = NULL; 6532 free(tmpstr3); tmpstr3 = NULL; 6533 } 6534 } 6535 6536 free(tmpstr3); tmpstr3 = NULL; 6537 free(tmpstr2); tmpstr2 = NULL; 6538 free(tmpstr1); tmpstr1 = NULL; 6539 } 6540 else if(mode == 6) 6541 tmpstr = command("top -b -n1"); 6542 else if(mode == 7) 6543 tmpstr = command("ps"); 6544 else if(mode == 8) 6545 tmpstr = command("cat /proc/bus/usb/devices"); 6546 6547 return tmpstr; 6548 } 6549 6550 char* system_logs(int mode) 6551 { 6552 char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL, *path = NULL, *boxversion = NULL; 6553 6554 if(mode == 0) 6555 { 6556 tmpstr1 = readfiletomem("/etc/motd", 0); 6557 if(tmpstr1 != NULL) tmpstr2 = strstr(tmpstr1, "wElc0me"); 6558 tmpstr3 = readfiletomem("/etc/imageinfo", 0); 6559 if(tmpstr2 == NULL) 6560 tmpstr = ostrcat(tmpstr3, NULL, 1, 0); 6561 else 6562 tmpstr = ostrcat(tmpstr2, tmpstr3, 1, 1); 6563 } 6564 else if(mode == 1) 6565 { 6566 if(isfile("/etc/model") == 0) return NULL; 6567 boxversion = string_tolower(readsys("/etc/model", 1)); 6568 6569 // if(file_exist("/etc/.beta")) 6570 path = ostrcat(path, "/svn/image-beta/changelog.", 1, 0); 6571 // else 6572 // path = ostrcat(path, "/svn/image/changelog.", 1, 0); 6573 6574 path = ostrcat(path, boxversion, 1, 0); 6575 path = ostrcat(path, ".titan", 1, 0); 6576 6577 // if(file_exist("/etc/.beta")) 6578 tmpstr1 = gethttp("beta.dyndns.tv", path, 80, NULL, HTTPAUTH, 5000, NULL, 0); 6579 // else 6580 // tmpstr1 = gethttp("atemio.dyndns.tv", path, 80, NULL, HTTPAUTH, 5000, NULL, 0); 6581 6582 tmpstr = readfromlinetoline(tmpstr1, 37, 537, 1); 6583 } 6584 else if(mode == 2) 6585 { 6586 // if(file_exist("/etc/.beta")) 6587 path = ostrcat(path, "/svn/image-beta/changelog.git", 1, 0); 6588 // else 6589 // path = ostrcat(path, "/svn/image/changelog.git", 1, 0); 6590 6591 // if(file_exist("/etc/.beta")) 6592 tmpstr1 = gethttp("beta.dyndns.tv", path, 80, NULL, HTTPAUTH, 5000, NULL, 0); 6593 // else 6594 // tmpstr1 = gethttp("atemio.dyndns.tv", path, 80, NULL, HTTPAUTH, 5000, NULL, 0); 6595 6596 tmpstr = readfromlinetoline(tmpstr1, 0, 500, 1); 6597 } 6598 else if(mode == 3) 6599 { 6600 tmpstr = readfiletomem(getconfig("tracelog", NULL), 0); 6601 } 6602 6603 free(path), path = NULL; 6604 free(boxversion), boxversion = NULL; 6605 // free(tmpstr1), tmpstr1 = NULL; 6606 // free(tmpstr2), tmpstr2 = NULL; 6607 // free(tmpstr3), tmpstr3 = NULL; 6608 6609 return tmpstr; 6610 } 6611 6612 char* getabout() 6613 { 6614 char* text = NULL, *tmpstr = NULL; 6615 struct dvbdev* dvbnode = dvbdev; 6616 6617 text = ostrcat(_("Image"), ": ", 0, 0); 6618 text = ostrcat(text, PROGNAME, 1, 0); 6619 text = ostrcat(text, "\n", 1, 0); 6620 text = ostrcat(text, _("Version"), 1, 0); 6621 text = ostrcat(text, ": ", 1, 0); 6622 text = ostrcat(text, OVERSION, 1, 0); 6623 text = ostrcat(text, "\n", 1, 0); 6624 text = ostrcat(text, _("Copyright"), 1, 0); 6625 text = ostrcat(text, ": ", 1, 0); 6626 text = ostrcat(text, COPYRIGHT, 1, 0); 6627 text = ostrcat(text, "\n\n", 1, 0); 6628 6629 while(dvbnode != NULL) 6630 { 6631 if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo != NULL) 6632 { 6633 text = ostrcat(text, _("Tuner"), 1, 0); 6634 text = ostrcat(text, ": ", 1, 0); 6635 if(dvbnode->feinfo->name != NULL) 6636 text = ostrcat(text, dvbnode->feinfo->name, 1, 0); 6637 else 6638 text = ostrcat(text, _("unknown"), 1, 0); 6639 text = ostrcat(text, "\n", 1, 0); 6640 text = ostrcat(text, _("Tunertype"), 1, 0); 6641 text = ostrcat(text, ": ", 1, 0); 6642 6643 tmpstr = fegettypestr(dvbnode); 6644 text = ostrcat(text, tmpstr, 1, 1); 6645 text = ostrcat(text, "\n\n", 1, 0); 6646 } 6647 dvbnode = dvbnode->next; 6648 } 6649 6650 char* flog = readfiletomem("/tmp/.firmware.log", 0); 6651 text = ostrcat(text, flog, 1, 1); 6652 6653 return text; 6654 } 6655 6656 6421 6657 #endif -
titan/titan/header.h
r29235 r30174 8 8 #ifndef HEADER_H 9 9 #define HEADER_H 10 11 //serviceinfo.h 12 char* fegettypestr(struct dvbdev* dvbnode); 10 13 11 14 //tunerconfig.h … … 181 184 // info.h 182 185 void screengetserial(); 183 void screensystem_ info(int mode);186 void screensystem_logs(int mode); 184 187 185 188 //system_update.h -
titan/titan/httpd.h
r30108 r30174 292 292 m_unlock(&status.waitrcmutex, 24); 293 293 } 294 else if(ostrcmp(query, "getsysteminfos") == 0 && param != NULL) 295 buf = webgetsysteminfos(param, fmt); 296 else if(ostrcmp(query, "getsysinfos") == 0 && param != NULL) 297 buf = webgetsysinfos(param, fmt); 298 else if(ostrcmp(query, "getlogs") == 0 && param != NULL) 299 buf = webgetlogs(param, fmt); 300 else if(ostrcmp(query, "getabout") == 0) 301 buf = webgetabout(fmt); 302 else if(ostrcmp(query, "getserviceinfo") == 0) 303 buf = webgetserviceinfo(fmt); 304 else if(ostrcmp(query, "getstreaming") == 0) 305 buf = webgetstreaming(fmt); 306 else if(ostrcmp(query, "getnewsletter") == 0) 307 buf = webgetnewsletter(fmt); 294 308 else if(ostrcmp(query, "gethelp") == 0 && param != NULL) 295 309 { 296 310 m_lock(&status.waitrcmutex, 24); 297 311 buf = webgethelp(param, fmt); 298 m_unlock(&status.waitrcmutex, 24);299 }300 else if(ostrcmp(query, "getchannellist") == 0)301 {302 m_lock(&status.waitrcmutex, 24);303 buf = webgetchannellist(fmt);304 312 m_unlock(&status.waitrcmutex, 24); 305 313 } -
titan/titan/httpdfunc.h
r30133 r30174 3215 3215 } 3216 3216 } 3217 3217 3218 buf = string_replace_all("\n", "<br>\n", buf, 1); 3219 3218 3220 if(fmt == 0) 3219 3221 { … … 4849 4851 } 4850 4852 4851 char* webgetchannellist(int fmt) 4852 { 4853 char* buf = NULL; 4854 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 4855 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 4856 buf = ostrcat(buf, "</head><body class=body id=\"channellist\">", 1, 0); 4857 4858 buf = ostrcat(buf, "<table cellpadding=3 cellspacing=0><tr><td nowrap>", 1, 0); 4859 buf = ostrcat(buf, "<a class=linelink2 href=query?getallchannel target=main>", 1, 0); 4860 buf = ostrcat(buf, _("ALL"), 1, 0); 4861 buf = ostrcat(buf, "</a> ", 1, 0); 4862 buf = ostrcat(buf, "<a class=linelink2 href=query?getsat target=main>", 1, 0); 4863 buf = ostrcat(buf, _("SAT"), 1, 0); 4864 buf = ostrcat(buf, "</a> ", 1, 0); 4865 buf = ostrcat(buf, "<a class=linelink2 href=query?getprovider target=main>", 1, 0); 4866 buf = ostrcat(buf, _("Provider"), 1, 0); 4867 buf = ostrcat(buf, "</a> ", 1, 0); 4868 buf = ostrcat(buf, "<a class=linelink2 href=query?getaz target=main>", 1, 0); 4869 buf = ostrcat(buf, _("A-Z"), 1, 0); 4870 buf = ostrcat(buf, "</a> ", 1, 0); 4871 buf = ostrcat(buf, "<a class=linelink2 href=query?getbouquet target=main>", 1, 0); 4872 buf = ostrcat(buf, _("Bouquets"), 1, 0); 4873 buf = ostrcat(buf, "</a> ", 1, 0); 4874 buf = ostrcat(buf, "</td></tr></table></body></html>", 1, 0); 4875 4876 debug(10, "buf: %s", buf); 4877 printf("buf: %s\n", buf); 4853 char* webgetsysteminfos(char* param, int fmt) 4854 { 4855 char* buf = NULL, *tmpstr = NULL; 4856 int mode; 4857 4858 mode = atoi(param); 4859 if(fmt == 0) 4860 { 4861 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 4862 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 4863 buf = ostrcat(buf, "</head><body class=body id=\"systeminfos\">", 1, 0); 4864 buf = ostrcat(buf, "<br>", 1, 0); 4865 buf = ostrcat(buf, "<h1>", 1, 0); 4866 if(mode == 0) 4867 buf = ostrcat(buf, _("System Status"), 1, 0); 4868 else if(mode == 1) 4869 buf = ostrcat(buf, _("Free Space"), 1, 0); 4870 else if(mode == 2) 4871 buf = ostrcat(buf, _("Kernel"), 1, 0); 4872 else if(mode == 3) 4873 buf = ostrcat(buf, _("Mounts"), 1, 0); 4874 else if(mode == 4) 4875 buf = ostrcat(buf, _("Network"), 1, 0); 4876 else if(mode == 5) 4877 buf = ostrcat(buf, _("Ram"), 1, 0); 4878 4879 buf = ostrcat(buf, "</h1>", 1, 0); 4880 buf = ostrcat(buf, "<br>", 1, 0); 4881 } 4882 4883 tmpstr = system_infos(mode); 4884 tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1); 4885 4886 buf = ostrcat(buf, tmpstr, 1, 0); 4887 4888 if(fmt == 0) 4889 { 4890 buf = ostrcat(buf, "</body></html>", 1, 0); 4891 } 4892 4878 4893 return buf; 4894 } 4895 4896 char* webgetsysinfos(char* param, int fmt) 4897 { 4898 char* buf = NULL, *tmpstr = NULL; 4899 int mode; 4900 4901 mode = atoi(param); 4902 if(fmt == 0) 4903 { 4904 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 4905 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 4906 buf = ostrcat(buf, "</head><body class=body id=\"sysinfos\">", 1, 0); 4907 buf = ostrcat(buf, "<br>", 1, 0); 4908 buf = ostrcat(buf, "<h1>", 1, 0); 4909 if(mode == 0) 4910 buf = ostrcat(buf, _("CPU"), 1, 0); 4911 else if(mode == 1) 4912 buf = ostrcat(buf, _("Memory"), 1, 0); 4913 else if(mode == 2) 4914 buf = ostrcat(buf, _("MTD"), 1, 0); 4915 else if(mode == 3) 4916 buf = ostrcat(buf, _("Module"), 1, 0); 4917 else if(mode == 4) 4918 buf = ostrcat(buf, _("Devices"), 1, 0); 4919 else if(mode == 5) 4920 buf = ostrcat(buf, _("Swap"), 1, 0); 4921 else if(mode == 6) 4922 buf = ostrcat(buf, _("Top"), 1, 0); 4923 else if(mode == 7) 4924 buf = ostrcat(buf, _("Prozesslist"), 1, 0); 4925 else if(mode == 8) 4926 buf = ostrcat(buf, _("USB"), 1, 0); 4927 4928 buf = ostrcat(buf, "</h1>", 1, 0); 4929 buf = ostrcat(buf, "<br>", 1, 0); 4930 } 4931 4932 tmpstr = system_infos_sysinfo(mode); 4933 tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1); 4934 4935 buf = ostrcat(buf, tmpstr, 1, 0); 4936 4937 if(fmt == 0) 4938 { 4939 buf = ostrcat(buf, "</body></html>", 1, 0); 4940 } 4941 4942 return buf; 4943 } 4944 4945 char* webgetlogs(char* param, int fmt) 4946 { 4947 char* buf = NULL, *tmpstr = NULL; 4948 int mode; 4949 4950 mode = atoi(param); 4951 if(fmt == 0) 4952 { 4953 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 4954 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 4955 buf = ostrcat(buf, "</head><body class=body id=\"logs\">", 1, 0); 4956 buf = ostrcat(buf, "<br>", 1, 0); 4957 buf = ostrcat(buf, "<h1>", 1, 0); 4958 if(mode == 0) 4959 buf = ostrcat(buf, _("Hotline"), 1, 0); 4960 else if(mode == 1) 4961 buf = ostrcat(buf, _("Svn Changelog"), 1, 0); 4962 else if(mode == 2) 4963 buf = ostrcat(buf, _("Git Changelog"), 1, 0); 4964 else if(mode == 3) 4965 buf = ostrcat(buf, _("titan Log"), 1, 0); 4966 else if(mode == 4) 4967 buf = ostrcat(buf, _("Svn Changelog Full"), 1, 0); 4968 else if(mode == 5) 4969 buf = ostrcat(buf, _("Git Changelog Full"), 1, 0); 4970 4971 buf = ostrcat(buf, "</h1>", 1, 0); 4972 buf = ostrcat(buf, "<br>", 1, 0); 4973 } 4974 4975 tmpstr = system_logs(mode); 4976 tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1); 4977 4978 buf = ostrcat(buf, tmpstr, 1, 0); 4979 4980 if(fmt == 0) 4981 { 4982 buf = ostrcat(buf, "</body></html>", 1, 0); 4983 } 4984 4985 return buf; 4986 } 4987 4988 char* webgetabout(int fmt) 4989 { 4990 char* buf = NULL, *tmpstr = NULL; 4991 4992 if(fmt == 0) 4993 { 4994 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 4995 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 4996 buf = ostrcat(buf, "</head><body class=body id=\"about\">", 1, 0); 4997 buf = ostrcat(buf, "<br>", 1, 0); 4998 buf = ostrcat(buf, "<h1>", 1, 0); 4999 buf = ostrcat(buf, _("About"), 1, 0); 5000 buf = ostrcat(buf, "</h1>", 1, 0); 5001 buf = ostrcat(buf, "<br>", 1, 0); 5002 } 5003 5004 tmpstr = getabout(); 5005 tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1); 5006 5007 buf = ostrcat(buf, tmpstr, 1, 1); 5008 5009 if(fmt == 0) 5010 { 5011 buf = ostrcat(buf, "</body></html>", 1, 0); 5012 } 5013 5014 return buf; 5015 } 5016 5017 char* webgetserviceinfo(int fmt) 5018 { 5019 char* buf = NULL, *tmpstr = NULL; 5020 5021 if(fmt == 0) 5022 { 5023 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 5024 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 5025 buf = ostrcat(buf, "</head><body class=body id=\"serviceinfo\">", 1, 0); 5026 buf = ostrcat(buf, "<br>", 1, 0); 5027 buf = ostrcat(buf, "<h1>", 1, 0); 5028 buf = ostrcat(buf, _("Service"), 1, 0); 5029 buf = ostrcat(buf, "</h1>", 1, 0); 5030 buf = ostrcat(buf, "<br>", 1, 0); 5031 } 5032 5033 // tmpstr = getabout(); 5034 // readnewsletter(); 5035 tmpstr = readfiletomem("/tmp/Service.txt", 0); 5036 tmpstr = ostrcat(tmpstr, "\ncomming soon...\n", 1, 0); 5037 5038 tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1); 5039 5040 buf = ostrcat(buf, tmpstr, 1, 1); 5041 5042 if(fmt == 0) 5043 { 5044 buf = ostrcat(buf, "</body></html>", 1, 0); 5045 } 5046 5047 return buf; 5048 } 5049 5050 char* webgetnewsletter(int fmt) 5051 { 5052 char* buf = NULL, *tmpstr = NULL; 5053 5054 if(fmt == 0) 5055 { 5056 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 5057 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 5058 buf = ostrcat(buf, "</head><body class=body id=\"newsletter\">", 1, 0); 5059 buf = ostrcat(buf, "<br>", 1, 0); 5060 buf = ostrcat(buf, "<h1>", 1, 0); 5061 buf = ostrcat(buf, _("Newsletter"), 1, 0); 5062 buf = ostrcat(buf, "</h1>", 1, 0); 5063 buf = ostrcat(buf, "<br>", 1, 0); 5064 } 5065 5066 // tmpstr = getabout(); 5067 // readnewsletter(); 5068 tmpstr = readfiletomem("/tmp/newsletter.txt", 0); 5069 tmpstr = ostrcat(tmpstr, "\ncomming soon...\n", 1, 0); 5070 tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1); 5071 5072 buf = ostrcat(buf, tmpstr, 1, 1); 5073 5074 if(fmt == 0) 5075 { 5076 buf = ostrcat(buf, "</body></html>", 1, 0); 5077 } 5078 5079 return buf; 5080 } 5081 5082 char* webgetstreaming(int fmt) 5083 { 5084 char* buf = NULL, *tmpstr = NULL; 5085 5086 if(fmt == 0) 5087 { 5088 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0); 5089 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0); 5090 buf = ostrcat(buf, "</head><body class=body id=\"streaming\">", 1, 0); 5091 buf = ostrcat(buf, "<br>", 1, 0); 5092 buf = ostrcat(buf, "<h1>", 1, 0); 5093 buf = ostrcat(buf, _("Streaming"), 1, 0); 5094 buf = ostrcat(buf, "</h1>", 1, 0); 5095 buf = ostrcat(buf, "<br>", 1, 0); 5096 } 5097 5098 // tmpstr = getabout(); 5099 // readnewsletter(); 5100 tmpstr = readfiletomem("/tmp/streaming.txt", 0); 5101 tmpstr = ostrcat(tmpstr, "\ncomming soon...\n", 1, 0); 5102 5103 tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1); 5104 5105 buf = ostrcat(buf, tmpstr, 1, 1); 5106 5107 if(fmt == 0) 5108 { 5109 buf = ostrcat(buf, "</body></html>", 1, 0); 5110 } 5111 5112 return buf; 4879 5113 } 4880 5114 -
titan/titan/info.h
r29665 r30174 31 31 } 32 32 33 void screensystem_ info(int mode)33 void screensystem_logs(int mode) 34 34 { 35 35 char* tmpstr = NULL; … … 43 43 44 44 if(mode == 0) 45 { 46 char* tmpstr1 = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL; 47 45 changetitle(systeminfo, _("Infos")); 46 else if(mode == 1) 47 changetitle(systeminfo, _("Infos")); 48 else if(mode == 2) 48 49 changetitle(systeminfo, _("Infos")); 49 50 50 tmpstr1 = readfiletomem("/etc/motd", 0); 51 if(tmpstr1 != NULL) tmpstr2 = strstr(tmpstr1, "wElc0me"); 52 tmpstr3 = readfiletomem("/etc/imageinfo", 0); 53 if(tmpstr2 == NULL) 54 tmpstr = ostrcat(tmpstr3, NULL, 1, 0); 55 else 56 tmpstr = ostrcat(tmpstr2, tmpstr3, 0, 1); 57 changetext(info, tmpstr); 58 59 free(tmpstr1); tmpstr1 = NULL; 60 free(tmpstr); tmpstr = NULL; 61 } 62 else if(mode == 1) 63 { 64 changetitle(systeminfo, _("Infos")); 65 66 if(isfile("/etc/model") == 0) return; 67 char* boxversion = string_tolower(readsys("/etc/model", 1)); 68 char* path = NULL; 69 char* out = NULL; 70 71 // if(file_exist("/etc/.beta")) 72 path = ostrcat(path, "/svn/image-beta/changelog.", 1, 0); 73 // else 74 // path = ostrcat(path, "/svn/image/changelog.", 1, 0); 75 76 path = ostrcat(path, boxversion, 1, 0); 77 path = ostrcat(path, ".titan", 1, 0); 78 79 // if(file_exist("/etc/.beta")) 80 tmpstr = gethttp("beta.dyndns.tv", path, 80, NULL, HTTPAUTH, 5000, NULL, 0); 81 // else 82 // tmpstr = gethttp("atemio.dyndns.tv", path, 80, NULL, HTTPAUTH, 5000, NULL, 0); 83 84 free(path), path = NULL; 85 free(boxversion), boxversion = NULL; 86 out = readfromlinetoline(tmpstr, 37, 537, 1); 87 changetext(info, out); 88 } 89 else if(mode == 2) 90 { 91 changetitle(systeminfo, _("Infos")); 92 93 char* path = NULL; 94 char* out = NULL; 95 96 // if(file_exist("/etc/.beta")) 97 path = ostrcat(path, "/svn/image-beta/changelog.git", 1, 0); 98 // else 99 // path = ostrcat(path, "/svn/image/changelog.git", 1, 0); 100 101 // if(file_exist("/etc/.beta")) 102 tmpstr = gethttp("beta.dyndns.tv", path, 80, NULL, HTTPAUTH, 5000, NULL, 0); 103 // else 104 // tmpstr = gethttp("atemio.dyndns.tv", path, 80, NULL, HTTPAUTH, 5000, NULL, 0); 105 106 free(path), path = NULL; 107 out = readfromlinetoline(tmpstr, 0, 500, 1); 108 changetext(info, out); 109 } 51 tmpstr = system_logs(mode); 52 changetext(info, tmpstr); 53 free(tmpstr), tmpstr = NULL; 110 54 111 55 clearscreen(load); -
titan/titan/menu.h
r29038 r30174 888 888 { 889 889 if(check == 1) return 0; 890 screensystem_ info(0);890 screensystem_logs(0); 891 891 } 892 892 else if(ostrcmp("infos_titaninfo", menuentry->name) == 0) 893 893 { 894 894 if(check == 1) return 0; 895 screensystem_ info(1);895 screensystem_logs(1); 896 896 } 897 897 else if(ostrcmp("infos_gitinfo", menuentry->name) == 0) 898 898 { 899 899 if(check == 1) return 0; 900 screensystem_ info(2);900 screensystem_logs(2); 901 901 } 902 902 else if(ostrcmp("system_backup", menuentry->name) == 0) -
titan/titan/system_infos.h
r26554 r30174 12 12 13 13 if(mode == 0) 14 {15 char* tmpstr1 = NULL, *tmpstr2 = NULL;16 17 14 changetitle(system_info, _("System Status")); 18 19 tmpstr1 = ostrcat("Date = ", "", 0, 0); 20 tmpstr1 = ostrcat(tmpstr1, gettime(NULL, "%d %B %Y"), 1, 1); 21 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 22 23 tmpstr1 = ostrcat("\nTime = ", "", 0, 0); 24 tmpstr1 = ostrcat(tmpstr1, gettime(NULL, "%H:%M:%S"), 1, 1); 25 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 26 27 tmpstr1 = ostrcat("\nUptime = ", "", 0, 0); 28 tmpstr2 = command("uptime"); 29 if(tmpstr2 != NULL) tmpstr2 = strtok(tmpstr2, ","); 30 tmpstr1 = ostrcat(tmpstr1, tmpstr2, 1, 1); 31 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 32 33 tmpstr1 = ostrcat("\nBoxtype = ", "", 0, 0); 34 tmpstr2 = string_toupper(command("cat /etc/model")); 35 tmpstr1 = ostrcat(tmpstr1, tmpstr2, 1, 1); 36 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 37 38 tmpstr1 = ostrcat("\nLoad = ", "", 0, 0); 39 tmpstr2 = command("cat /proc/loadavg"); 40 tmpstr1 = ostrcat(tmpstr1, tmpstr2, 1, 1); 41 tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1); 42 43 changetext(info, tmpstr); 44 free(tmpstr); tmpstr = NULL; 45 } 46 47 if(mode == 1) 48 { 15 else if(mode == 1) 49 16 changetitle(system_info, _("Free Space")); 50 system("ls /media/usb/* >/dev/null"); 51 system("ls /media/net/* >/dev/null"); 52 system("ls /var/swap/* >/dev/null"); 53 system("ls /mnt/swapextension/* >/dev/null"); 54 system("ls /var/backup/* >/dev/null"); 55 system("ls /media/hdd/* >/dev/null"); 56 tmpstr = command("df -h"); 57 changetext(info, tmpstr); 58 59 free(tmpstr); tmpstr = NULL; 60 } 61 62 if(mode == 2) 63 { 17 else if(mode == 2) 64 18 changetitle(system_info, _("Kernel")); 65 66 tmpstr = command("cat /proc/version"); 67 changetext(info, tmpstr); 68 69 free(tmpstr); tmpstr = NULL; 70 } 71 72 if(mode == 3) 73 { 19 else if(mode == 3) 74 20 changetitle(system_info, _("Mounts")); 75 system("ls /media/usb/* >/dev/null"); 76 system("ls /media/net/* >/dev/null"); 77 system("ls /var/swap/* >/dev/null"); 78 system("ls /mnt/swapextension/* >/dev/null"); 79 system("ls /var/backup/* >/dev/null"); 80 system("ls /media/hdd/* >/dev/null"); 81 tmpstr = command("mount"); 82 changetext(info, tmpstr); 83 84 free(tmpstr); tmpstr = NULL; 85 } 86 87 if(mode == 4) 88 { 89 char* tmpstr1 = NULL, *tmpstr2 = NULL; 90 21 else if(mode == 4) 91 22 changetitle(system_info, _("Network")); 92 93 tmpstr = command("ifconfig"); 94 tmpstr1 = command("route -n"); 95 tmpstr2 = ostrcat(tmpstr, tmpstr1, 1, 1); 96 changetext(info, tmpstr2); 97 98 free(tmpstr2); tmpstr2 = NULL; 99 } 100 101 if(mode == 5) 102 { 23 else if(mode == 5) 103 24 changetitle(system_info, _("Ram")); 104 25 105 tmpstr = command("free"); 106 changetext(info, tmpstr); 107 108 free(tmpstr); tmpstr = NULL; 109 } 26 tmpstr = system_infos(mode); 27 changetext(info, tmpstr); 28 29 free(tmpstr); tmpstr = NULL; 110 30 111 31 drawscreen(system_info, 0, 0); -
titan/titan/system_infos_sysinfo.h
r18644 r30174 13 13 14 14 if(mode == 0) 15 {16 15 changetitle(system_info, _("CPU info")); 17 18 tmpstr = command("cat /proc/cpuinfo | sed 's/\t\t/\t/'"); 19 changetext(info, _(tmpstr)); 20 21 free(tmpstr); tmpstr = NULL; 22 } 23 24 if(mode == 1) 25 { 16 else if(mode == 1) 26 17 changetitle(system_info, _("Memory info")); 27 28 tmpstr = command("cat /proc/meminfo"); 29 changetext(info, _(tmpstr)); 30 31 free(tmpstr); tmpstr = NULL; 32 } 33 34 if(mode == 2) 35 { 18 else if(mode == 2) 36 19 changetitle(system_info, _("MTD info")); 37 38 tmpstr = command("cat /proc/mtd"); 39 changetext(info, _(tmpstr)); 40 41 free(tmpstr); tmpstr = NULL; 42 } 43 44 if(mode == 3) 45 { 20 else if(mode == 3) 46 21 changetitle(system_info, _("Module info")); 47 48 tmpstr = command("cat /proc/modules"); 49 changetext(info, _(tmpstr)); 50 51 free(tmpstr); tmpstr = NULL; 52 } 53 54 if(mode == 4) 55 { 22 else if(mode == 4) 56 23 changetitle(system_info, _("Devices")); 57 58 tmpstr = command("cat /proc/devices"); 59 changetext(info, _(tmpstr)); 60 61 free(tmpstr); tmpstr = NULL; 62 } 63 64 if(mode == 5) 65 { 66 char* tmpstr1 = NULL, **tmpstr2 = NULL, **tmpstr3 = NULL; 67 int i = 0, ii = 0; 68 char* swap[] = {"Name: ", "Type: ", "Size: ", "Used: ", "Prio: "}; 69 24 else if(mode == 5) 70 25 changetitle(system_info, _("Swap info")); 71 72 tmpstr1 = command("cat /proc/swaps | sed 's/\t/ /g; s/[ ]* / /g'"); 73 tmpstr2 = str_split(tmpstr1, "\n"); 74 if(tmpstr2 != NULL) 75 { 76 free(tmpstr2[0]); tmpstr2[0] = NULL; 77 78 for(i = 1; tmpstr2[i] != NULL; i++) 79 { 80 tmpstr3 = str_split(tmpstr2[i], " "); 81 if(tmpstr3 != NULL) 82 { 83 84 for(ii = 0; tmpstr3[ii] != NULL; ii++) 85 { 86 tmpstr = ostrcat(tmpstr, swap[ii], 1, 0); 87 tmpstr = ostrcat(tmpstr, tmpstr3[ii], 1, 1); 88 tmpstr = ostrcat(tmpstr, "\n", 1, 0); 89 } 90 } 91 92 tmpstr = ostrcat(tmpstr, "\n", 1, 0); 93 free(tmpstr2[i]); tmpstr2[i] = NULL; 94 free(tmpstr3); tmpstr3 = NULL; 95 } 96 } 97 98 changetext(info, _(tmpstr)); 99 100 free(tmpstr3); tmpstr3 = NULL; 101 free(tmpstr2); tmpstr2 = NULL; 102 free(tmpstr1); tmpstr1 = NULL; 103 free(tmpstr); tmpstr = NULL; 104 } 105 106 if(mode == 6) 107 { 26 else if(mode == 6) 108 27 changetitle(system_info, _("Top Info")); 109 110 tmpstr = command("top -b -n1"); 111 changetext(info, tmpstr); 112 113 free(tmpstr); tmpstr = NULL; 114 } 115 116 if(mode == 7) 117 { 28 else if(mode == 7) 118 29 changetitle(system_info, _("Prozess Info")); 119 120 tmpstr = command("ps"); 121 changetext(info, tmpstr); 122 123 free(tmpstr); tmpstr = NULL; 124 } 125 126 if(mode == 8) 127 { 30 else if(mode == 8) 128 31 changetitle(system_info, _("USB Info")); 129 32 130 tmpstr = command("cat /proc/bus/usb/devices"); 131 changetext(info, tmpstr); 132 133 free(tmpstr); tmpstr = NULL; 134 } 33 tmpstr = system_infos_sysinfo(mode); 135 34 136 35 drawscreen(system_info, 0, 0); 36 changetext(info, tmpstr); 37 free(tmpstr); tmpstr = NULL; 137 38 138 39 while(1)
Note: See TracChangeset
for help on using the changeset viewer.