Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / apps / JAWS / clients / WebSTONE / src / genrand.c
blob9218bf0023b0a542019800b5b02642cd358745af
1 /**************************************************************************
3 * Copyright (C) 1995 Silicon Graphics, Inc.
5 * These coded instructions, statements, and computer programs were
6 * developed by SGI for public use. If any changes are made to this code
7 * please try to get the changes back to the author. Feel free to make
8 * modifications and changes to the code and release it.
10 **************************************************************************/
12 /* FUZZ: disable check_for_math_include */
13 /* FUZZ: disable check_for_improper_main_declaration */
15 #include <stdio.h>
16 #include <fcntl.h>
17 #include <math.h>
19 #include <stdlib.h>
20 #include <sys/types.h>
21 #include <sys/stat.h>
22 #include "sysdep.h"
24 void
25 main(const int argc, char* argv[])
27 FILE* file;
28 int i;
29 int my_random;
30 int size;
31 char *cp;
33 if (argc != 3)
35 printf("usage: %s file_size_in_bytes[K|M] name\n", argv[0]);
36 exit(2);
39 if ((file = fopen(argv[2], "w")) == 0)
41 perror("fopen");
42 exit(1);
45 size = atoi(argv[1]);
47 for (cp = argv[1]; *cp; cp++)
49 switch(*cp)
51 case 'k':
52 case 'K':
53 size *= 1024;
54 break;
55 case 'm':
56 case 'M':
57 size *= 1024*1024;
58 break;
62 for (i = 0; i < size; i++)
64 my_random = ((RANDOM() % 94) + 33);
65 fputc((char)my_random, file);
68 fclose(file);