1 /******************************COPYRIGHT NOTICE*******************************/
2 /* (c) Centro de Regulacio Genomica */
5 /* 12 Aug 2014 - 22:07. */
6 /*All rights reserved. */
7 /*This file is part of T-COFFEE. */
9 /* T-COFFEE is free software; you can redistribute it and/or modify */
10 /* it under the terms of the GNU General Public License as published by */
11 /* the Free Software Foundation; either version 2 of the License, or */
12 /* (at your option) any later version. */
14 /* T-COFFEE is distributed in the hope that it will be useful, */
15 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
16 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
17 /* GNU General Public License for more details. */
19 /* You should have received a copy of the GNU General Public License */
20 /* along with Foobar; if not, write to the Free Software */
21 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
22 /*............................................... */
23 /* If you need some more information */
24 /* cedric.notredame@europe.com */
25 /*............................................... */
26 /******************************COPYRIGHT NOTICE*******************************/
27 // #include "km_util.h"
28 #include "km_coffee_header.h"
30 my_fopen(char *name_f, char *mode)
32 FILE *name_F = fopen(name_f, mode);
35 fprintf(stderr, "ERROR: Cannot open file %s!\n", name_f);
44 my_malloc(size_t size)
46 void *p = malloc(size);
49 fprintf(stderr, "ERROR: Could not allocate space of size %li\n", size);
56 my_calloc ( size_t num, size_t size )
58 void *p = calloc(num, size);
61 fprintf(stderr, "ERROR: Could not allocate space of size %li\n", size*num);
69 my_realloc(void *p, size_t size)
74 fprintf(stderr, "ERROR: Could not allocate space of size %li\n", size);
84 my_make_temp_dir(char *templatee, char *function)
87 char *temp_dir_name = (char*)malloc(20 * sizeof(char*));
88 sprintf(temp_dir_name, "%s", templatee);
90 // gethostname(hostname, 50);
91 // printf("%s %s\n",hostname, temp_dir_name);
92 if ((temp_dir_name = mkdtemp(temp_dir_name))==NULL)
95 fprintf(stderr, "ERROR! A temporary directory could not be created: %s\n",strerror(errsv));
96 fprintf(stderr, "This error was caused by '%s' in '%s'\n", function);
100 return temp_dir_name;