Warning, file /education/cantor/thirdparty/discount-2.2.6-patched/basename.c was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * mkdio -- markdown front end input functions 0003 * 0004 * Copyright (C) 2007 David L Parsons. 0005 * The redistribution terms are provided in the COPYRIGHT file that must 0006 * be distributed with this source code. 0007 */ 0008 #include "config.h" 0009 #include <stdio.h> 0010 #include <stdlib.h> 0011 #include <ctype.h> 0012 0013 #include "mkdio.h" 0014 #include "cstring.h" 0015 #include "amalloc.h" 0016 0017 static char * 0018 e_basename(const char *string, const int size, void *context) 0019 { 0020 char *ret; 0021 char *base = (char*)context; 0022 0023 if ( base && string && (*string == '/') && (ret=malloc(strlen(base)+size+2)) ) { 0024 strcpy(ret, base); 0025 strncat(ret, string, size); 0026 return ret; 0027 } 0028 return 0; 0029 } 0030 0031 static void 0032 e_free(char *string, void *context) 0033 { 0034 if ( string ) free(string); 0035 } 0036 0037 void 0038 mkd_basename(MMIOT *document, char *base) 0039 { 0040 mkd_e_url(document, e_basename); 0041 mkd_e_data(document, base); 0042 mkd_e_free(document, e_free); 0043 }