| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: deroff.c,v 1.7 2009/08/07 14:05:58 wiz Exp $ */ | | 1 | /* $NetBSD: deroff.c,v 1.8 2011/05/24 12:19:11 joerg Exp $ */ |
2 | | | 2 | |
3 | /* taken from: OpenBSD: deroff.c,v 1.6 2004/06/02 14:58:46 tom Exp */ | | 3 | /* taken from: OpenBSD: deroff.c,v 1.6 2004/06/02 14:58:46 tom Exp */ |
4 | | | 4 | |
5 | /*- | | 5 | /*- |
6 | * Copyright (c) 1988, 1993 | | 6 | * Copyright (c) 1988, 1993 |
7 | * The Regents of the University of California. All rights reserved. | | 7 | * The Regents of the University of California. All rights reserved. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -64,27 +64,27 @@ | | | @@ -64,27 +64,27 @@ |
64 | * POSSIBILITY OF SUCH DAMAGE. | | 64 | * POSSIBILITY OF SUCH DAMAGE. |
65 | */ | | 65 | */ |
66 | | | 66 | |
67 | #ifndef lint | | 67 | #ifndef lint |
68 | static const char copyright[] = | | 68 | static const char copyright[] = |
69 | "@(#) Copyright (c) 1988, 1993\n\ | | 69 | "@(#) Copyright (c) 1988, 1993\n\ |
70 | The Regents of the University of California. All rights reserved.\n"; | | 70 | The Regents of the University of California. All rights reserved.\n"; |
71 | #endif /* not lint */ | | 71 | #endif /* not lint */ |
72 | | | 72 | |
73 | #ifndef lint | | 73 | #ifndef lint |
74 | #if 0 | | 74 | #if 0 |
75 | static const char sccsid[] = "@(#)deroff.c 8.1 (Berkeley) 6/6/93"; | | 75 | static const char sccsid[] = "@(#)deroff.c 8.1 (Berkeley) 6/6/93"; |
76 | #else | | 76 | #else |
77 | static const char rcsid[] = "$NetBSD: deroff.c,v 1.7 2009/08/07 14:05:58 wiz Exp $"; | | 77 | static const char rcsid[] = "$NetBSD: deroff.c,v 1.8 2011/05/24 12:19:11 joerg Exp $"; |
78 | #endif | | 78 | #endif |
79 | #endif /* not lint */ | | 79 | #endif /* not lint */ |
80 | | | 80 | |
81 | #include <sys/cdefs.h> | | 81 | #include <sys/cdefs.h> |
82 | #include <err.h> | | 82 | #include <err.h> |
83 | #include <limits.h> | | 83 | #include <limits.h> |
84 | #include <stddef.h> | | 84 | #include <stddef.h> |
85 | #include <stdio.h> | | 85 | #include <stdio.h> |
86 | #include <stdlib.h> | | 86 | #include <stdlib.h> |
87 | #include <string.h> | | 87 | #include <string.h> |
88 | #include <unistd.h> | | 88 | #include <unistd.h> |
89 | | | 89 | |
90 | /* | | 90 | /* |
| @@ -988,27 +988,27 @@ meputmac(char *cp, int constant) | | | @@ -988,27 +988,27 @@ meputmac(char *cp, int constant) |
988 | putchar(*p); | | 988 | putchar(*p); |
989 | } | | 989 | } |
990 | printf("]"); | | 990 | printf("]"); |
991 | } | | 991 | } |
992 | #endif /* FULLDEBUG */ | | 992 | #endif /* FULLDEBUG */ |
993 | /* | | 993 | /* |
994 | * Determine if the argument merits being printed | | 994 | * Determine if the argument merits being printed |
995 | * | | 995 | * |
996 | * constant is the cut off point below which something | | 996 | * constant is the cut off point below which something |
997 | * is not a word. | | 997 | * is not a word. |
998 | */ | | 998 | */ |
999 | if (((np - cp) > constant) && | | 999 | if (((np - cp) > constant) && |
1000 | (inquote || (chars[(unsigned char)cp[0]] == LETTER))) { | | 1000 | (inquote || (chars[(unsigned char)cp[0]] == LETTER))) { |
1001 | for (cp = cp; cp < np; cp++) | | 1001 | for (; cp < np; cp++) |
1002 | putchar(*cp); | | 1002 | putchar(*cp); |
1003 | last = np[-1]; | | 1003 | last = np[-1]; |
1004 | found++; | | 1004 | found++; |
1005 | } else if (found && (np - cp == 1) && | | 1005 | } else if (found && (np - cp == 1) && |
1006 | chars[(unsigned char)*cp] == PUNCT) { | | 1006 | chars[(unsigned char)*cp] == PUNCT) { |
1007 | putchar(*cp); | | 1007 | putchar(*cp); |
1008 | } else { | | 1008 | } else { |
1009 | last = np[-1]; | | 1009 | last = np[-1]; |
1010 | } | | 1010 | } |
1011 | cp = np; | | 1011 | cp = np; |
1012 | } | | 1012 | } |
1013 | if (msflag && chars[last] == PUNCT) | | 1013 | if (msflag && chars[last] == PUNCT) |
1014 | putchar(last); | | 1014 | putchar(last); |