genrandom.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000-2005, 2007, 2009, 2010, 2012, 2014, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: genrandom.c,v 1.7 2010/05/17 23:51:04 tbox Exp $ */
/*! \file */
#include <config.h>
#include <isc/commandline.h>
#include <stdio.h>
#include <string.h>
const char *program = "genrandom";
ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
exit(1);
}
static void
exit(1);
}
while (bytes > 0) {
#ifndef HAVE_ARC4RANDOM
unsigned short int x = (rand() & 0xFFFF);
#else
unsigned short int x = (arc4random() & 0xFFFF);
#endif
unsigned char c = x & 0xFF;
exit(1);
}
c = x >> 8;
exit(1);
}
bytes -= 2;
}
}
int
unsigned int bytes;
unsigned int k;
char *endp;
int c, i, n = 1;
char *name;
switch (c) {
case 'n':
usage();
break;
case '?':
if (isc_commandline_option != '?')
/* FALLTHROUGH */
case 'h':
usage();
default:
exit(1);
}
}
usage();
if (*endp != 0)
usage();
bytes = k << 10;
#ifndef HAVE_ARC4RANDOM
srand(0x12345678);
#endif
if (n == 1) {
return (0);
}
len += 2;
perror("malloc");
exit(1);
}
for (i = 1; i <= n; i++) {
}
return (0);
}