-/* $Id: man.c,v 1.85 2010/08/07 20:57:33 kristaps Exp $ */
+/* $Id: man.c,v 1.86 2010/08/08 14:51:32 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
ppos = i;
- /* Copy the first word into a nil-terminated buffer. */
-
- for (j = 0; j < 4; j++, i++)
- if ('\0' == (mac[j] = buf[i]))
- break;
- else if (' ' == buf[i])
- break;
+ /*
+ * Copy the first word into a nil-terminated buffer.
+ * Stop copying when a tab, space, or eoln is encountered.
+ */
+ j = 0;
+ while (j < 4 && '\0' != buf[i] && ' ' != buf[i] && '\t' != buf[i])
+ mac[j++] = buf[i++];
mac[j] = '\0';
if (j == 4 || j < 1) {
-/* $Id: mdoc.c,v 1.161 2010/08/07 20:57:33 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.162 2010/08/08 14:51:32 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
sv = i;
/*
- * Copy the first word into a nil-terminated buffer. Stop
- * copying when a tab, space, or eoln is encountered.
+ * Copy the first word into a nil-terminated buffer.
+ * Stop copying when a tab, space, or eoln is encountered.
*/
- for (j = 0; j < 4; j++, i++)
- if ('\0' == (mac[j] = buf[i]))
- break;
- else if (' ' == buf[i] || '\t' == buf[i])
- break;
-
+ j = 0;
+ while (j < 4 && '\0' != buf[i] && ' ' != buf[i] && '\t' != buf[i])
+ mac[j++] = buf[i++];
mac[j] = '\0';
if (j == 4 || j < 2) {