Mercurial > mplayer.hg
comparison libmenu/menu_filesel.c @ 29263:0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
author | diego |
---|---|
date | Wed, 13 May 2009 02:58:57 +0000 |
parents | f8b6c7045cf8 |
children | c05fbacce55f |
comparison
equal
deleted
inserted
replaced
29262:7d545a6b8aff | 29263:0f1b5b68af32 |
---|---|
62 char* path; | 62 char* path; |
63 char* title; | 63 char* title; |
64 char* file_action; | 64 char* file_action; |
65 char* dir_action; | 65 char* dir_action; |
66 char** actions; | 66 char** actions; |
67 char* filter; | 67 char* filter; |
68 }; | 68 }; |
69 | 69 |
70 static struct menu_priv_s cfg_dflt = { | 70 static struct menu_priv_s cfg_dflt = { |
71 MENU_LIST_PRIV_DFLT, | 71 MENU_LIST_PRIV_DFLT, |
72 NULL, | 72 NULL, |
102 static char* replace_path(char* title , char* dir , int escape) { | 102 static char* replace_path(char* title , char* dir , int escape) { |
103 char *p = strstr(title,"%p"); | 103 char *p = strstr(title,"%p"); |
104 if(p) { | 104 if(p) { |
105 int tl = strlen(title); | 105 int tl = strlen(title); |
106 int dl = strlen(dir); | 106 int dl = strlen(dir); |
107 int t1l = p-title; | 107 int t1l = p-title; |
108 int l = tl - 2 + dl; | 108 int l = tl - 2 + dl; |
109 char *r, *n, *d = dir; | 109 char *r, *n, *d = dir; |
110 | 110 |
111 if (escape) { | 111 if (escape) { |
112 do { | 112 do { |
293 if((tp = (char **) realloc(namelist, (n+20) * sizeof (char *))) | 293 if((tp = (char **) realloc(namelist, (n+20) * sizeof (char *))) |
294 == NULL) { | 294 == NULL) { |
295 mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReallocError, strerror(errno)); | 295 mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReallocError, strerror(errno)); |
296 n--; | 296 n--; |
297 goto bailout; | 297 goto bailout; |
298 } | 298 } |
299 namelist=tp; | 299 namelist=tp; |
300 } | 300 } |
301 | 301 |
302 namelist[n] = (char *) malloc(strlen(dp->d_name) + 2); | 302 namelist[n] = (char *) malloc(strlen(dp->d_name) + 2); |
303 if(namelist[n] == NULL){ | 303 if(namelist[n] == NULL){ |
304 mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno)); | 304 mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno)); |
305 n--; | 305 n--; |
306 goto bailout; | 306 goto bailout; |
307 } | 307 } |
308 | 308 |
309 strcpy(namelist[n], dp->d_name); | 309 strcpy(namelist[n], dp->d_name); |
310 if(S_ISDIR(st.st_mode)) | 310 if(S_ISDIR(st.st_mode)) |
311 strcat(namelist[n], "/"); | 311 strcat(namelist[n], "/"); |
312 n++; | 312 n++; |
313 } | 313 } |
431 | 431 |
432 if (menu_keepdir) { | 432 if (menu_keepdir) { |
433 if (!path || path[0] == '\0') { | 433 if (!path || path[0] == '\0') { |
434 struct stat st; | 434 struct stat st; |
435 int path_fp; | 435 int path_fp; |
436 | 436 |
437 path_fp = open (MENU_KEEP_PATH, O_RDONLY); | 437 path_fp = open (MENU_KEEP_PATH, O_RDONLY); |
438 if (path_fp >= 0) { | 438 if (path_fp >= 0) { |
439 if (!fstat (path_fp, &st) && (st.st_size > 0)) { | 439 if (!fstat (path_fp, &st) && (st.st_size > 0)) { |
440 path = malloc(st.st_size+1); | 440 path = malloc(st.st_size+1); |
441 path[st.st_size] = '\0'; | 441 path[st.st_size] = '\0'; |
447 } | 447 } |
448 close (path_fp); | 448 close (path_fp); |
449 } | 449 } |
450 } | 450 } |
451 } | 451 } |
452 | 452 |
453 getcwd(wd,PATH_MAX); | 453 getcwd(wd,PATH_MAX); |
454 if (!path || path[0] == '\0') { | 454 if (!path || path[0] == '\0') { |
455 #if 0 | 455 #if 0 |
456 char *slash = NULL; | 456 char *slash = NULL; |
457 if (filename && !strstr(filename, "://") && (path=realpath(filename, b))) { | 457 if (filename && !strstr(filename, "://") && (path=realpath(filename, b))) { |
493 } | 493 } |
494 r = open_dir(menu,path); | 494 r = open_dir(menu,path); |
495 | 495 |
496 return r; | 496 return r; |
497 } | 497 } |
498 | 498 |
499 const menu_info_t menu_info_filesel = { | 499 const menu_info_t menu_info_filesel = { |
500 "File seletor menu", | 500 "File seletor menu", |
501 "filesel", | 501 "filesel", |
502 "Albeu", | 502 "Albeu", |
503 "", | 503 "", |