mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
Don't forget to
1. Add basename.c to source control, and 2. bump up the version#
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* mkdio -- markdown front end input functions
|
||||
*
|
||||
* Copyright (C) 2007 David L Parsons.
|
||||
* The redistribution terms are provided in the COPYRIGHT file that must
|
||||
* be distributed with this source code.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "cstring.h"
|
||||
#include "markdown.h"
|
||||
#include "amalloc.h"
|
||||
|
||||
static char *
|
||||
e_basename(char *string, int size, char *base)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
if ( base && string && (*string != '/') && (ret=malloc(strlen(base)+size+2)) ) {
|
||||
strcpy(ret, base);
|
||||
strncat(ret, string, size);
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
e_free(char *string, char *base)
|
||||
{
|
||||
if ( string ) free(string);
|
||||
}
|
||||
|
||||
void
|
||||
mkd_basename(Document *document, char *base)
|
||||
{
|
||||
mkd_e_url(document, e_basename);
|
||||
mkd_e_context(document, base);
|
||||
mkd_e_free(document, e_free);
|
||||
}
|
||||
Reference in New Issue
Block a user