#include <stdio.h>#include <strings.h>#include <string.h>#include "tags.h"#include "filetypes.h"
Go to the source code of this file.
Functions | |
| static const char * | get_tag_for_extension (const char *ext) |
| static const char * | get_tag_for_dir (const char *dir, const char *basedir) |
| const gchar * | get_tag_for_file (const gchar *filename, const gchar *dir, const char *basedir) |
Variables | |
| struct { | |
| char * tag | |
| char * special_dir | |
| char * exts [32] | |
| } | extension_tag_map [] |
| static const char* get_tag_for_dir | ( | const char * | dir, | |
| const char * | basedir | |||
| ) | [static] |
Definition at line 70 of file tags.c.
References extension_tag_map, and special_dir.
Referenced by get_tag_for_file().
00071 { 00072 char fulldir[256]; 00073 int i; 00074 for (i=0; extension_tag_map[i].tag; i++) 00075 { 00076 snprintf(fulldir, sizeof(fulldir), "%s/%s", basedir, extension_tag_map[i].special_dir); 00077 int len = strlen(fulldir); 00078 if (strncasecmp(fulldir, dir, len) == 0) { 00079 if (dir[len] == 0 || dir[len] == '/') { 00080 return extension_tag_map[i].tag; 00081 } 00082 } 00083 } 00084 return NULL; 00085 }

| static const char* get_tag_for_extension | ( | const char * | ext | ) | [static] |
Definition at line 53 of file tags.c.
References extension_tag_map, and exts.
Referenced by get_tag_for_file().
00054 { 00055 int i, j; 00056 for (i = 0; extension_tag_map[i].tag; i++) 00057 { 00058 for (j = 0; extension_tag_map[i].exts[j]; j++) 00059 { 00060 if (strcasecmp(extension_tag_map[i].exts[j], ext) == 0) 00061 { 00062 return extension_tag_map[i].tag; 00063 } 00064 } 00065 } 00066 return NULL; 00067 }

| const gchar* get_tag_for_file | ( | const gchar * | filename, | |
| const gchar * | dir, | |||
| const char * | basedir | |||
| ) |
File Name : tags.h Copyright (C) 2008 iRex Technologies B.V. All rights reserved.
Definition at line 88 of file tags.c.
References g_extension_pointer(), get_tag_for_dir(), and get_tag_for_extension().
Referenced by handle_changes().
00091 { 00092 static const char* empty = ""; 00093 00094 const char *ctag = get_tag_for_dir(dir, basedir); 00095 if (ctag) return ctag; 00096 00097 const char *ext = g_extension_pointer(filename); 00098 ctag = get_tag_for_extension(ext); 00099 if (ctag) return ctag; 00100 00101 return empty; 00102 }


struct { ... } extension_tag_map[] [static] |
Copyright (C) 2008 iRex Technologies B.V. All rights reserved.
Referenced by get_tag_for_dir(), and get_tag_for_extension().
| char* exts[32] |
Definition at line 37 of file tags.c.
Referenced by get_tag_for_extension().
| char* special_dir |
Definition at line 36 of file tags.c.
Referenced by get_tag_for_dir().
| char* tag |
Definition at line 35 of file tags.c.
Referenced by add_file_to_metadata(), download_status_changed_cb(), and handle_changes().
1.6.2-20100208