[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS gsasl/lib/gl
From: |
gsasl-commit |
Subject: |
CVS gsasl/lib/gl |
Date: |
Sat, 01 Jan 2005 17:04:52 +0100 |
Update of /home/cvs/gsasl/lib/gl
In directory dopio:/tmp/cvs-serv19981/gl
Modified Files:
Makefile.am
Added Files:
lgetdelim.c lgetdelim.h lgetline.c lgetline.h
Log Message:
Update.
--- /home/cvs/gsasl/lib/gl/Makefile.am 2004/12/19 03:33:07 1.17
+++ /home/cvs/gsasl/lib/gl/Makefile.am 2005/01/01 16:04:52 1.18
@@ -8,8 +8,8 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Invoked as: gnulib-tool --import
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgl --source-base=gl
--m4-base=gl/m4 --libtool --lgpl alloca-opt base64 gettext restrict stdbool
strdup vasnprintf vasprintf xsize
+# Invoked as: gnulib-tool --import --automatic-prototypes
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgl --source-base=gl
--m4-base=gl/m4 --libtool --lgpl alloca-opt base64 gettext lgetdelim lgetline
restrict size_max stdbool strdup vasnprintf vasprintf xsize
AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies
@@ -52,6 +52,18 @@
## end gnulib module gettext
+## begin gnulib module lgetdelim
+
+libgl_la_SOURCES += lgetdelim.h
+
+## end gnulib module lgetdelim
+
+## begin gnulib module lgetline
+
+libgl_la_SOURCES += lgetline.h
+
+## end gnulib module lgetline
+
## begin gnulib module stdbool
BUILT_SOURCES += $(STDBOOL_H)
--- /home/cvs/gsasl/lib/gl/lgetdelim.c 2005/01/01 16:04:52 NONE
+++ /home/cvs/gsasl/lib/gl/lgetdelim.c 2005/01/01 16:04:52 1.1
/* Copyright (C) 2004 Simon Josefsson
Copyright (C) 1994,1996,1997,1998,2001,2003 Free Software Foundation, Inc.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this file; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#include <stdlib.h>
#include <string.h>
#include <errno.h>
/* Read up to (and including) a TERMINATOR from FP into *LINEPTR
(and null-terminate it). *LINEPTR is a pointer returned from malloc (or
NULL), pointing to *N characters of space. It is realloc'ed as
necessary. Returns the number of characters read (not including the
null terminator), or -1 on error or EOF. */
ssize_t
getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
{
int result;
ssize_t cur_len = 0;
ssize_t len;
if (lineptr == NULL || n == NULL)
return -1;
if (*lineptr == NULL || *n == 0)
{
*n = 120;
*lineptr = (char *) malloc (*n);
if (*lineptr == NULL)
return -1;
}
for (;;)
{
size_t needed;
char *t;
int i;
i = getc (fp);
if (i == EOF)
break;
/* Make enough space for len+1 (for final NUL) bytes. */
needed = cur_len + 1;
if (needed > *n)
{
char *new_lineptr;
if (needed < 2 * *n)
needed = 2 * *n; /* Be generous. */
new_lineptr = (char *) realloc (*lineptr, needed);
if (new_lineptr == NULL)
return -1;
*lineptr = new_lineptr;
*n = needed;
}
(*lineptr)[cur_len] = c;
cur_len++;
}
(*lineptr)[cur_len] = '\0';
return cur_len;
}
--- /home/cvs/gsasl/lib/gl/lgetdelim.h 2005/01/01 16:04:52 NONE
+++ /home/cvs/gsasl/lib/gl/lgetdelim.h 2005/01/01 16:04:52 1.1
/* Copyright (C) 2004 Simon Josefsson
The file is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this file; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#ifndef GETDELIM_H_
# define GETDELIM_H_
/* Get getdelim, if available. */
#include <stdio.h>
#if defined HAVE_DECL_GETDELIM && !HAVE_DECL_GETDELIM
/* Read up to (and including) a TERMINATOR from FP into *LINEPTR
(and null-terminate it). *LINEPTR is a pointer returned from malloc (or
NULL), pointing to *N characters of space. It is realloc'ed as
necessary. Returns the number of characters read (not including the
null terminator), or -1 on error or EOF. */
ssize_t
getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp);
#endif
#endif /* GETDELIM_H_ */
--- /home/cvs/gsasl/lib/gl/lgetline.c 2005/01/01 16:04:52 NONE
+++ /home/cvs/gsasl/lib/gl/lgetline.c 2005/01/01 16:04:52 1.1
/* Copyright (C) 2004 Simon Josefsson
Copyright (C) 1991, 1992, 1995, 1996, 1997, 2004
Free Software Foundation, Inc.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this file; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#include <stddef.h>
#include <stdio.h>
/* Like getdelim, but always looks for a newline. */
ssize_t
getline (char **lineptr, size_t *n, FILE *stream)
{
return getdelim (lineptr, n, '\n', stream);
}
--- /home/cvs/gsasl/lib/gl/lgetline.h 2005/01/01 16:04:52 NONE
+++ /home/cvs/gsasl/lib/gl/lgetline.h 2005/01/01 16:04:52 1.1
/* Copyright (C) 2004 Simon Josefsson
The file is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this file; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#ifndef GETLINE_H_
# define GETLINE_H_
/* Get getline, if available. */
#include <stdio.h>
#if defined HAVE_DECL_GETLINE && !HAVE_DECL_GETLINE
/* Like getdelim, but always looks for a newline. */
ssize_t getline (char **lineptr, size_t *n, FILE *stream);
#endif
#endif /* GETLINE_H_ */