Get mime type for specified package.
More...
#include "finder.h"
Go to the source code of this file.
|
char * | TaintString (char *S) |
| Create a string with taint quoting. More...
|
|
void | DBLoadMime () |
| Populate the DBMime table.
|
|
int | DBFindMime (char *Mimetype) |
| Find a mime type in the DBMime table. More...
|
|
int | CheckMimeTypes (char *Ext) |
| Given an extension, see if extension exists in the /etc/mime.types. More...
|
|
int | DBCheckFileExtention () |
| Given a pfile, identify any filenames and see if any of them have a known extension based on /etc/mime.types. More...
|
|
int | GetDefaultMime (char *MimeType, char *Filename) |
| Get the ID for the default mimetype. More...
|
|
void | DBCheckMime (char *Filename) |
| Given a file, check if it has a mime type in the DB. More...
|
|
char * | GetFieldValue (char *Sin, char *Field, int FieldMax, char *Value, int ValueMax) |
| Given a string that contains field='value' pairs, save the items. More...
|
|
int | ReadLine (FILE *Fin, char *Line, int MaxLine) |
| Read a line each time from one file. More...
|
|
void | Usage (char *Name) |
| Here are some suggested options. More...
|
|
Get mime type for specified package.
Definition in file finder.c.
int CheckMimeTypes |
( |
char * |
Ext | ) |
|
Given an extension, see if extension exists in the /etc/mime.types.
- Parameters
-
- Returns
- int - if the extension exists in the /etc/mime.types, add metatype to DB and return DB index. Otherwise, return -1.
Definition at line 138 of file finder.c.
int DBCheckFileExtention |
( |
| ) |
|
Given a pfile, identify any filenames and see if any of them have a known extension based on /etc/mime.types.
- Note
- Reads pfile id from Akey
- Returns
- int - return the mimetype id, or -1 if not found.
Definition at line 196 of file finder.c.
void DBCheckMime |
( |
char * |
Filename | ) |
|
Given a file, check if it has a mime type in the DB.
If it does not, then add it.
- Parameters
-
Filename | The path of the file |
Definition at line 292 of file finder.c.
int DBFindMime |
( |
char * |
Mimetype | ) |
|
Find a mime type in the DBMime table.
If the Mimetype is already in table mimetype, return mimetype_pk, if not, insert it into table mimetype, then return the mimetype_pk.
- Parameters
-
- Returns
- int - mimetype ID or -1 if not found.
Definition at line 92 of file finder.c.
int GetDefaultMime |
( |
char * |
MimeType, |
|
|
char * |
Filename |
|
) |
| |
Get the ID for the default mimetype.
Options are:
Mimetype | Description |
application/x-empty | Zero-length file |
text/plain | 1st 100 characters are printable |
application/octet-stream | 1st 100 characters contain binary |
- Parameters
-
MimeType | Mimetype name |
Filename | File name |
- Returns
- int - return -1 on error, or DB index to metatype.
Definition at line 258 of file finder.c.
char* GetFieldValue |
( |
char * |
Sin, |
|
|
char * |
Field, |
|
|
int |
FieldMax, |
|
|
char * |
Value, |
|
|
int |
ValueMax |
|
) |
| |
Given a string that contains field='value' pairs, save the items.
- Parameters
-
[in] | Sin | Input string |
[out] | Field | Field string |
[in] | FieldMax | Capacity of Field |
[out] | Value | Value string |
[in] | ValueMax | Capacity of Field |
- Returns
- Return character pointer to start of next field, or NULL at \0.
Definition at line 425 of file finder.c.
int ReadLine |
( |
FILE * |
Fin, |
|
|
char * |
Line, |
|
|
int |
MaxLine |
|
) |
| |
Read a line each time from one file.
- Parameters
-
[in] | Fin | The file stream |
[out] | Line | Save a line of content |
[in] | MaxLine | Max character count one time to read a line |
- Returns
- int - the character count of the line
Definition at line 489 of file finder.c.
char* TaintString |
( |
char * |
S | ) |
|
Create a string with taint quoting.
- Parameters
-
[in] | S | The string to be tainted |
- Returns
- Static tainted string.
Definition at line 46 of file finder.c.
void Usage |
( |
char * |
Name | ) |
|
Here are some suggested options.
Say how to run this program.
- Parameters
-
Name | - the name of the executable, usually it is mimetype |
Definition at line 521 of file finder.c.
for Magic
Magic Cookie.
Definition at line 34 of file finder.c.
Database connection.
DB connection.
Database connection.
Definition at line 29 of file finder.c.
For DB.
SQL query to execute.
Definition at line 25 of file finder.c.