=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/diff.c,v retrieving revision 1.12 retrieving revision 1.13 diff -c -r1.12 -r1.13 *** src/usr.bin/rcs/diff.c 2007/02/27 07:59:13 1.12 --- src/usr.bin/rcs/diff.c 2007/03/27 07:21:21 1.13 *************** *** 1,4 **** ! /* $OpenBSD: diff.c,v 1.12 2007/02/27 07:59:13 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: diff.c,v 1.13 2007/03/27 07:21:21 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. *************** *** 229,235 **** static struct context_vec *context_vec_end; static struct context_vec *context_vec_ptr; ! #define FUNCTION_CONTEXT_SIZE 41 static char lastbuf[FUNCTION_CONTEXT_SIZE]; static int lastline; static int lastmatchline; --- 229,235 ---- static struct context_vec *context_vec_end; static struct context_vec *context_vec_ptr; ! #define FUNCTION_CONTEXT_SIZE 55 static char lastbuf[FUNCTION_CONTEXT_SIZE]; static int lastline; static int lastmatchline; *************** *** 1175,1180 **** --- 1175,1182 ---- return (1); } + #define begins_with(s, pre) (strncmp(s, pre, sizeof(pre)-1) == 0) + static char* match_function(const long *f, int pos, FILE *fp) { *************** *** 1182,1187 **** --- 1184,1190 ---- size_t nc; int last = lastline; char *p; + char *state = NULL; lastline = pos; while (pos > last) { *************** *** 1196,1206 **** if (p != NULL) *p = '\0'; if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { ! if (strlcpy(lastbuf, (const char *)buf, ! sizeof(lastbuf)) >= sizeof(lastbuf)) ! errx(1, "match_function: strlcpy"); ! lastmatchline = pos; ! return lastbuf; } } pos--; --- 1199,1221 ---- if (p != NULL) *p = '\0'; if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { ! if (begins_with(buf, "private:")) { ! if (!state) ! state = " (private)"; ! } else if (begins_with(buf, "protected:")) { ! if (!state) ! state = " (protected)"; ! } else if (begins_with(buf, "public:")) { ! if (!state) ! state = " (public)"; ! } else { ! if (strlcpy(lastbuf, (const char *)buf, ! sizeof(lastbuf)) >= sizeof(lastbuf)) ! errx(1, ! "match_function: strlcpy"); ! lastmatchline = pos; ! return lastbuf; ! } } } pos--;