Print this page
1666 libwrap is 32bit only
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Garrett D'Amore <garrett.damore@dey-sys.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
   1 /*
   2  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  */
   5 #pragma ident   "%Z%%M% %I%     %E% SMI"
   6 
   7  /*
   8   * Replace %m by system error message.
   9   * 
  10   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
  11   */
  12 
  13 #ifndef lint
  14 static char sccsid[] = "@(#) percent_m.c 1.1 94/12/28 17:42:37";
  15 #endif
  16 
  17 #include <stdio.h>
  18 #include <errno.h>
  19 #include <string.h>
  20 
  21 extern int errno;
  22 #ifndef SYS_ERRLIST_DEFINED
  23 extern char *sys_errlist[];
  24 extern int sys_nerr;
  25 #endif
  26 
  27 #include "mystdarg.h"
  28 
  29 char   *percent_m(obuf, ibuf)
  30 char   *obuf;
  31 char   *ibuf;
  32 {
  33     char   *bp = obuf;
  34     char   *cp = ibuf;
  35 
  36     while (*bp = *cp)
  37         if (*cp == '%' && cp[1] == 'm') {
  38             if (errno < sys_nerr && errno > 0) {
  39                 strcpy(bp, sys_errlist[errno]);
  40             } else {
  41                 sprintf(bp, "Unknown error %d", errno);
  42             }
  43             bp += strlen(bp);
  44             cp += 2;
  45         } else {
  46             bp++, cp++;
  47         }
  48     return (obuf);
  49 }
   1 /*
   2  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  */


   5  /*
   6   * Replace %m by system error message.
   7   * 
   8   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
   9   */
  10 
  11 #ifndef lint
  12 static char sccsid[] = "@(#) percent_m.c 1.1 94/12/28 17:42:37";
  13 #endif
  14 
  15 #include <stdio.h>
  16 #include <errno.h>
  17 #include <string.h>
  18 
  19 extern int errno;




  20 
  21 #include "mystdarg.h"
  22 
  23 char   *percent_m(obuf, ibuf)
  24 char   *obuf;
  25 char   *ibuf;
  26 {
  27     char   *bp = obuf;
  28     char   *cp = ibuf;
  29 
  30     while (*bp = *cp)
  31         if (*cp == '%' && cp[1] == 'm') {
  32             strcpy(bp, strerror(errno));




  33             bp += strlen(bp);
  34             cp += 2;
  35         } else {
  36             bp++, cp++;
  37         }
  38     return (obuf);
  39 }