[BACK]Return to getcap.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / gen

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libc/gen/getcap.c between version 1.48 and 1.51

version 1.48, 2008/02/02 20:56:46 version 1.51, 2012/03/13 21:13:35
Line 52  __RCSID("$NetBSD$");
Line 52  __RCSID("$NetBSD$");
 #include <sys/param.h>  #include <sys/param.h>
   
 #include <assert.h>  #include <assert.h>
   #include <stddef.h>
 #include <ctype.h>  #include <ctype.h>
 #ifndef SMALL  #ifndef SMALL
 #include <db.h>  #include <db.h>
Line 64  __RCSID("$NetBSD$");
Line 65  __RCSID("$NetBSD$");
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
 #ifdef __weak_alias  #if defined(__weak_alias) && !defined(SMALL)
 __weak_alias(cgetcap,_cgetcap)  __weak_alias(cgetcap,_cgetcap)
 __weak_alias(cgetclose,_cgetclose)  __weak_alias(cgetclose,_cgetclose)
 __weak_alias(cgetent,_cgetent)  __weak_alias(cgetent,_cgetent)
Line 393  getent(char **cap, size_t *len, const ch
Line 394  getent(char **cap, size_t *len, const ch
                         rp = record;                          rp = record;
                         for (;;) {                          for (;;) {
                                 if (bp >= b_end) {                                  if (bp >= b_end) {
                                         int n;                                          ssize_t n;
   
                                         n = read(fd, buf, sizeof(buf));                                          n = read(fd, buf, sizeof(buf));
                                         if (n <= 0) {                                          if (n <= 0) {
Line 456  getent(char **cap, size_t *len, const ch
Line 457  getent(char **cap, size_t *len, const ch
                                  * some more.                                   * some more.
                                  */                                   */
                                 if (rp >= r_end) {                                  if (rp >= r_end) {
                                         u_int pos;                                          ptrdiff_t pos;
                                         size_t newsize;                                          size_t newsize;
   
                                         pos = rp - record;                                          pos = rp - record;
Line 518  tc_exp:
Line 519  tc_exp:
         if (expandtc) {          if (expandtc) {
                 char *newicap, *s;                  char *newicap, *s;
                 size_t ilen, newilen;                  size_t ilen, newilen;
                 int diff, iret, tclen;                  int iret;
                   ptrdiff_t diff, tclen;
                 char *icap, *scan, *tc, *tcstart, *tcend;                  char *icap, *scan, *tc, *tcstart, *tcend;
   
                 /*                  /*
Line 597  tc_exp:
Line 599  tc_exp:
                          */                           */
                         diff = newilen - tclen;                          diff = newilen - tclen;
                         if (diff >= r_end - rp) {                          if (diff >= r_end - rp) {
                                 u_int pos, tcpos, tcposend;                                  ptrdiff_t pos, tcpos, tcposend;
                                 size_t newsize;                                  size_t newsize;
   
                                 pos = rp - record;                                  pos = rp - record;
Line 789  cgetnext(char **bp, const char * const *
Line 791  cgetnext(char **bp, const char * const *
         if (dbp == NULL)          if (dbp == NULL)
                 dbp = db_array;                  dbp = db_array;
   
         if (pfp == NULL && (pfp = fopen(*dbp, "r")) == NULL) {          if (pfp == NULL && (pfp = fopen(*dbp, "re")) == NULL) {
                 (void)cgetclose();                  (void)cgetclose();
                 return -1;                  return -1;
         }          }
Line 812  cgetnext(char **bp, const char * const *
Line 814  cgetnext(char **bp, const char * const *
                                                 (void)cgetclose();                                                  (void)cgetclose();
                                                 return 0;                                                  return 0;
                                         } else if ((pfp =                                          } else if ((pfp =
                                             fopen(*dbp, "r")) == NULL) {                                              fopen(*dbp, "re")) == NULL) {
                                                 (void)cgetclose();                                                  (void)cgetclose();
                                                 return -1;                                                  return -1;
                                         } else                                          } else
Line 917  cgetstr(char *buf, const char *cap, char
Line 919  cgetstr(char *buf, const char *cap, char
         u_int m_room;          u_int m_room;
         const char *bp;          const char *bp;
         char *mp;          char *mp;
         int len;          ptrdiff_t len;
         char *mem, *newmem;          char *mem, *newmem;
   
         _DIAGASSERT(buf != NULL);          _DIAGASSERT(buf != NULL);
Line 1033  cgetstr(char *buf, const char *cap, char
Line 1035  cgetstr(char *buf, const char *cap, char
                 mem = newmem;                  mem = newmem;
         }          }
         *str = mem;          *str = mem;
         return len;          _DIAGASSERT(__type_fit(int, len));
           return (int)len;
 }  }
   
 /*  /*
Line 1052  cgetustr(char *buf, const char *cap, cha
Line 1055  cgetustr(char *buf, const char *cap, cha
         u_int m_room;          u_int m_room;
         const char *bp;          const char *bp;
         char *mp;          char *mp;
         int len;          size_t len;
         char *mem, *newmem;          char *mem, *newmem;
   
         _DIAGASSERT(buf != NULL);          _DIAGASSERT(buf != NULL);
Line 1117  cgetustr(char *buf, const char *cap, cha
Line 1120  cgetustr(char *buf, const char *cap, cha
                 mem = newmem;                  mem = newmem;
         }          }
         *str = mem;          *str = mem;
         return len;          _DIAGASSERT(__type_fit(int, len));
           return (int)len;
 }  }
   
 /*  /*

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.51

CVSweb <webmaster@jp.NetBSD.org>