Changeset 1709


Ignore:
Timestamp:
02/26/10 12:59:30 (11 years ago)
Author:
merek
Message:
  • More code cleanup oscam-config.c
  • Log some warnings instead print to stderr
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/oscam-config.c

    r1708 r1709  
    552552
    553553    if (token[0] != '#')
    554         cs_log( "Warning: keyword '%s' in anticascading section not recognized",token);
     554        cs_log("Warning: keyword '%s' in anticascading section not recognized",token);
    555555}
    556556#endif
     
    746746
    747747    if (token[0] != '#')
    748         cs_log( "Warning: keyword '%s' in camd33 section not recognized",token);
     748        cs_log("Warning: keyword '%s' in camd33 section not recognized",token);
    749749}
    750750
     
    782782
    783783    if (token[0] != '#')
    784         cs_log( "Warning: keyword '%s' in camd35 section not recognized", token);
     784        cs_log("Warning: keyword '%s' in camd35 section not recognized", token);
    785785}
    786786
     
    818818
    819819    if (token[0] != '#')
    820         cs_log( "Warning: keyword '%s' in camd35 tcp section not recognized", token);
     820        cs_log("Warning: keyword '%s' in camd35 tcp section not recognized", token);
    821821}
    822822
     
    872872
    873873    if (token[0] != '#')
    874         cs_log( "Warning: keyword '%s' in newcamd section not recognized", token);
     874        cs_log("Warning: keyword '%s' in newcamd section not recognized", token);
    875875}
    876876
     
    919919
    920920    if (token[0] != '#')
    921         cs_log( "Warning: keyword '%s' in cccam section not recognized",token);
     921        cs_log("Warning: keyword '%s' in cccam section not recognized",token);
    922922}
    923923
     
    960960
    961961    if (token[0] != '#')
    962         cs_log( "Warning: keyword '%s' in radegast section not recognized", token);
     962        cs_log("Warning: keyword '%s' in radegast section not recognized", token);
    963963}
    964964
     
    974974    }
    975975    if (token[0] != '#')
    976         cs_log( "Warning: keyword '%s' in serial section not recognized", token);
     976        cs_log("Warning: keyword '%s' in serial section not recognized", token);
    977977}
    978978
     
    980980static void chk_t_gbox(char *token, char *value)
    981981{
    982 //  if (!strcmp(token, "password")) strncpy(cfg->gbox_pwd, i2b(4, a2i(value, 4)), 4);
    983   if (!strcmp(token, "password")) { cs_atob(cfg->gbox_pwd, value, 4); return; }
    984   if (!strcmp(token, "maxdist")) { cfg->maxdist=atoi(value); return; }
    985   if (!strcmp(token, "ignorelist")) { cs_strncpy((char *)cfg->ignorefile, value, sizeof(cfg->ignorefile)); return; }
    986   if (!strcmp(token, "onlineinfos")) { cs_strncpy((char *)cfg->gbxShareOnl, value, sizeof(cfg->gbxShareOnl)); return; }
    987   if (!strcmp(token, "cardinfos")) { cs_strncpy((char *)cfg->cardfile, value, sizeof(cfg->cardfile)); return; }
    988   if (!strcmp(token, "locals"))
    989   {
    990     char *ptr1;
    991     int n=0, i;
    992     for (i=0, ptr1=strtok(value, ","); (i<CS_MAXLOCALS) && (ptr1); ptr1=strtok(NULL, ","))
    993     {
    994       cfg->locals[n++]=a2i(ptr1, 8);
    995       //printf("%i %08X",n,cfg->locals[n-1]);
    996     }
    997     cfg->num_locals=n;
    998     return;
    999   }
    1000   if (token[0] != '#')
    1001     fprintf(stderr, "Warning: keyword '%s' in gbox section not recognized\n",token);
     982    //if (!strcmp(token, "password")) strncpy(cfg->gbox_pwd, i2b(4, a2i(value, 4)), 4);
     983    if (!strcmp(token, "password")) {
     984        cs_atob(cfg->gbox_pwd, value, 4);
     985        return;
     986    }
     987
     988    if (!strcmp(token, "maxdist")) {
     989        cfg->maxdist=atoi(value);
     990        return;
     991    }
     992
     993    if (!strcmp(token, "ignorelist")) {
     994        cs_strncpy((char *)cfg->ignorefile, value, sizeof(cfg->ignorefile));
     995        return;
     996    }
     997
     998    if (!strcmp(token, "onlineinfos")) {
     999        cs_strncpy((char *)cfg->gbxShareOnl, value, sizeof(cfg->gbxShareOnl));
     1000        return;
     1001    }
     1002
     1003    if (!strcmp(token, "cardinfos")) {
     1004        cs_strncpy((char *)cfg->cardfile, value, sizeof(cfg->cardfile));
     1005        return;
     1006    }
     1007
     1008    if (!strcmp(token, "locals"))
     1009    {
     1010        char *ptr1;
     1011        int n = 0, i;
     1012        for (i = 0, ptr1 = strtok(value, ","); (i < CS_MAXLOCALS) && (ptr1); ptr1 = strtok(NULL, ",")) {
     1013            cfg->locals[n++] = a2i(ptr1, 8);
     1014            //printf("%i %08X",n,cfg->locals[n-1]);
     1015        }
     1016        cfg->num_locals = n;
     1017        return;
     1018    }
     1019
     1020    if (token[0] != '#')
     1021        cs_log("Warning: keyword '%s' in gbox section not recognized",token);
    10021022}
    10031023#endif
     
    10061026void chk_t_dvbapi(char *token, char *value)
    10071027{
    1008     if (!strcmp(token, "enabled"))  { cfg->dvbapi_enabled=atoi(value); return; }
    1009     if (!strcmp(token, "au"))   { cfg->dvbapi_au=atoi(value); return; }
    1010     if (!strcmp(token, "boxtype"))  { cs_strncpy(cfg->dvbapi_boxtype, value, sizeof(cfg->dvbapi_boxtype)); return; }
    1011     if (!strcmp(token, "user"))     { cs_strncpy(cfg->dvbapi_usr, value, sizeof(cfg->dvbapi_usr)); return; }
    1012     if (!strcmp(token, "priority")) { cs_strncpy(cfg->dvbapi_priority, value, sizeof(cfg->dvbapi_priority)); return; }
    1013     if (!strcmp(token, "ignore"))   { cs_strncpy(cfg->dvbapi_ignore, value, sizeof(cfg->dvbapi_ignore)); return; }
     1028    if (!strcmp(token, "enabled")) {
     1029        cfg->dvbapi_enabled = atoi(value);
     1030        return;
     1031    }
     1032
     1033    if (!strcmp(token, "au")) {
     1034        cfg->dvbapi_au = atoi(value);
     1035        return;
     1036    }
     1037
     1038    if (!strcmp(token, "boxtype")) {
     1039        cs_strncpy(cfg->dvbapi_boxtype, value, sizeof(cfg->dvbapi_boxtype));
     1040        return;
     1041    }
     1042
     1043    if (!strcmp(token, "user")) {
     1044        cs_strncpy(cfg->dvbapi_usr, value, sizeof(cfg->dvbapi_usr));
     1045        return;
     1046    }
     1047
     1048    if (!strcmp(token, "priority")) {
     1049        cs_strncpy(cfg->dvbapi_priority, value, sizeof(cfg->dvbapi_priority));
     1050        return;
     1051    }
     1052
     1053    if (!strcmp(token, "ignore")) {
     1054        cs_strncpy(cfg->dvbapi_ignore, value, sizeof(cfg->dvbapi_ignore));
     1055        return;
     1056    }
    10141057
    10151058    if (token[0] != '#')
    1016         fprintf(stderr, "Warning: keyword '%s' in dvbapi section not recognized\n",token);
     1059        cs_log("Warning: keyword '%s' in dvbapi section not recognized\n",token);
    10171060}
    10181061#endif
     
    10301073        case TAG_SERIAL  : chk_t_serial(token, value); break;
    10311074        case TAG_CS378X  : chk_t_camd35_tcp(token, value); break;
     1075        case TAG_CCCAM   : chk_t_cccam(token, value); break;
    10321076
    10331077#ifdef CS_WITH_GBOX
    10341078        case TAG_GBOX    : chk_t_gbox(token, value); break;
    10351079#else
    1036         case TAG_GBOX    : fprintf(stderr, "Warning: OSCam compiled without gbox support.\n"); break;
    1037 #endif
    1038 
    1039         case TAG_CCCAM   : chk_t_cccam(token, value); break;
     1080        case TAG_GBOX    : cs_log("Warning: OSCam compiled without gbox support."); break;
     1081#endif
     1082
     1083
    10401084#ifdef HAVE_DVBAPI
    10411085        case TAG_DVBAPI  : chk_t_dvbapi(token, value); break;
    10421086#else
    1043         case TAG_DVBAPI  : fprintf(stderr, "Warning: OSCam compiled without DVB API support.\n"); break;
     1087        case TAG_DVBAPI  : cs_log("Warning: OSCam compiled without DVB API support."); break;
    10441088#endif
    10451089
    10461090
    10471091#ifdef WEBIF
    1048         case TAG_WEBIF  : chk_t_webif(token, value); break;
     1092        case TAG_WEBIF   : chk_t_webif(token, value); break;
    10491093#else
    1050         case TAG_WEBIF  : fprintf(stderr, "Warning: OSCam compiled without Webinterface support.\n"); break;
     1094        case TAG_WEBIF   : cs_log("Warning: OSCam compiled without Webinterface support."); break;
    10511095#endif
    10521096
     
    10551099        case TAG_ANTICASC: chk_t_ac(token, value); break;
    10561100#else
    1057         case TAG_ANTICASC: fprintf(stderr, "Warning: OSCam compiled without anticascading support.\n"); break;
     1101        case TAG_ANTICASC: cs_log("Warning: OSCam compiled without anticascading support."); break;
    10581102#endif
    10591103
     
    14071451
    14081452    if (token[0] != '#')
    1409         cs_log( "Warning: keyword '%s' in account section not recognized",token);
     1453        cs_log("Warning: keyword '%s' in account section not recognized",token);
    14101454}
    14111455
     
    19371981  if (!strcmp(token, "srvid")) { chk_entry4sidtab(value, sidtab, 2); return; }
    19381982  if (token[0] != '#')
    1939     fprintf(stderr, "Warning: keyword '%s' in sidtab section not recognized\n",token);
     1983    cs_log("Warning: keyword '%s' in sidtab section not recognized",token);
    19401984}
    19411985
     
    24132457        }
    24142458
    2415         cs_log( "WARNING: value '%s' in protocol-line not recognized, assuming MOUSE",value);
     2459        cs_log("WARNING: value '%s' in protocol-line not recognized, assuming MOUSE",value);
    24162460        rdr->typ = R_MOUSE;
    24172461        return;
Note: See TracChangeset for help on using the changeset viewer.