Deleted Added
full compact
random.c (114725) random.c (136090)
1/*
2 * Copyright (c) 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Guy Harris at Network Appliance Corp.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 32 unchanged lines hidden (view full) ---

41 The Regents of the University of California. All rights reserved.\n";
42#endif /* not lint */
43
44#ifndef lint
45static const char sccsid[] = "@(#)random.c 8.5 (Berkeley) 4/5/94";
46#endif /* not lint */
47#endif
48#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Guy Harris at Network Appliance Corp.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 32 unchanged lines hidden (view full) ---

41 The Regents of the University of California. All rights reserved.\n";
42#endif /* not lint */
43
44#ifndef lint
45static const char sccsid[] = "@(#)random.c 8.5 (Berkeley) 4/5/94";
46#endif /* not lint */
47#endif
48#include <sys/cdefs.h>
49__FBSDID("$FreeBSD: head/games/random/random.c 114725 2003-05-05 09:52:25Z obrien $");
49__FBSDID("$FreeBSD: head/games/random/random.c 136090 2004-10-03 15:34:15Z stefanf $");
50
51#include <sys/types.h>
52
53#include <err.h>
54#include <errno.h>
55#include <fcntl.h>
56#include <limits.h>
57#include <stdio.h>

--- 7 unchanged lines hidden (view full) ---

65static void usage(void);
66
67int
68main(int argc, char *argv[])
69{
70 double denom;
71 int ch, fd, random_exit, randomize_lines, random_type, ret,
72 selected, unique_output, unbuffer_output;
50
51#include <sys/types.h>
52
53#include <err.h>
54#include <errno.h>
55#include <fcntl.h>
56#include <limits.h>
57#include <stdio.h>

--- 7 unchanged lines hidden (view full) ---

65static void usage(void);
66
67int
68main(int argc, char *argv[])
69{
70 double denom;
71 int ch, fd, random_exit, randomize_lines, random_type, ret,
72 selected, unique_output, unbuffer_output;
73 char *ep, *filename;
73 char *ep;
74 const char *filename;
74
75 denom = 0;
75
76 denom = 0;
76 filename = NULL;
77 filename = "/dev/fd/0";
77 random_type = RANDOM_TYPE_UNSET;
78 random_exit = randomize_lines = random_type = unbuffer_output = 0;
79 unique_output = 1;
80 while ((ch = getopt(argc, argv, "ef:hlruUw")) != -1)
81 switch (ch) {
82 case 'e':
83 random_exit = 1;
84 break;
85 case 'f':
86 randomize_lines = 1;
78 random_type = RANDOM_TYPE_UNSET;
79 random_exit = randomize_lines = random_type = unbuffer_output = 0;
80 unique_output = 1;
81 while ((ch = getopt(argc, argv, "ef:hlruUw")) != -1)
82 switch (ch) {
83 case 'e':
84 random_exit = 1;
85 break;
86 case 'f':
87 randomize_lines = 1;
87 if (!strcmp(optarg, "-"))
88 filename = strdup("/dev/fd/0");
89 else
88 if (strcmp(optarg, "-") != 0)
90 filename = optarg;
91 break;
92 case 'l':
93 randomize_lines = 1;
94 random_type = RANDOM_TYPE_LINES;
95 break;
96 case 'r':
97 unbuffer_output = 1;

--- 97 unchanged lines hidden ---
89 filename = optarg;
90 break;
91 case 'l':
92 randomize_lines = 1;
93 random_type = RANDOM_TYPE_LINES;
94 break;
95 case 'r':
96 unbuffer_output = 1;

--- 97 unchanged lines hidden ---