diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-12-28 12:28:25 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-12-28 12:28:25 -0500 |
commit | 5a754bcdc0f5e432c1d7cd358c74dfb2d6f0f1ea (patch) | |
tree | a60ffaacdaa394f8a9772220b50a47d5f51bddc6 /src/mime.c | |
parent | a267f8258162fdab350944676b2e71f858c3de51 (diff) | |
download | spmc-5a754bcdc0f5e432c1d7cd358c74dfb2d6f0f1ea.tar.gz |
Fixes:
* doxygen config
* doxygen @file directives
* corrected stupid strip() implemention
* corrected strip usage by config parser. wrong pointer.
Diffstat (limited to 'src/mime.c')
-rw-r--r-- | src/mime.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -1,5 +1,13 @@ +/** + * @file mime.c + */ #include "spm.h" +/** + * Execute OS `file` command + * @param _filename path to file + * @return Process structure + */ Process *file_command(const char *_filename) { char *filename = strdup(_filename); Process *proc_info = NULL; @@ -26,6 +34,11 @@ Process *file_command(const char *_filename) { return proc_info; } +/** + * Execute the `file` command, parse its output, and return the data in a `Mime` structure + * @param filename path to file + * @return Mime structure + */ Mime *file_mimetype(const char *filename) { char **output = NULL; char **parts = NULL; @@ -63,6 +76,10 @@ Mime *file_mimetype(const char *filename) { return type; } +/** + * Free a `Mime` structure + * @param m + */ void mime_free(Mime *m) { if (m != NULL) { free(m->origin); @@ -72,6 +89,11 @@ void mime_free(Mime *m) { } } +/** + * Determine if a file is a text file + * @param filename + * @return yes=1, no=0 + */ int file_is_text(const char *filename) { int result = 0; char *path = normpath(filename); @@ -84,6 +106,11 @@ int file_is_text(const char *filename) { return result; } +/** + * Determine if a file is a binary data file + * @param filename + * @return yes=1, no=0 + */ int file_is_binary(const char *filename) { int result = 0; char *path = normpath(filename); |