h_snprintf.c (272458) | h_snprintf.c (274066) |
---|---|
1/* $NetBSD: h_snprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */ 2 3/* 4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 25 unchanged lines hidden (view full) --- 34#include <stdio.h> 35#include <stdlib.h> 36 37int 38main(int argc, char *argv[]) 39{ 40 char b[10]; 41 size_t len = atoi(argv[1]); | 1/* $NetBSD: h_snprintf.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */ 2 3/* 4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 25 unchanged lines hidden (view full) --- 34#include <stdio.h> 35#include <stdlib.h> 36 37int 38main(int argc, char *argv[]) 39{ 40 char b[10]; 41 size_t len = atoi(argv[1]); |
42#ifdef __FreeBSD__ 43 char c[] = "01234567890123456789"; 44 c[len] = 0; 45 (void)snprintf(b, len, "%s", c); 46#else |
|
42 (void)snprintf(b, len, "%s", "0123456789"); | 47 (void)snprintf(b, len, "%s", "0123456789"); |
48#endif |
|
43 (void)printf("%s\n", b); 44 return 0; 45} | 49 (void)printf("%s\n", b); 50 return 0; 51} |