No empty .Rs/.Re
[netbsd-mini2440.git] / usr.sbin / tcpdchk / percent_m.c
bloba5fb410a15ddfe53a0d7346d0a4966d9e9dae552
1 /* $NetBSD: percent_m.c,v 1.3 1998/05/09 17:22:09 kleink Exp $ */
3 /*
4 * Replace %m by system error message.
5 *
6 * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
7 */
9 #include <sys/cdefs.h>
10 #ifndef lint
11 #if 0
12 static char sccsid[] = "@(#) percent_m.c 1.1 94/12/28 17:42:37";
13 #else
14 __RCSID("$NetBSD: percent_m.c,v 1.3 1998/05/09 17:22:09 kleink Exp $");
15 #endif
16 #endif
18 #include <stdio.h>
19 #include <errno.h>
20 #include <string.h>
22 #ifndef SYS_ERRLIST_DEFINED
23 extern char *sys_errlist[];
24 extern int sys_nerr;
25 #endif
27 #include "mystdarg.h"
28 #include "percent_m.h"
30 char *percent_m(obuf, ibuf)
31 char *obuf;
32 const char *ibuf;
34 char *bp = obuf;
35 const char *cp = ibuf;
37 while ((*bp = *cp) != '\0')
38 if (*cp == '%' && cp[1] == 'm') {
39 strcpy(bp, strerror(errno));
40 bp += strlen(bp);
41 cp += 2;
42 } else {
43 bp++, cp++;
45 return (obuf);