1254885Sdumbbell/* $NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */ 2254885Sdumbbell 3254885Sdumbbell/* 4254885Sdumbbell * Copyright (c) 2008 The NetBSD Foundation, Inc. 5254885Sdumbbell * All rights reserved. 6254885Sdumbbell * 7254885Sdumbbell * Redistribution and use in source and binary forms, with or without 8254885Sdumbbell * modification, are permitted provided that the following conditions 9254885Sdumbbell * are met: 10254885Sdumbbell * 1. Redistributions of source code must retain the above copyright 11254885Sdumbbell * notice, this list of conditions and the following disclaimer. 12254885Sdumbbell * 2. Redistributions in binary form must reproduce the above copyright 13254885Sdumbbell * notice, this list of conditions and the following disclaimer in the 14254885Sdumbbell * documentation and/or other materials provided with the distribution. 15254885Sdumbbell * 16254885Sdumbbell * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 17254885Sdumbbell * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18254885Sdumbbell * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19254885Sdumbbell * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 20254885Sdumbbell * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21254885Sdumbbell * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22254885Sdumbbell * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23254885Sdumbbell * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24254885Sdumbbell * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25254885Sdumbbell * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26254885Sdumbbell * POSSIBILITY OF SUCH DAMAGE. 27254885Sdumbbell */ 28254885Sdumbbell 29254885Sdumbbell#include <sys/cdefs.h> 30254885Sdumbbell__COPYRIGHT("@(#) Copyright (c) 2008\ 31254885Sdumbbell The NetBSD Foundation, inc. All rights reserved."); 32254885Sdumbbell__RCSID("$NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $"); 33254885Sdumbbell 34254885Sdumbbell#include <stdio.h> 35254885Sdumbbell#include <string.h> 36254885Sdumbbell#include <stdlib.h> 37254885Sdumbbell 38254885Sdumbbellint 39254885Sdumbbellmain(int argc, char *argv[]) 40254885Sdumbbell{ 41254885Sdumbbell char b[10]; 42254885Sdumbbell size_t len = atoi(argv[1]); 43254885Sdumbbell (void)memset(b, 0, len); 44254885Sdumbbell#ifdef __FreeBSD__ 45254885Sdumbbell return b[0]; /* keeps optimizer from zapping the call to memset() */ 46254885Sdumbbell#else 47254885Sdumbbell return 0; 48254885Sdumbbell#endif 49254885Sdumbbell} 50254885Sdumbbell