Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (5 years ago)
Author:
bruno
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/libbb/platform.c

    r2725 r3232  
    4343#endif
    4444
    45 #ifndef HAVE_FDPRINTF
    46 /* dprintf is now actually part of POSIX.1, but was only added in 2008 */
    47 int fdprintf(int fd, const char *format, ...)
     45#ifndef HAVE_DPRINTF
     46/* dprintf is now part of POSIX.1, but was only added in 2008 */
     47int dprintf(int fd, const char *format, ...)
    4848{
    4949    va_list p;
     
    135135}
    136136#endif
     137
     138#ifndef HAVE_STPCPY
     139char* FAST_FUNC stpcpy(char *p, const char *to_add)
     140{
     141    while ((*p = *to_add) != '\0') {
     142        p++;
     143        to_add++;
     144    }
     145    return p;
     146}
     147#endif
     148
     149#ifndef HAVE_GETLINE
     150ssize_t FAST_FUNC getline(char **lineptr, size_t *n, FILE *stream)
     151{
     152    int ch;
     153    char *line = *lineptr;
     154    size_t alloced = *n;
     155    size_t len = 0;
     156
     157    do {
     158        ch = fgetc(stream);
     159        if (ch == EOF)
     160            break;
     161        if (len + 1 >= alloced) {
     162            alloced += alloced/4 + 64;
     163            line = xrealloc(line, alloced);
     164        }
     165        line[len++] = ch;
     166    } while (ch != '\n');
     167
     168    if (len == 0)
     169        return -1;
     170
     171    line[len] = '\0';
     172    *lineptr = line;
     173    *n = alloced;
     174    return len;
     175}
     176#endif
Note: See TracChangeset for help on using the changeset viewer.