]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MICROCERN/fchtak.c
Fix up a warning about casts
[u/mrichter/AliRoot.git] / MICROCERN / fchtak.c
CommitLineData
803d1ab0 1/* $Id$ */
2
fe4da5cc 3#include "kerngen/pilot.h"
4/*> ROUTINE FCHTAK
5 CERN PROGLIB# FCHTAK .VERSION KERNFOR 4.31 911111
6 ORIG. 22/02/91, JZ
7
8 copy a Fortran character string
9 to allocated memory zero-terminated,
10 return the memory pointer
11*/
12#include <stdio.h>
c58e65bc 13#include <stdlib.h>
fe4da5cc 14#include "kerngen/fortchar.h"
15char *fchtak(ftext,lgtext)
16#if defined(CERNLIB_QMCRY)
17 _fcd ftext;
18#endif
19#if !defined(CERNLIB_QMCRY)
20 char *ftext;
21#endif
22 int lgtext;
23{
c58e65bc 24 /* char *malloc(); */
fe4da5cc 25 char *ptalc, *ptuse;
26 char *utext;
27 int nalc;
28 int ntx, jcol;
29
30 nalc = lgtext + 8;
c58e65bc 31 ptalc = (char*)malloc (nalc);
fe4da5cc 32 if (ptalc == NULL) goto exit;
33#if defined(CERNLIB_QMCRY)
34 utext = _fcdtocp(ftext);
35#endif
36#if !defined(CERNLIB_QMCRY)
37 utext = ftext;
38#endif
39
40 ptuse = ptalc;
41 ntx = lgtext;
42 for (jcol = 0; jcol < ntx; jcol++) *ptuse++ = *utext++;
43
44 *ptuse = '\0';
45exit: return ptalc;
46}
47/*> END <----------------------------------------------------------*/