lib/courier-authlib/copyargv.c
changeset 0 6f7a81934006
child 2 b3afb9f1e801
equal deleted inserted replaced
-1:000000000000 0:6f7a81934006
       
     1 /*
       
     2 ** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
       
     3 ** distribution information.
       
     4 */
       
     5 
       
     6 #if	HAVE_CONFIG_H
       
     7 #include	"config.h"
       
     8 #endif
       
     9 #include	<stdio.h>
       
    10 #include	<stdlib.h>
       
    11 #include	<string.h>
       
    12 #if	HAVE_UNISTD_H
       
    13 #include	<unistd.h>
       
    14 #endif
       
    15 #include	"auth.h"
       
    16 
       
    17 static const char rcsid[]="$Id: copyargv.c,v 1.1 2000/04/13 17:55:05 bruce Exp $";
       
    18 
       
    19 char **authcopyargv(int c, char **oldv, char **prog)
       
    20 {
       
    21 char **v;
       
    22 int	n;
       
    23 
       
    24 	if ((v=(char **)malloc(sizeof(char *)*(c+1))) == 0)
       
    25 	{
       
    26 		perror("malloc");
       
    27 		authexit(1);
       
    28 	}
       
    29 	for (n=0; n<c; n++)
       
    30 		v[n]=oldv[n];
       
    31 	v[c]=0;
       
    32 	if (v[0])
       
    33 	{
       
    34 		*prog=v[0];
       
    35 	}
       
    36 	else
       
    37 		*prog=0;
       
    38 
       
    39 	return (v);
       
    40 }