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.
◆ CheckMimeTypes()
| 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 127 of file finder.c.
◆ DBCheckFileExtention()
| 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 185 of file finder.c.
◆ DBCheckMime()
| 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 281 of file finder.c.
◆ DBFindMime()
| 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 81 of file finder.c.
◆ GetDefaultMime()
| 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 247 of file finder.c.
◆ GetFieldValue()
| 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 414 of file finder.c.
◆ ReadLine()
| 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 478 of file finder.c.
◆ TaintString()
| 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 35 of file finder.c.
◆ Usage()
| 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 510 of file finder.c.
◆ MagicCookie
for Magic
Magic Cookie.
Definition at line 23 of file finder.c.
◆ pgConn
Database connection.
DB connection.
Database connection.
Definition at line 18 of file finder.c.
◆ SQL
For DB.
SQL query to execute.
Definition at line 14 of file finder.c.