Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/fortune/fortune Whitespace.
details: https://anonhg.NetBSD.org/src/rev/23b850d8ced5
branches: trunk
changeset: 747005:23b850d8ced5
user: dholland <dholland%NetBSD.org@localhost>
date: Thu Aug 27 02:03:22 2009 +0000
description:
Whitespace.
diffstat:
games/fortune/fortune/fortune.c | 245 ++++++++++++++++++++-------------------
1 files changed, 123 insertions(+), 122 deletions(-)
diffs (truncated from 572 to 300 lines):
diff -r 539e90730d74 -r 23b850d8ced5 games/fortune/fortune/fortune.c
--- a/games/fortune/fortune/fortune.c Thu Aug 27 01:42:08 2009 +0000
+++ b/games/fortune/fortune/fortune.c Thu Aug 27 02:03:22 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fortune.c,v 1.58 2009/08/27 01:42:08 dholland Exp $ */
+/* $NetBSD: fortune.c,v 1.59 2009/08/27 02:03:22 dholland Exp $ */
/*-
* Copyright (c) 1986, 1993
@@ -42,46 +42,46 @@
#if 0
static char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: fortune.c,v 1.58 2009/08/27 01:42:08 dholland Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.59 2009/08/27 02:03:22 dholland Exp $");
#endif
#endif /* not lint */
-# include <sys/param.h>
-# include <sys/stat.h>
-# include <sys/time.h>
-# include <sys/endian.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/endian.h>
-# include <dirent.h>
-# include <fcntl.h>
-# include <assert.h>
-# include <unistd.h>
-# include <stdio.h>
-# include <ctype.h>
-# include <stdlib.h>
-# include <string.h>
-# include <err.h>
-# include <time.h>
-# include "strfile.h"
-# include "pathnames.h"
+#include <dirent.h>
+#include <fcntl.h>
+#include <assert.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <err.h>
+#include <time.h>
+#include "strfile.h"
+#include "pathnames.h"
-# define TRUE 1
-# define FALSE 0
-# define bool short
+#define TRUE 1
+#define FALSE 0
+#define bool short
-# define MINW 6 /* minimum wait if desired */
-# define CPERS 20 /* # of chars for each sec */
-# define SLEN 160 /* # of chars in short fortune */
+#define MINW 6 /* minimum wait if desired */
+#define CPERS 20 /* # of chars for each sec */
+#define SLEN 160 /* # of chars in short fortune */
-# define POS_UNKNOWN ((off_t) -1) /* pos for file unknown */
-# define NO_PROB (-1) /* no prob specified for file */
+#define POS_UNKNOWN ((off_t) -1) /* pos for file unknown */
+#define NO_PROB (-1) /* no prob specified for file */
-# ifdef DEBUG
-# define DPRINTF(l,x) if (Debug >= l) fprintf x; else
-# undef NDEBUG
-# else
-# define DPRINTF(l,x)
-# define NDEBUG 1
-# endif
+#ifdef DEBUG
+#define DPRINTF(l,x) if (Debug >= l) fprintf x; else
+#undef NDEBUG
+#else
+#define DPRINTF(l,x)
+#define NDEBUG 1
+#endif
typedef struct fd {
int percent;
@@ -160,7 +160,7 @@
int main(int, char *[]);
-#ifndef NO_REGEX
+#ifndef NO_REGEX
static char *conv_pat(char *);
static int find_matches(void);
static void matches_in_list(FILEDESC *);
@@ -217,9 +217,9 @@
main(int ac, char *av[])
{
struct timeval tv;
-#ifdef OK_TO_WRITE_DISK
- int fd;
-#endif /* OK_TO_WRITE_DISK */
+#ifdef OK_TO_WRITE_DISK
+ int fd;
+#endif /* OK_TO_WRITE_DISK */
getargs(ac, av);
@@ -242,24 +242,24 @@
display(Fortfile);
-#ifdef OK_TO_WRITE_DISK
+#ifdef OK_TO_WRITE_DISK
if ((fd = creat(Fortfile->posfile, 0666)) < 0)
err(1, "Can't create `%s'", Fortfile->posfile);
-#ifdef LOCK_EX
+#ifdef LOCK_EX
/*
* if we can, we exclusive lock, but since it isn't very
* important, we just punt if we don't have easy locking
* available.
*/
(void) flock(fd, LOCK_EX);
-#endif /* LOCK_EX */
+#endif /* LOCK_EX */
write(fd, (char *) &Fortfile->pos, sizeof Fortfile->pos);
if (!Fortfile->was_pos_file)
(void) chmod(Fortfile->path, 0666);
-#ifdef LOCK_EX
+#ifdef LOCK_EX
(void) flock(fd, LOCK_UN);
-#endif /* LOCK_EX */
-#endif /* OK_TO_WRITE_DISK */
+#endif /* LOCK_EX */
+#endif /* OK_TO_WRITE_DISK */
if (Wait) {
if (Fort_len == 0)
(void) fortlen();
@@ -271,7 +271,7 @@
static void
rot13(char *line, int len)
{
- char *p, ch;
+ char *p, ch;
if (len == 0)
len = strlen(line);
@@ -286,7 +286,7 @@
static void
display(FILEDESC *fp)
{
- char line[BUFSIZ];
+ char line[BUFSIZ];
open_fp(fp);
(void) fseek(fp->inf, (long)Seekpts[0], SEEK_SET);
@@ -306,8 +306,8 @@
static size_t
fortlen(void)
{
- size_t nchar;
- char line[BUFSIZ];
+ size_t nchar;
+ char line[BUFSIZ];
if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED)))
nchar = Seekpts[1] - Seekpts[0];
@@ -329,15 +329,15 @@
static void
getargs(int argc, char **argv)
{
- int ignore_case;
-# ifndef NO_REGEX
- char *pat = NULL;
-# endif /* NO_REGEX */
+ int ignore_case;
+#ifndef NO_REGEX
+ char *pat = NULL;
+#endif /* NO_REGEX */
int ch;
ignore_case = FALSE;
-# ifdef DEBUG
+#ifdef DEBUG
while ((ch = getopt(argc, argv, "aDefilm:osw")) != -1)
#else
while ((ch = getopt(argc, argv, "aefilm:osw")) != -1)
@@ -346,11 +346,11 @@
case 'a': /* any fortune */
All_forts++;
break;
-# ifdef DEBUG
+#ifdef DEBUG
case 'D':
Debug++;
break;
-# endif /* DEBUG */
+#endif /* DEBUG */
case 'e':
Equal_probs++; /* scatter un-allocted prob equally */
break;
@@ -371,11 +371,11 @@
case 'w': /* give time to read */
Wait++;
break;
-# ifdef NO_REGEX
+#ifdef NO_REGEX
case 'i': /* case-insensitive match */
case 'm': /* dump out the fortunes */
errx(1, "Can't match fortunes on this system (Sorry)");
-# else /* NO_REGEX */
+#else /* NO_REGEX */
case 'm': /* dump out the fortunes */
Match++;
pat = optarg;
@@ -383,7 +383,7 @@
case 'i': /* case-insensitive match */
ignore_case++;
break;
-# endif /* NO_REGEX */
+#endif /* NO_REGEX */
case '?':
default:
usage();
@@ -402,7 +402,7 @@
exit(0);
}
-# ifndef NO_REGEX
+#ifndef NO_REGEX
if (pat != NULL) {
if (ignore_case)
pat = conv_pat(pat);
@@ -420,7 +420,7 @@
RE_FREE(Re_pat13);
}
}
-# endif /* NO_REGEX */
+#endif /* NO_REGEX */
}
/*
@@ -430,8 +430,8 @@
static int
form_file_list(char **files, int file_cnt)
{
- int i, percent;
- const char *sp;
+ int i, percent;
+ const char *sp;
if (file_cnt == 0) {
if (All_forts)
@@ -490,11 +490,11 @@
add_file(int percent, const char *file, const char *dir,
FILEDESC **head, FILEDESC **tail, FILEDESC *parent)
{
- FILEDESC *fp;
- int fd;
- const char *path;
- char *tpath, *offensive, *tfile = strdup(file), *tf;
- bool isdir;
+ FILEDESC *fp;
+ int fd;
+ const char *path;
+ char *tpath, *offensive, *tfile = strdup(file), *tf;
+ bool isdir;
if (dir == NULL) {
path = tfile;
@@ -615,9 +615,9 @@
fp->next = *head;
*head = fp;
}
-#ifdef OK_TO_WRITE_DISK
+#ifdef OK_TO_WRITE_DISK
fp->was_pos_file = (access(fp->posfile, W_OK) >= 0);
-#endif /* OK_TO_WRITE_DISK */
+#endif /* OK_TO_WRITE_DISK */
return TRUE;
}
@@ -629,7 +629,7 @@
static FILEDESC *
new_fp(void)
{
- FILEDESC *fp;
+ FILEDESC *fp;
fp = do_malloc(sizeof *fp);
fp->datfd = -1;
@@ -654,7 +654,7 @@
static char *
off_name(const char *file)
{
- char *new;
Home |
Main Index |
Thread Index |
Old Index