Changeset 5361 for trunk/oscam-simples.c
- Timestamp:
- 06/06/11 01:52:08 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oscam-simples.c
r5358 r5361 3 3 #include "globals.h" 4 4 #include "module-cccam.h" 5 6 /* Gets the client associated to the calling thread. */ 7 struct s_client *cur_client(void){ 8 return (struct s_client *) pthread_getspecific(getclient); 9 } 10 11 /* Gets the unique thread number from the client. Used in monitor and newcamd. */ 12 int32_t get_threadnum(struct s_client *client) { 13 struct s_client *cl; 14 int32_t count=0; 15 16 for (cl=first_client->next; cl ; cl=cl->next) { 17 if (cl->typ==client->typ) 18 count++; 19 if(cl==client) 20 return count; 21 } 22 return 0; 23 } 24 25 /* Gets the tmp dir */ 26 char *get_tmp_dir(){ 27 if (cs_tmpdir[0]) 28 return cs_tmpdir; 29 30 #ifdef OS_CYGWIN32 31 char *d = getenv("TMPDIR"); 32 if (!d || !d[0]) 33 d = getenv("TMP"); 34 if (!d || !d[0]) 35 d = getenv("TEMP"); 36 if (!d || !d[0]) 37 getcwd(cs_tmpdir, sizeof(cs_tmpdir)-1); 38 39 cs_strncpy(cs_tmpdir, d, sizeof(cs_tmpdir)); 40 char *p = cs_tmpdir; 41 while(*p) p++; 42 p--; 43 if (*p != '/' && *p != '\\') 44 strcat(cs_tmpdir, "/"); 45 strcat(cs_tmpdir, "_oscam"); 46 #else 47 cs_strncpy(cs_tmpdir, "/tmp/.oscam", sizeof(cs_tmpdir)); 48 #endif 49 mkdir(cs_tmpdir, S_IRWXU); 50 return cs_tmpdir; 51 } 5 52 6 53 void aes_set_key(char *key) … … 250 297 } 251 298 299 int32_t comp_timeb(struct timeb *tpa, struct timeb *tpb) 300 { 301 if (tpa->time>tpb->time) return(1); 302 if (tpa->time<tpb->time) return(-1); 303 if (tpa->millitm>tpb->millitm) return(1); 304 if (tpa->millitm<tpb->millitm) return(-1); 305 return(0); 306 } 307 252 308 int32_t cs_atob(uchar *buf, char *asc, int32_t n) 253 309 {
Note:
See TracChangeset
for help on using the changeset viewer.