xref: /netbsd/tests/lib/libc/ssp/h_memcpy.c (revision 06cf2860)
1*06cf2860Spgoyette /* $NetBSD: h_memcpy.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
2*06cf2860Spgoyette 
3*06cf2860Spgoyette /*
4*06cf2860Spgoyette  * Copyright (c) 2008 The NetBSD Foundation, Inc.
5*06cf2860Spgoyette  * All rights reserved.
6*06cf2860Spgoyette  *
7*06cf2860Spgoyette  * Redistribution and use in source and binary forms, with or without
8*06cf2860Spgoyette  * modification, are permitted provided that the following conditions
9*06cf2860Spgoyette  * are met:
10*06cf2860Spgoyette  * 1. Redistributions of source code must retain the above copyright
11*06cf2860Spgoyette  *    notice, this list of conditions and the following disclaimer.
12*06cf2860Spgoyette  * 2. Redistributions in binary form must reproduce the above copyright
13*06cf2860Spgoyette  *    notice, this list of conditions and the following disclaimer in the
14*06cf2860Spgoyette  *    documentation and/or other materials provided with the distribution.
15*06cf2860Spgoyette  *
16*06cf2860Spgoyette  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*06cf2860Spgoyette  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*06cf2860Spgoyette  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*06cf2860Spgoyette  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*06cf2860Spgoyette  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*06cf2860Spgoyette  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*06cf2860Spgoyette  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*06cf2860Spgoyette  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*06cf2860Spgoyette  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*06cf2860Spgoyette  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*06cf2860Spgoyette  * POSSIBILITY OF SUCH DAMAGE.
27*06cf2860Spgoyette  */
28*06cf2860Spgoyette 
29*06cf2860Spgoyette #include <sys/cdefs.h>
30*06cf2860Spgoyette __COPYRIGHT("@(#) Copyright (c) 2008\
31*06cf2860Spgoyette  The NetBSD Foundation, inc. All rights reserved.");
32*06cf2860Spgoyette __RCSID("$NetBSD: h_memcpy.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
33*06cf2860Spgoyette 
34*06cf2860Spgoyette #include <stdio.h>
35*06cf2860Spgoyette #include <string.h>
36*06cf2860Spgoyette #include <stdlib.h>
37*06cf2860Spgoyette 
38*06cf2860Spgoyette int
main(int argc,char * argv[])39*06cf2860Spgoyette main(int argc, char *argv[])
40*06cf2860Spgoyette {
41*06cf2860Spgoyette 	char b[10];
42*06cf2860Spgoyette 	int len = atoi(argv[1]);
43*06cf2860Spgoyette 
44*06cf2860Spgoyette 	(void)memcpy(b, "1020202020202", len);
45*06cf2860Spgoyette 	(void)printf("%*.*s\n", len, len, b);
46*06cf2860Spgoyette 
47*06cf2860Spgoyette 	return 0;
48*06cf2860Spgoyette }
49