Browse Source

Add MIME part boundary generation function

tags/v0.1.0
Damien Goutte-Gattat 9 years ago
parent
commit
dc93af0770
1 changed files with 16 additions and 0 deletions
  1. +16
    -0
      src/fmail.c

+ 16
- 0
src/fmail.c View File

@@ -74,6 +74,21 @@ See the COPYING file or <http://www.gnu.org/licenses/gpl.html>.\n\
/* Helper functions. */

static char *
generate_boundary(char *buffer, size_t len)
{
static const char chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
int i;

for ( i = 0; i < len - 1; i++ )
buffer[i] = chars[rand() % (sizeof(chars) - 1)];
buffer[i] = '\0';

return buffer;
}

static void
qp_encode_stream(FILE *in, FILE *out)
{
@@ -214,6 +229,7 @@ main(int argc, char *argv[])

setprogname(argv[0]);
setlocale(LC_ALL, "");
srand(time(NULL));

headers = sb_new(0);
sign_ctx = NULL;


Loading…
Cancel
Save