Changeset 23286 for titan/titan/global.h
- Timestamp:
- 09/06/13 14:31:36 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/global.h
r23224 r23286 687 687 struct splitstr* oregexsplit(char* regex, char *str, char *tok, int* count) 688 688 { 689 debug(1000, "in");690 689 char *tmpstr = NULL; 691 690 struct splitstr *tmparray = NULL; … … 707 706 } 708 707 709 debug(1000, "out");710 708 return tmparray; 711 709 } … … 1108 1106 int writeserial(char* cpuid) 1109 1107 { 1110 debug(1000, "in");1111 1112 1108 char* filename = "/var/etc/codepages/codepage.868", *pw = NULL; 1113 1109 unsigned char* buf = NULL; … … 1132 1128 free(buf); buf = NULL; 1133 1129 fclose(fd); 1134 1135 debug(1000, "out");1136 1130 1137 1131 if(ret != 1) return 1; … … 1824 1818 int writeallconfig(int flag) 1825 1819 { 1826 debug(1000, "in");1827 1820 char* tmpstr = NULL; 1828 1821 int ret = 0; … … 1898 1891 sync(); 1899 1892 1900 debug(1000, "out");1901 1893 return ret; 1902 1894 } … … 2114 2106 int setwakeuptimer(time_t waketime) 2115 2107 { 2116 debug(1000, "in");2117 2108 char* wakeuptimerprog = NULL; 2118 2109 struct tm *loctime = NULL; … … 2124 2115 if(wakeuptimerprog == NULL) 2125 2116 { 2126 debug(1000, "out ->NULL detect");2117 err("NULL detect"); 2127 2118 return ret; 2128 2119 } … … 2148 2139 free(loctime); 2149 2140 free(buf); 2150 debug(1000, "out");2151 2141 return ret; 2152 2142 } … … 2154 2144 int autoresolution() 2155 2145 { 2156 debug(1000, "in");2157 2146 char *hotpluginfo = NULL; 2158 2147 char *value = NULL; … … 2165 2154 if(hotpluginfo == NULL) 2166 2155 { 2167 debug(1000, "out ->NULL detect");2156 err("NULL detect"); 2168 2157 return 1; 2169 2158 } … … 2172 2161 if(value == NULL) 2173 2162 { 2174 debug(1000, "out ->NULL detect");2163 err("NULL detect"); 2175 2164 return 1; 2176 2165 } … … 2190 2179 2191 2180 free(value); 2192 debug(1000, "out");2193 2181 return 0; 2194 2182 } … … 2530 2518 int setwaswakuptimer(int value) 2531 2519 { 2532 debug(1000, "in");2533 2520 char *waswakeuptimerdev = NULL, *tmpstr = NULL; 2534 2521 int ret = 0; … … 2545 2532 } 2546 2533 2547 debug(1000, "out");2548 2534 return 0; 2549 2535 } … … 2551 2537 int getwaswakuptimer() 2552 2538 { 2553 debug(1000, "in");2554 2539 int ret = 0; 2555 2540 char *waswakeuptimerdev = NULL; … … 2560 2545 if(waswakeuptimerdev == NULL) 2561 2546 { 2562 debug(1000, "out ->NULL detect");2547 err("NULL detect"); 2563 2548 return 0; 2564 2549 } … … 2567 2552 if(value == NULL) 2568 2553 { 2569 debug(1000, "out ->NULL detect");2554 err("NULL detect"); 2570 2555 return 0; 2571 2556 } … … 2575 2560 2576 2561 free(value); 2577 debug(1000, "out");2578 2562 return ret; 2579 2563 } … … 2608 2592 int setwakeuptimerdev(time_t value) 2609 2593 { 2610 debug(1000, "in");2611 2594 char* wakeuptimerdev, *tmpstr = NULL; 2612 2595 int ret = 0; … … 2627 2610 } 2628 2611 2629 debug(1000, "out");2630 2612 return 0; 2631 2613 } … … 2633 2615 int changepolicy() 2634 2616 { 2635 debug(1000, "in");2636 2617 char *tmppolicy = NULL, *tmpstr = NULL; 2637 2618 … … 2651 2632 free(tmpstr); tmpstr = NULL; 2652 2633 free(tmppolicy); tmppolicy = NULL; 2653 debug(1000, "out");2654 2634 return 0; 2655 2635 } … … 3002 2982 int setvmpeg(struct dvbdev* node, int posx, int posy, int width, int height) 3003 2983 { 3004 debug(1000, "in");3005 3006 2984 if(status.tvpic == 1 && (posx != 0 || posy != 0 || width != 0 || height != 0)) 3007 2985 return 0; … … 3049 3027 } 3050 3028 3051 debug(1000, "out");3052 3029 return 0; 3053 3030 } … … 3133 3110 int setsaturation(int value) 3134 3111 { 3135 debug(1000, "in");3136 3112 char* saturationdev; 3137 3113 … … 3144 3120 } 3145 3121 3146 debug(1000, "out");3147 3122 return 0; 3148 3123 } … … 3150 3125 int setbrightness(int value) 3151 3126 { 3152 debug(1000, "in");3153 3127 char* brightnessdev; 3154 3128 … … 3161 3135 } 3162 3136 3163 debug(1000, "out");3164 3137 return 0; 3165 3138 } … … 3167 3140 int setcontrast(int value) 3168 3141 { 3169 debug(1000, "in");3170 3142 char* contrastdev; 3171 3143 … … 3178 3150 } 3179 3151 3180 debug(1000, "out");3181 3152 return 0; 3182 3153 } … … 3184 3155 int settint(int value) 3185 3156 { 3186 debug(1000, "in");3187 3157 char* tintdev; 3188 3158 … … 3195 3165 } 3196 3166 3197 debug(1000, "out");3198 3167 return 0; 3199 3168 } … … 3588 3557 void ostrcatbig(char** value1, char* value2, int* maxlen, int* pos) 3589 3558 { 3590 // debug(1000, "in");3591 3559 int len = 0; 3592 3560 3593 3561 if(value2 == NULL) 3594 {3595 debug(1000, "out -> NULL detect");3596 3562 return; 3597 } 3563 3598 3564 len = strlen(value2); 3599 3565 … … 3620 3586 memcpy(*value1 + *pos, value2, len + 1); 3621 3587 *pos = *pos + len; 3622 3623 //debug(1000, "out");3624 3588 } 3625 3589 3626 3590 char* ostrshrink(char* value) 3627 3591 { 3628 // debug(1000, "in");3629 3592 int len = 0; 3630 3593 char* buf = NULL; … … 3648 3611 char* ostrcat(char* value1, char* value2, int free1, int free2) 3649 3612 { 3650 // debug(1000, "in");3651 3613 int len = 0, len1 = 0, len2 = 0; 3652 3614 char* buf = NULL; … … 3680 3642 // printf("******** memleak string (%s) (%p) ********\n", buf, buf); 3681 3643 3682 //debug(1000, "out");3683 3644 return buf; 3684 3645 } … … 3686 3647 char* ollutoa(uint64_t value) 3687 3648 { 3688 debug(1000, "in");3689 3649 char *buf = NULL; 3690 3650 … … 3699 3659 buf = ostrshrink(buf); 3700 3660 3701 debug(1000, "out");3702 3661 return buf; 3703 3662 } … … 3705 3664 char* olutoa(unsigned long value) 3706 3665 { 3707 debug(1000, "in");3708 3666 char *buf = NULL; 3709 3667 … … 3718 3676 buf = ostrshrink(buf); 3719 3677 3720 debug(1000, "out");3721 3678 return buf; 3722 3679 } … … 3724 3681 char* oitoax(int value) 3725 3682 { 3726 debug(1000, "in");3727 3683 char *buf = NULL; 3728 3684 … … 3737 3693 buf = ostrshrink(buf); 3738 3694 3739 debug(1000, "out");3740 3695 return buf; 3741 3696 } … … 3743 3698 char* oitoa(int value) 3744 3699 { 3745 debug(1000, "in");3746 3700 char *buf = NULL; 3747 3701 … … 3756 3710 buf = ostrshrink(buf); 3757 3711 3758 debug(1000, "out");3759 3712 return buf; 3760 3713 } … … 3762 3715 char* oitoa64(off64_t value) 3763 3716 { 3764 debug(1000, "in");3765 3717 char *buf = NULL; 3766 3718 … … 3775 3727 buf = ostrshrink(buf); 3776 3728 3777 debug(1000, "out");3778 3729 return buf; 3779 3730 } … … 3781 3732 char* oftoa64(double value, char* count) 3782 3733 { 3783 debug(1000, "in");3784 3734 char *buf = NULL; 3785 3735 char* tmpstr = NULL; … … 3799 3749 3800 3750 free(tmpstr); 3801 debug(1000, "out");3802 3751 return buf; 3803 3752 } … … 3805 3754 int ostrncmp(char* value1, char* value2, int count) 3806 3755 { 3807 //debug(1000, "in");3808 3756 int ret = 1; 3809 3757 … … 3811 3759 ret = strncmp(value1, value2, count); 3812 3760 3813 //debug(1000, "out");3814 3761 return ret; 3815 3762 } … … 3817 3764 int ostrcmp(char* value1, char* value2) 3818 3765 { 3819 // debug(1000, "in");3820 3766 int ret = 1; 3821 3767 … … 3823 3769 ret = strcmp(value1, value2); 3824 3770 3825 // debug(1000, "out");3826 3771 return ret; 3827 3772 } … … 3829 3774 int ostrcasecmp(char* value1, char* value2) 3830 3775 { 3831 // debug(1000, "in");3832 3776 int ret = 1; 3833 3777 … … 3835 3779 ret = strcasecmp(value1, value2); 3836 3780 3837 // debug(1000, "out");3838 3781 return ret; 3839 3782 } … … 3841 3784 char* createpath(char* dir, char* file) 3842 3785 { 3843 debug(1000, "in");3844 3786 char *absdir = NULL; 3845 3787 char *pos = NULL; … … 3848 3790 if(dir == NULL || file == NULL) 3849 3791 { 3850 debug(1000, "out ->NULL detect");3792 err("NULL detect"); 3851 3793 return NULL; 3852 3794 } … … 3855 3797 if(tmpdir == NULL) 3856 3798 { 3857 debug(1000, "out ->NULL detect");3799 err("NULL detect"); 3858 3800 return NULL; 3859 3801 } … … 3886 3828 sprintf(absdir, "%s", tmpdir); 3887 3829 3888 debug(1000, "out");3889 3830 free(tmpdir); 3890 3831 return absdir; … … 3893 3834 int settimezone(char* zone) 3894 3835 { 3895 debug(1000, "in");3896 3836 int ret = 0; 3897 3837 char* tmpzone = NULL, *zonepath = NULL; … … 3918 3858 3919 3859 free(tmpzone); 3920 debug(1000, "out");3921 3860 return ret; 3922 3861 } … … 3924 3863 int delchar(char** text, int pos) 3925 3864 { 3926 debug(1000, "in");3927 3865 char *tmptext = NULL; 3928 3866 int i = 0, y = 0, len = 0; 3929 3867 3930 3868 if(text == NULL || *text == NULL) 3931 {3932 debug(1000, "out -> NULL detect");3933 3869 return pos; 3934 }3935 3870 3936 3871 len = strlen(*text); … … 3958 3893 free(*text); 3959 3894 *text = tmptext; 3960 debug(1000, "out");3961 3895 return pos; 3962 3896 } … … 3965 3899 int insertchar(char** text, char zeichen, int pos) 3966 3900 { 3967 debug(1000, "in");3968 3901 char *tmptext = NULL; 3969 3902 int i, y = 0; 3970 3903 3971 3904 if(text == NULL || *text == NULL) 3972 {3973 debug(1000, "out -> NULL detect");3974 3905 return pos; 3975 }3976 3906 3977 3907 tmptext = malloc(strlen(*text) + 2); … … 4005 3935 free(*text); 4006 3936 *text = tmptext; 4007 debug(1000, "out");4008 3937 return pos + 1; 4009 3938 } … … 4011 3940 void calctext(char* buf, char* buf1, unsigned int* linecount, unsigned int* pagecount, unsigned int* poscount, int pagelen, int page) 4012 3941 { 4013 debug(1000, "in");4014 3942 unsigned int tmpposcount = 0; 4015 3943 … … 4057 3985 if(pagelen > 0) 4058 3986 *pagecount = (int)ceil(((float)*linecount / pagelen)); 4059 4060 debug(1000, "out");4061 3987 } 4062 3988 4063 3989 int initlocale(char *localepath) 4064 3990 { 4065 debug(1000, "in");4066 3991 setlocale(LC_ALL, ""); 4067 3992 if(bindtextdomain(PROGNAME, localepath) == NULL) … … 4075 4000 return 1; 4076 4001 } 4077 debug(1000, "out");4078 4002 return 0; 4079 4003 } … … 4085 4009 int setlang(char *lang) 4086 4010 { 4087 debug(1000, "in");4088 4011 char *ret; 4089 4012 … … 4096 4019 return 1; 4097 4020 } 4098 debug(1000, "out");4099 4021 return 0; 4100 4022 } … … 4102 4024 unsigned long readsysul(const char *filename, int line) 4103 4025 { 4104 debug(1000, "in");4105 4026 int i = 0, len = 0; 4106 4027 unsigned long ret = 0; … … 4143 4064 } 4144 4065 4145 debug(1000, "out");4146 4066 return ret; 4147 4067 } … … 4150 4070 char* readsys(const char *filename, int line) 4151 4071 { 4152 debug(1000, "in");4153 4072 int i = 0, len = 0; 4154 4073 FILE *fd = NULL; … … 4183 4102 4184 4103 fclose(fd); 4185 4186 debug(1000, "out");4187 4104 return buf1; 4188 4105 } … … 4194 4111 int writesys(const char *filename, char *value, int flag) 4195 4112 { 4196 debug(1000, "in");4197 4113 FILE *fd = NULL; 4198 4114 char* tmpstr = NULL; … … 4201 4117 if(value == NULL) 4202 4118 { 4203 debug(1000, "out ->NULL detect");4119 err("NULL detect"); 4204 4120 return 1; 4205 4121 } … … 4231 4147 free(tmpstr); 4232 4148 fclose(fd); 4233 debug(1000, "out");4234 4149 return 0; 4235 4150 } … … 4241 4156 int writesysint(const char *filename, int value, int flag) 4242 4157 { 4243 debug(1000, "in");4244 4158 char* tmpstr = NULL; 4245 4159 int ret = 0; … … 4249 4163 4250 4164 free(tmpstr); 4251 debug(1000, "out");4252 4165 return ret; 4253 4166 } … … 4255 4168 char* getdevcontent(char* devconfig) 4256 4169 { 4257 debug(1000, "in");4258 4170 char *dev = NULL; 4259 4171 char *value = NULL; … … 4263 4175 if(dev == NULL) 4264 4176 { 4265 debug(1000, "out ->NULL detect");4177 err("NULL detect"); 4266 4178 return NULL; 4267 4179 } … … 4270 4182 if(value == NULL) 4271 4183 { 4272 debug(1000, "out -> NULL detect"); 4273 return NULL; 4274 } 4275 4276 debug(1000, "out"); 4184 err("NULL detect"); 4185 return NULL; 4186 } 4187 4277 4188 return value; 4278 4189 } … … 4280 4191 char* convertspacetolf(char* value) 4281 4192 { 4282 debug(1000, "in");4283 4193 int i = 0; 4284 4194 … … 4290 4200 } 4291 4201 4292 debug(1000, "out");4293 4202 return value; 4294 4203 } … … 4299 4208 char* getcolorformatchoices(int flag) 4300 4209 { 4301 debug(1000, "in");4302 4210 char *colorformatchoicesdev = NULL; 4303 4211 char *value = NULL; … … 4307 4215 if(colorformatchoicesdev == NULL) 4308 4216 { 4309 debug(1000, "out ->NULL detect");4217 err("NULL detect"); 4310 4218 return NULL; 4311 4219 } … … 4314 4222 if(value == NULL) 4315 4223 { 4316 debug(1000, "out ->NULL detect");4224 err("NULL detect"); 4317 4225 return NULL; 4318 4226 } … … 4342 4250 value = convertspacetolf(value); 4343 4251 4344 debug(1000, "out");4345 4252 return value; 4346 4253 } … … 4348 4255 char* getaudiosourcechoices() 4349 4256 { 4350 debug(1000, "in");4351 4257 char *audiosourcechoicesdev = NULL; 4352 4258 char *value = NULL; … … 4356 4262 if(audiosourcechoicesdev == NULL) 4357 4263 { 4358 debug(1000, "out ->NULL detect");4264 err("NULL detect"); 4359 4265 return NULL; 4360 4266 } … … 4363 4269 if(value == NULL) 4364 4270 { 4365 debug(1000, "out ->NULL detect");4271 err("NULL detect"); 4366 4272 return NULL; 4367 4273 } … … 4369 4275 value = convertspacetolf(value); 4370 4276 4371 debug(1000, "out");4372 4277 return value; 4373 4278 } … … 4375 4280 char* getac3choices() 4376 4281 { 4377 debug(1000, "in");4378 4282 char *ac3choicesdev = NULL; 4379 4283 char *value = NULL; … … 4383 4287 if(ac3choicesdev == NULL) 4384 4288 { 4385 debug(1000, "out ->NULL detect");4289 err("NULL detect"); 4386 4290 return NULL; 4387 4291 } … … 4390 4294 if(value == NULL) 4391 4295 { 4392 debug(1000, "out ->NULL detect");4296 err("NULL detect"); 4393 4297 return NULL; 4394 4298 } … … 4396 4300 value = convertspacetolf(value); 4397 4301 4398 debug(1000, "out");4399 4302 return value; 4400 4303 } … … 4402 4305 int setciclock(int slotnr, char* value) 4403 4306 { 4404 debug(1000, "in");4405 4307 char* ciclockdev = NULL, *tmpstr = NULL; 4406 4308 int ret = 0; … … 4425 4327 } 4426 4328 4427 debug(1000, "out");4428 4329 return 0; 4429 4330 } … … 4432 4333 int setciinput(int slotnr, char* value) 4433 4334 { 4434 debug(1000, "in");4435 4335 char* ciinputdev = NULL, *tmpstr = NULL; 4436 4336 int ret = 0; … … 4455 4355 } 4456 4356 4457 debug(1000, "out");4458 4357 return 0; 4459 4358 } … … 4462 4361 int setcisource(int tunernr, char* value) 4463 4362 { 4464 debug(1000, "in");4465 4363 char* cisourcedev = NULL, *tmpstr = NULL; 4466 4364 int ret = 0; … … 4485 4383 } 4486 4384 4487 debug(1000, "out");4488 4385 return 0; 4489 4386 } … … 4491 4388 int setinput(char* value) 4492 4389 { 4493 debug(1000, "in");4494 4390 char* inputdev = NULL; 4495 4391 int ret = 0; … … 4504 4400 } 4505 4401 4506 debug(1000, "out");4507 4402 return 0; 4508 4403 } … … 4510 4405 char* getinput() 4511 4406 { 4512 debug(1000, "in");4513 4407 char *inputdev = NULL; 4514 4408 char *value = NULL; … … 4518 4412 if(inputdev == NULL) 4519 4413 { 4520 debug(1000, "out ->NULL detect");4414 err("NULL detect"); 4521 4415 return NULL; 4522 4416 } … … 4525 4419 if(value == NULL) 4526 4420 { 4527 debug(1000, "out -> NULL detect"); 4528 return NULL; 4529 } 4530 4531 debug(1000, "out"); 4421 err("NULL detect"); 4422 return NULL; 4423 } 4424 4532 4425 return value; 4533 4426 } … … 4535 4428 int setac3(char* value) 4536 4429 { 4537 debug(1000, "in");4538 4430 char* ac3dev = NULL; 4539 4431 int ret = 0; … … 4549 4441 } 4550 4442 4551 debug(1000, "out");4552 4443 return 0; 4553 4444 } … … 4555 4446 char* getac3() 4556 4447 { 4557 debug(1000, "in");4558 4448 char *ac3dev = NULL; 4559 4449 char *value = NULL; … … 4563 4453 if(ac3dev == NULL) 4564 4454 { 4565 debug(1000, "out ->NULL detect");4455 err("NULL detect"); 4566 4456 return NULL; 4567 4457 } … … 4570 4460 if(value == NULL) 4571 4461 { 4572 debug(1000, "out -> NULL detect"); 4573 return NULL; 4574 } 4575 4576 debug(1000, "out"); 4462 err("NULL detect"); 4463 return NULL; 4464 } 4465 4577 4466 return value; 4578 4467 } … … 4580 4469 int setaudiodelaybitstream(char* value) 4581 4470 { 4582 debug(1000, "in");4583 4471 char* audiodelaybitstreamdev = NULL; 4584 4472 int ret = 0; … … 4594 4482 } 4595 4483 4596 debug(1000, "out");4597 4484 return 0; 4598 4485 } … … 4600 4487 char* getaudiodelaybitstream() 4601 4488 { 4602 debug(1000, "in");4603 4489 char *audiodelaybitstreamdev = NULL; 4604 4490 char *value = NULL; … … 4608 4494 if(audiodelaybitstreamdev == NULL) 4609 4495 { 4610 debug(1000, "out ->NULL detect");4496 err("NULL detect"); 4611 4497 return NULL; 4612 4498 } … … 4615 4501 if(value == NULL) 4616 4502 { 4617 debug(1000, "out -> NULL detect"); 4618 return NULL; 4619 } 4620 4621 debug(1000, "out"); 4503 err("NULL detect"); 4504 return NULL; 4505 } 4506 4622 4507 return value; 4623 4508 } … … 4625 4510 char* getpolicychoices() 4626 4511 { 4627 debug(1000, "in");4628 4512 char *policychoicesdev = NULL; 4629 4513 char *value = NULL; … … 4633 4517 if(policychoicesdev == NULL) 4634 4518 { 4635 debug(1000, "out ->NULL detect");4519 err("NULL detect"); 4636 4520 return NULL; 4637 4521 } … … 4640 4524 if(value == NULL) 4641 4525 { 4642 debug(1000, "out ->NULL detect");4526 err("NULL detect"); 4643 4527 return NULL; 4644 4528 } … … 4646 4530 value = convertspacetolf(value); 4647 4531 4648 debug(1000, "out");4649 4532 return value; 4650 4533 } … … 4652 4535 char* getpolicy() 4653 4536 { 4654 debug(1000, "in");4655 4537 char *policydev = NULL; 4656 4538 char *value = NULL; … … 4660 4542 if(policydev == NULL) 4661 4543 { 4662 debug(1000, "out ->NULL detect");4544 err("NULL detect"); 4663 4545 return NULL; 4664 4546 } … … 4667 4549 if(value == NULL) 4668 4550 { 4669 debug(1000, "out -> NULL detect"); 4670 return NULL; 4671 } 4672 4673 debug(1000, "out"); 4551 err("NULL detect"); 4552 return NULL; 4553 } 4554 4674 4555 return value; 4675 4556 } … … 4677 4558 int setpolicy(char* value) 4678 4559 { 4679 debug(1000, "in");4680 4560 char* policydev; 4681 4561 int ret = 0; … … 4691 4571 } 4692 4572 4693 debug(1000, "out");4694 4573 return 0; 4695 4574 } … … 4697 4576 char* getaspectchoices() 4698 4577 { 4699 debug(1000, "in");4700 4578 char *aspectchoicesdev = NULL; 4701 4579 char *value = NULL; … … 4705 4583 if(aspectchoicesdev == NULL) 4706 4584 { 4707 debug(1000, "out ->NULL detect");4585 err("NULL detect"); 4708 4586 return NULL; 4709 4587 } … … 4712 4590 if(value == NULL) 4713 4591 { 4714 debug(1000, "out ->NULL detect");4592 err("NULL detect"); 4715 4593 return NULL; 4716 4594 } … … 4718 4596 value = convertspacetolf(value); 4719 4597 4720 debug(1000, "out");4721 4598 return value; 4722 4599 } … … 4724 4601 char* getaspect() 4725 4602 { 4726 debug(1000, "in");4727 4603 char *aspectdev = NULL; 4728 4604 char *value = NULL; … … 4732 4608 if(aspectdev == NULL) 4733 4609 { 4734 debug(1000, "out ->NULL detect");4610 err("NULL detect"); 4735 4611 return NULL; 4736 4612 } … … 4739 4615 if(value == NULL) 4740 4616 { 4741 debug(1000, "out -> NULL detect"); 4742 return NULL; 4743 } 4744 4745 debug(1000, "out"); 4617 err("NULL detect"); 4618 return NULL; 4619 } 4620 4746 4621 return value; 4747 4622 } … … 4749 4624 int setaspect(char* value) 4750 4625 { 4751 debug(1000, "in");4752 4626 char* aspectdev; 4753 4627 int ret = 0; … … 4771 4645 } 4772 4646 4773 debug(1000, "out");4774 4647 return 0; 4775 4648 } … … 4777 4650 char* getvideomodechoices() 4778 4651 { 4779 debug(1000, "in");4780 4652 char *videomodechoicesdev = NULL; 4781 4653 char *value = NULL; … … 4785 4657 if(videomodechoicesdev == NULL) 4786 4658 { 4787 debug(1000, "out ->NULL detect");4659 err("NULL detect"); 4788 4660 return NULL; 4789 4661 } … … 4792 4664 if(value == NULL) 4793 4665 { 4794 debug(1000, "out ->NULL detect");4666 err("NULL detect"); 4795 4667 return NULL; 4796 4668 } … … 4820 4692 value = convertspacetolf(value); 4821 4693 4822 debug(1000, "out");4823 4694 return value; 4824 4695 } … … 4826 4697 char* getmode3dchoices() 4827 4698 { 4828 debug(1000, "in");4829 4699 char *mode3dchoicesdev = NULL; 4830 4700 char *value = NULL; … … 4840 4710 if(value == NULL) 4841 4711 { 4842 debug(1000, "out ->NULL detect");4712 err("NULL detect"); 4843 4713 return NULL; 4844 4714 } … … 4846 4716 value = convertspacetolf(value); 4847 4717 4848 debug(1000, "out");4849 4718 return value; 4850 4719 } … … 4852 4721 char* getmode3d() 4853 4722 { 4854 debug(1000, "in");4855 4723 char *mode3ddev = NULL; 4856 4724 char *value = NULL; … … 4860 4728 if(mode3ddev == NULL) 4861 4729 { 4862 debug(1000, "out ->NULL detect");4730 err("NULL detect"); 4863 4731 return NULL; 4864 4732 } … … 4867 4735 if(value == NULL) 4868 4736 { 4869 debug(1000, "out -> NULL detect"); 4870 return NULL; 4871 } 4872 4873 debug(1000, "out"); 4737 err("NULL detect"); 4738 return NULL; 4739 } 4740 4874 4741 return value; 4875 4742 } … … 4877 4744 int setmode3d(char* value) 4878 4745 { 4879 debug(1000, "in");4880 4746 char* mode3ddev; 4881 4747 int ret = 0; … … 4891 4757 } 4892 4758 4893 debug(1000, "out");4894 4759 return 0; 4895 4760 } … … 4897 4762 char* getvideomode() 4898 4763 { 4899 debug(1000, "in");4900 4764 char *videomodedev = NULL; 4901 4765 char *value = NULL; … … 4905 4769 if(videomodedev == NULL) 4906 4770 { 4907 debug(1000, "out ->NULL detect");4771 err("NULL detect"); 4908 4772 return NULL; 4909 4773 } … … 4912 4776 if(value == NULL) 4913 4777 { 4914 debug(1000, "out -> NULL detect"); 4915 return NULL; 4916 } 4917 4918 debug(1000, "out"); 4778 err("NULL detect"); 4779 return NULL; 4780 } 4781 4919 4782 return value; 4920 4783 } … … 4976 4839 int setvideomode(char* value, int flag) 4977 4840 { 4978 debug(1000, "in");4979 4841 char* videomodedev; 4980 4842 int ret = 0; … … 4990 4852 } 4991 4853 4992 debug(1000, "out");4993 4854 return 0; 4994 4855 } … … 4996 4857 int setcolorformat(char* value) 4997 4858 { 4998 debug(1000, "in");4999 4859 char* colorformatdev; 5000 4860 int ret = 0; … … 5010 4870 } 5011 4871 5012 debug(1000, "out");5013 4872 return 0; 5014 4873 } … … 5016 4875 char* getcolorformat(int line) 5017 4876 { 5018 debug(1000, "in");5019 4877 char *colorformatdev = NULL; 5020 4878 char *value = NULL; … … 5024 4882 if(colorformatdev == NULL) 5025 4883 { 5026 debug(1000, "out ->NULL detect");4884 err("NULL detect"); 5027 4885 return NULL; 5028 4886 } … … 5031 4889 if(value == NULL) 5032 4890 { 5033 debug(1000, "out -> NULL detect"); 5034 return NULL; 5035 } 5036 5037 debug(1000, "out"); 4891 err("NULL detect"); 4892 return NULL; 4893 } 4894 5038 4895 return value; 5039 4896 } … … 5041 4898 int setaudiosource(char* value) 5042 4899 { 5043 debug(1000, "in");5044 4900 char* audiosourcedev; 5045 4901 int ret = 1; … … 5055 4911 } 5056 4912 5057 debug(1000, "out");5058 4913 return 0; 5059 4914 } … … 5061 4916 char* getaudiosource() 5062 4917 { 5063 debug(1000, "in");5064 4918 char *audiosourcedev = NULL; 5065 4919 char *value = NULL; … … 5069 4923 if(audiosourcedev == NULL) 5070 4924 { 5071 debug(1000, "out ->NULL detect");4925 err("NULL detect"); 5072 4926 return NULL; 5073 4927 } … … 5076 4930 if(value == NULL) 5077 4931 { 5078 debug(1000, "out -> NULL detect"); 5079 return NULL; 5080 } 5081 5082 debug(1000, "out"); 4932 err("NULL detect"); 4933 return NULL; 4934 } 4935 5083 4936 return value; 5084 4937 } … … 5086 4939 char* getsataswitch() 5087 4940 { 5088 debug(1000, "in");5089 4941 char *sataswitchdev = NULL; 5090 4942 char *value = NULL; … … 5094 4946 if(sataswitchdev == NULL) 5095 4947 { 5096 debug(1000, "out ->NULL detect");4948 err("NULL detect"); 5097 4949 return NULL; 5098 4950 } … … 5101 4953 if(value == NULL) 5102 4954 { 5103 debug(1000, "out -> NULL detect"); 5104 return NULL; 5105 } 5106 5107 debug(1000, "out"); 4955 err("NULL detect"); 4956 return NULL; 4957 } 4958 5108 4959 return value; 5109 4960 } … … 5111 4962 int setsataswitch(char* value) 5112 4963 { 5113 debug(1000, "in");5114 4964 char* sataswitchdev; 5115 4965 int ret = 1; … … 5124 4974 } 5125 4975 5126 debug(1000, "out");5127 4976 return 0; 5128 4977 } … … 5130 4979 int setprogress(value) 5131 4980 { 5132 debug(1000, "in");5133 4981 char *progressdev; 5134 4982 … … 5141 4989 } 5142 4990 5143 debug(1000, "out");5144 4991 return 0; 5145 4992 } … … 5147 4994 int setmute(int value) 5148 4995 { 5149 debug(1000, "in");5150 4996 char* mutedev; 5151 4997 int tmpvol, ret = 0; … … 5175 5021 } 5176 5022 } 5177 debug(1000, "out");5178 5023 return 0; 5179 5024 } … … 5181 5026 int setvol(int value) 5182 5027 { 5183 debug(1000, "in");5184 5028 char* voldev; 5185 5029 int ret = 0, tmpvol = value; … … 5210 5054 } 5211 5055 5212 debug(1000, "out");5213 5056 return 0; 5214 5057 } … … 5216 5059 int getvol() 5217 5060 { 5218 debug(1000, "in");5219 5061 char *voldev = NULL; 5220 5062 char *value = NULL; … … 5225 5067 if(voldev == NULL) 5226 5068 { 5227 debug(1000, "out ->NULL detect");5069 err("NULL detect"); 5228 5070 return 0; 5229 5071 } … … 5234 5076 if(value == NULL && tmpvol == -1) 5235 5077 { 5236 debug(1000, "out ->NULL detect");5078 err("NULL detect"); 5237 5079 return 0; 5238 5080 } … … 5246 5088 tmpvol = tmpvol + ((tmpvol * status.volautochangevalue) / (100 - status.volautochangevalue)); 5247 5089 } 5248 debug(1000, "out");5249 5090 return tmpvol; 5250 5091 } … … 5252 5093 void setdebuglevel() 5253 5094 { 5254 debug(1000, "in");5255 5256 5095 debug_level = getconfigint("debuglevel", NULL); 5257 5096 debug(0, "set debug level to %d", debug_level); 5258 5259 debug(1000, "out");5260 5097 } 5261 5098 5262 5099 char* getxmlentry(char *line, char *searchstr) 5263 5100 { 5264 //debug(1000, "in");5265 5101 char *buf = NULL, *buf1 = NULL, *buf2 = NULL; 5266 5102 5267 5103 buf = ostrstr(line, searchstr); 5268 5104 if(buf == NULL) 5269 { 5270 //debug(1000, "out -> searchstr=\"%s\" not found in line=\"%s\"", searchstr, line); 5271 return NULL; 5272 } 5105 return NULL; 5106 5273 5107 buf = buf + strlen(searchstr); 5274 5108 if(buf[0] == '"') … … 5315 5149 buf2[0] = '\0'; 5316 5150 } 5317 //debug(1000, "out"); 5151 5318 5152 return buf1; 5319 5153 } … … 5321 5155 char* readbintomem(const char* filename, size_t size) 5322 5156 { 5323 debug(1000, "in");5324 5157 FILE *fd = NULL; 5325 5158 char *fileline = NULL; … … 5343 5176 5344 5177 fclose(fd); 5345 debug(1000, "out");5346 5178 return fileline; 5347 5179 } … … 5349 5181 char* readfiletomem(const char* filename, int flag) 5350 5182 { 5351 debug(1000, "in");5352 5183 FILE *fd = NULL; 5353 5184 char *fileline = NULL, *buf = NULL, *buf1 = NULL; … … 5393 5224 free(fileline); 5394 5225 fclose(fd); 5395 debug(1000, "out");5396 5226 return buf1; 5397 5227 } … … 5530 5360 char* command(char* input) 5531 5361 { 5532 debug(1000, "in");5533 5362 char* tmpstr = NULL, *fileline = NULL; 5534 5363 FILE *iopipe = NULL; … … 5557 5386 free(fileline); 5558 5387 pclose(iopipe); 5559 debug(1000, "out");5560 5388 return tmpstr; 5561 5389 } … … 5655 5483 char* string_remove_whitechars(char *text) 5656 5484 { 5657 debug(1000, "in");5658 5485 char *p1 = text, *p2 = text; 5659 5486 … … 5669 5496 *p2 = '\0'; 5670 5497 5671 debug(1000, "out");5672 5498 return text; 5673 5499 } … … 5675 5501 char* strstrip(char *text) 5676 5502 { 5677 debug(1000, "in");5678 5503 char* tmpstr = text; 5679 5504 … … 5686 5511 memmove(text, tmpstr, len + 1); 5687 5512 5688 debug(1000, "out");5689 5513 return text; 5690 5514 } … … 5695 5519 5696 5520 if(text == NULL) 5697 { 5698 debug(1000, "out -> NULL detect"); 5699 return NULL; 5700 } 5521 return NULL; 5701 5522 5702 5523 while(*p1 != '\0') … … 5775 5596 char* string_replace_remove_last_chars(char *search, char *replace, char *string, int free1) 5776 5597 { 5777 debug(1000, "in");5778 5598 char* searchpos = NULL; 5779 5599 char* tmpstr = NULL; … … 5801 5621 if(free1 == 1) free(string); 5802 5622 5803 debug(1000, "out");5804 5623 return tmpstr; 5805 5624 } … … 5807 5626 char* string_replace(char *search, char *replace, char *string, int free1) 5808 5627 { 5809 debug(1000, "in");5810 5628 char* searchpos = NULL; 5811 5629 char* tmpstr = NULL; … … 5834 5652 if(free1 == 1) free(string); 5835 5653 5836 debug(1000, "out");5837 5654 return tmpstr; 5838 5655 } … … 5886 5703 char* ostrstr(char* str, char* search) 5887 5704 { 5888 //debug(1000, "in");5889 5705 char* ret = NULL; 5890 5706 … … 5892 5708 ret = strstr(str, search); 5893 5709 5894 //debug(1000, "out");5895 5710 return ret; 5896 5711 } … … 5898 5713 int file_exist(char* filename) 5899 5714 { 5900 debug(1000, "in");5901 5715 if(access(filename, F_OK) == 0) 5902 5716 return 1; … … 5907 5721 char* string_newline(char* str) 5908 5722 { 5909 debug(1000, "in");5910 5723 if(str == NULL) return NULL; 5911 5724 … … 5914 5727 if(str[size - 1] == '\n') 5915 5728 str[size - 1] = '\0'; 5916 debug(1000, "out"); 5729 5917 5730 return str; 5918 5731 } … … 5920 5733 char* string_quote(char* str) 5921 5734 { 5922 debug(1000, "in");5923 5735 char* tmpstr = NULL; 5924 5736 5925 5737 tmpstr = ostrcat("\"", str, 0, 0); 5926 5738 tmpstr = ostrcat(tmpstr, "\"", 1, 0); 5927 debug(1000, "out"); 5739 5928 5740 return tmpstr; 5929 5741 } … … 5931 5743 struct splitstr* strsplit(char *str, char *tok, int* count) 5932 5744 { 5933 debug(1000, "in");5934 5745 char *tmpstr = NULL; 5935 5746 struct splitstr *tmparray = NULL; … … 5950 5761 } 5951 5762 5952 debug(1000, "out");5953 5763 return tmparray; 5954 5764 } … … 6351 6161 } 6352 6162 6353 debug(1000, "out");6354 6163 return input; 6355 6164 } … … 6357 6166 char* string_deltags(char* str) 6358 6167 { 6359 debug(1000, "in");6360 6168 int i = 0, y = 0, len = 0; 6361 6169 … … 6380 6188 str[y] = '\0'; 6381 6189 6382 debug(1000, "out");6383 6190 return str; 6384 6191 } … … 6386 6193 char* string_striptags(char* str) 6387 6194 { 6388 debug(1000, "in");6389 6195 int i = 0, len = 0; 6390 6196 … … 6407 6213 } 6408 6214 6409 debug(1000, "out");6410 6215 return strstrip(str); 6411 6216 } … … 6413 6218 char* string_resub(char* str, char* str2, char* input, int dir) 6414 6219 { 6415 debug(1000, "in");6416 6220 int len; 6417 6221 char* tmpstr = NULL, *pos = NULL, *pos2 = NULL; … … 6442 6246 tmpstr = strndup(pos, pos2 - pos); 6443 6247 6444 debug(1000, "out");6445 6248 return strstrip(tmpstr); 6446 6249 }
Note: See TracChangeset
for help on using the changeset viewer.