Changeset 5309 for trunk/oscam-simples.c
- Timestamp:
- 05/28/11 17:25:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oscam-simples.c
r5307 r5309 779 779 } 780 780 781 char *get_servicename(struct s_client *cl, int32_t srvid, int32_t caid){ 781 /* Gets the servicename. Make sure that buf is at least 32 bytes large. */ 782 char *get_servicename(struct s_client *cl, int32_t srvid, int32_t caid, char *buf){ 782 783 int32_t i; 783 784 struct s_srvid *this; 784 char *name = (char*)cl->dump; 785 name[0] = 0; 786 787 if (!srvid) { 788 name[0]='\0'; 789 return(name); 790 } 785 buf[0] = '\0'; 786 787 if (!srvid) 788 return(buf); 791 789 792 790 if (cl && cl->last_srvidptr && cl->last_srvidptr->srvid==srvid) 793 791 for (i=0; i < cl->last_srvidptr->ncaid; i++) 794 792 if (cl->last_srvidptr->caid[i] == caid) 795 cs_strncpy( name, cl->last_srvidptr->name, 32);796 797 for (this = cfg.srvid[srvid>>12]; this && (! name[0]); this = this->next)793 cs_strncpy(buf, cl->last_srvidptr->name, 32); 794 795 for (this = cfg.srvid[srvid>>12]; this && (!buf[0]); this = this->next) 798 796 if (this->srvid == srvid) 799 797 for (i=0; i<this->ncaid; i++) 800 798 if (this->caid[i] == caid && this->name) { 801 cs_strncpy( name, this->name, 32);799 cs_strncpy(buf, this->name, 32); 802 800 cl->last_srvidptr = this; 803 801 } 804 802 805 if (! name[0]) {806 snprintf( name, sizeof(cl->dump), "%04X:%04X unknown", caid, srvid);803 if (!buf[0]) { 804 snprintf(buf, 32, "%04X:%04X unknown", caid, srvid); 807 805 cl->last_srvidptr = NULL; 808 806 } 809 return(name); 810 } 811 812 char *get_tiername(int32_t tierid, int32_t caid){ 807 return(buf); 808 } 809 810 /* Gets the tier name. Make sure that buf is at least 83 bytes long. */ 811 char *get_tiername(int32_t tierid, int32_t caid, char *buf){ 813 812 int32_t i; 814 813 struct s_tierid *this = cfg.tierid; 815 static char name[83]; 816 817 for (name[0] = 0; this && (!name[0]); this = this->next) 814 815 for (buf[0] = 0; this && (!buf[0]); this = this->next) 818 816 if (this->tierid == tierid) 819 817 for (i=0; i<this->ncaid; i++) 820 818 if (this->caid[i] == caid) 821 cs_strncpy( name, this->name, 32);819 cs_strncpy(buf, this->name, 32); 822 820 823 821 //if (!name[0]) sprintf(name, "%04X:%04X unknown", caid, tierid); 824 if (!tierid) name[0] = '\0'; 825 return(name); 826 } 827 828 char *get_provider(int32_t caid, uint32_t provid){ 822 if (!tierid) buf[0] = '\0'; 823 return(buf); 824 } 825 826 /* Gets the provider name. Make sure that buf is at least 83 bytes long. */ 827 char *get_provider(int32_t caid, uint32_t provid, char *buf){ 829 828 struct s_provid *this = cfg.provid; 830 static char name[83]; 831 832 for (name[0] = 0; this && (!name[0]); this = this->next) { 829 830 for (buf[0] = 0; this && (!buf[0]); this = this->next) { 833 831 if (this->caid == caid && this->provid == provid) { 834 snprintf( name, 83, "%s", this->prov);832 snprintf(buf, 83, "%s", this->prov); 835 833 if (this->sat[0]) { 836 strcat( name, " / ");837 strcat( name, this->sat);834 strcat(buf, " / "); 835 strcat(buf, this->sat); 838 836 } 839 837 if (this->lang[0]) { 840 strcat( name, " / ");841 strcat( name, this->lang);838 strcat(buf, " / "); 839 strcat(buf, this->lang); 842 840 } 843 841 } 844 842 } 845 843 846 if (! name[0]) snprintf(name, 83, "%04X:%06X unknown", caid, provid);847 if (!caid) name[0] = '\0';848 return( name);844 if (!buf[0]) snprintf(buf, 83, "%04X:%06X unknown", caid, provid); 845 if (!caid) buf[0] = '\0'; 846 return(buf); 849 847 } 850 848
Note:
See TracChangeset
for help on using the changeset viewer.