annotate lib-src/yow.c @ 25259:9f7a9dceb11b

Mostly rewritten. Customized. To support an s2G doomsday clock, speed control is added and changes are made to allow large numbers of rings: rings now show the whole ring number, not just the last digit; consecutive rings are allowed to be the same size when necessary to fit all the rings in the window; and poles can be oriented horizontally. Face support is thrown in gratuitously. (hanoi): Changed default number of rings back to 3. (hanoi-unix, hanoi-unix-64): New commands (hanoi-horizontal-flag, hanoi-move-period, hanoi-use-faces, hanoi-pole-face, hanoi-base-face, hanoi-even-ring-face, hanoi-odd-ring-face): New variables. (hanoi-internal, hanoi-current-time-float, hanoi-put-face, hanoi-n, hanoi-insert-ring, hanoi-goto-char, hanoi-sit-for, hanoi-ring-to-pos, hanoi-pos-on-tower-p): New functions. (hanoi-0): Renamed from hanoi0, for symmetry with hanoi-n. (hanoi-topos, hanoi-draw-ring): Removed.
author Karl Heuer <kwzh@gnu.org>
date Sat, 14 Aug 1999 03:24:48 +0000
parents 595856efc8f1
children c8cfb8893fac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
1 /*
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
2 * yow.c
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 *
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 * Print a quotation from Zippy the Pinhead.
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 * Qux <Kaufman-David@Yale> March 6, 1986
11183
2f57a6fbd720 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 10198
diff changeset
6 *
2f57a6fbd720 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 10198
diff changeset
7 * This file is in the public domain because the author published it
2f57a6fbd720 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 10198
diff changeset
8 * with no copyright notice before the US signed the Bern Convention.
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 *
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
10 * With dynamic memory allocation.
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 */
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
13 #include <stdio.h>
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
14 #include <ctype.h>
24408
595856efc8f1 Refer to epaths.h.
Richard M. Stallman <rms@gnu.org>
parents: 15719
diff changeset
15 #include <../src/epaths.h> /* For PATH_DATA. */
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
16
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
17 #define BUFSIZE 80
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 #define SEP '\0'
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
19
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
20 #ifndef YOW_FILE
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 #define YOW_FILE "yow.lines"
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
22 #endif
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
7820
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
24 #ifdef MSDOS
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
25 #define rootrelativepath(rel) \
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
26 ({\
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
27 static char res[BUFSIZE], *p;\
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
28 strcpy (res, argv[0]);\
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
29 p = res + strlen (res);\
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
30 while (p != res && *p != '/' && *p != '\\' && *p != ':') p--;\
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
31 strcpy (p + 1, "../");\
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
32 strcpy (p + 4, rel);\
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
33 &res;})
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
34 #endif
128950f29e66 (rootrelativepath) [MSDOS]: Define, expanding to dynamic
Richard M. Stallman <rms@gnu.org>
parents: 4702
diff changeset
35
10198
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
36 char *malloc(), *realloc();
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
37
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
38 void yow();
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
39 void setup_yow();
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
40
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 7820
diff changeset
41 int
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 main (argc, argv)
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 int argc;
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 char *argv[];
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 {
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 FILE *fp;
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 char file[BUFSIZ];
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 if (argc > 2 && !strcmp (argv[1], "-f"))
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 strcpy (file, argv[2]);
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 else
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 #ifdef vms
443
78165914b12d entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 42
diff changeset
53 sprintf (file, "%s%s", PATH_DATA, YOW_FILE);
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 #else
443
78165914b12d entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 42
diff changeset
55 sprintf (file, "%s/%s", PATH_DATA, YOW_FILE);
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 #endif
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 if ((fp = fopen(file, "r")) == NULL) {
10198
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
59 fprintf(stderr, "yow: ");
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 perror(file);
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 exit(1);
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 }
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 /* initialize random seed */
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 srand((int) (getpid() + time((long *) 0)));
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
67 setup_yow(fp);
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 yow(fp);
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 fclose(fp);
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 7820
diff changeset
70 return 0;
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 }
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
73 static long len = -1;
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
74 static long header_len;
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
75
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
76 #define AVG_LEN 40 /* average length of a quotation */
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
77
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
78 /* Sets len and header_len */
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
79 void
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
80 setup_yow(fp)
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
81 FILE *fp;
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
82 {
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
83 int c;
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
84
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
85 /* Get length of file */
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
86 /* Because the header (stuff before the first SEP) can be very long,
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
87 * thus biasing our search in favor of the first quotation in the file,
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
88 * we explicitly skip that. */
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
89 while ((c = getc(fp)) != SEP) {
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
90 if (c == EOF) {
10198
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
91 fprintf(stderr, "yow: file contains no separators\n");
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
92 exit(2);
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
93 }
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
94 }
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
95 header_len = ftell(fp);
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
96 if (header_len > AVG_LEN)
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
97 header_len -= AVG_LEN; /* allow the first quotation to appear */
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
98
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
99 if (fseek(fp, 0L, 2) == -1) {
10198
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
100 perror("yow");
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
101 exit(1);
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
102 }
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
103 len = ftell(fp) - header_len;
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
104 }
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
105
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
106
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
107 /* go to a random place in the file and print the quotation there */
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 void
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 yow (fp)
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 FILE *fp;
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 {
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 long offset;
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 int c, i = 0;
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
114 char *buf;
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
115 unsigned int bufsize;
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
117 offset = rand() % len + header_len;
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 if (fseek(fp, offset, 0) == -1) {
10198
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
119 perror("yow");
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 exit(1);
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 }
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 /* Read until SEP, read next line, print it.
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 443
diff changeset
124 (Note that we will never print anything before the first separator.)
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 If we hit EOF looking for the first SEP, just recurse. */
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 while ((c = getc(fp)) != SEP)
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 if (c == EOF) {
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 yow(fp);
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 return;
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 }
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 /* Skip leading whitespace, then read in a quotation.
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 If we hit EOF before we find a non-whitespace char, recurse. */
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 while (isspace(c = getc(fp)))
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 ;
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 if (c == EOF) {
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 yow(fp);
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 return;
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 }
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
140
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
141 bufsize = BUFSIZE;
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
142 buf = malloc(bufsize);
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
143 if (buf == (char *)0) {
10198
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
144 fprintf(stderr, "yow: virtual memory exhausted\n");
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
145 exit (3);
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
146 }
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
147
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 buf[i++] = c;
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 while ((c = getc(fp)) != SEP && c != EOF) {
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 buf[i++] = c;
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
151
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
152 if (i == bufsize-1) {
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 /* Yow! Is this quotation too long yet? */
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
154 bufsize *= 2;
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
155 buf = realloc(buf, bufsize);
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
156 if (buf == (char *)0) {
10198
aa59550d809f Include program name in error messages.
David J. MacKenzie <djm@gnu.org>
parents: 9491
diff changeset
157 fprintf(stderr, "yow: virtual memory exhausted\n");
42
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
158 exit (3);
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
159 }
71b3e30e0dd4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12
diff changeset
160 }
12
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 }
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 buf[i++] = 0;
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 printf("%s\n", buf);
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 }
4f420246a4f7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165