[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.24.1 and 1.52

version 1.48.24.1, 2011/02/08 16:18:59 version 1.52, 2012/06/04 20:56:40
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 159  cgetset(const char *ent)
Line 160  cgetset(const char *ent)
  * return NULL.   * return NULL.
  */   */
 char *  char *
 cgetcap(buf, cap, type)  cgetcap(char *buf, const char *cap, int type)
         char *buf;  
         const char *cap;  
         int type;  
 {  {
         char *bp;          char *bp;
         const char *cp;          const char *cp;
Line 393  getent(char **cap, size_t *len, const ch
Line 391  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 454  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 516  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 596  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 788  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 811  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 916  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 1032  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 1052  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 1117  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.24.1  
changed lines
  Added in v.1.52

CVSweb <webmaster@jp.NetBSD.org>