This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / ccgenu / fchtak.c
CommitLineData
fe4da5cc 1/*
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1 1996/02/15 17:49:40 mclareni
6 * Kernlib
7 *
8 */
9#include "kerngen/pilot.h"
10/*> ROUTINE FCHTAK
11 CERN PROGLIB# FCHTAK .VERSION KERNFOR 4.31 911111
12 ORIG. 22/02/91, JZ
13
14 copy a Fortran character string
15 to allocated memory zero-terminated,
16 return the memory pointer
17*/
18#include <stdio.h>
19#include "kerngen/fortchar.h"
20char *fchtak(ftext,lgtext)
21#if defined(CERNLIB_QMCRY)
22 _fcd ftext;
23#endif
24#if !defined(CERNLIB_QMCRY)
25 char *ftext;
26#endif
27 int lgtext;
28{
29 char *malloc();
30 char *ptalc, *ptuse;
31 char *utext;
32 int nalc;
33 int ntx, jcol;
34
35 nalc = lgtext + 8;
36 ptalc = malloc (nalc);
37 if (ptalc == NULL) goto exit;
38#if defined(CERNLIB_QMCRY)
39 utext = _fcdtocp(ftext);
40#endif
41#if !defined(CERNLIB_QMCRY)
42 utext = ftext;
43#endif
44
45 ptuse = ptalc;
46 ntx = lgtext;
47 for (jcol = 0; jcol < ntx; jcol++) *ptuse++ = *utext++;
48
49 *ptuse = '\0';
50exit: return ptalc;
51}
52/*> END <----------------------------------------------------------*/