[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] [PATCH] New strchrnul module
From: |
Simon Josefsson |
Subject: |
[Bug-gnulib] [PATCH] New strchrnul module |
Date: |
Tue, 10 Jun 2003 10:08:38 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
This adds a new module for strchrnul(), which is a GNU extension, that
argp() needs.
2003-06-10 Simon Josefsson <address@hidden>
* modules/strchrnul: Add.
* strchrnul.m4: Add.
* strchrnul.c, strchrnul.h: Add.
Index: modules/strchrnul
===================================================================
RCS file: modules/strchrnul
diff -N modules/strchrnul
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/strchrnul 10 Jun 2003 08:02:25 -0000
@@ -0,0 +1,20 @@
+Description:
+strchrnul(): Find the first occurrence of C in S or the final NUL byte.
+
+Files:
+lib/strchrnul.h
+lib/strchrnul.c
+m4/strchrnul.m4
+
+Depends-on:
+
+configure.ac:
+gl_FUNC_STRCHRNUL
+
+Makefile.am:
+
+Include:
+"strchrnul.h"
+
+Maintainer:
+FSF
Index: m4/strchrnul.m4
===================================================================
RCS file: m4/strchrnul.m4
diff -N m4/strchrnul.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ m4/strchrnul.m4 10 Jun 2003 08:02:25 -0000
@@ -0,0 +1,20 @@
+# strchrnul.m4 serial 1
+dnl Copyright (C) 2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_STRCHRNUL],
+[
+ AC_REPLACE_FUNCS(strchrnul)
+ if test $ac_cv_func_strchrnul = no; then
+ gl_PREREQ_STRCHRNUL
+ fi
+])
+
+# Prerequisites of lib/strchrnul.c.
+AC_DEFUN([gl_PREREQ_STRCHRNUL], [
+ AC_CHECK_HEADERS_ONCE(string.h)
+])
Index: lib/strchrnul.h
===================================================================
RCS file: lib/strchrnul.h
diff -N lib/strchrnul.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/strchrnul.h 10 Jun 2003 08:02:25 -0000
@@ -0,0 +1,28 @@
+/* Searching in a string.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if HAVE_STRCHRNUL
+
+/* Get strchrnul() declaration. */
+#include <string.h>
+
+#else
+
+/* Find the first occurrence of C in S or the final NUL byte. */
+extern char *strchrnul (const char *s, int c_in);
+
+#endif
Index: lib/strchrnul.c
===================================================================
RCS file: lib/strchrnul.c
diff -N lib/strchrnul.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/strchrnul.c 10 Jun 2003 08:02:25 -0000
@@ -0,0 +1,28 @@
+/* Searching in a string.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Find the first occurrence of C in S or the final NUL byte. */
+char *
+strchrnul (s, c_in)
+ const char *s;
+ int c_in;
+{
+ while (*s && (*s != c_in))
+ s++;
+
+ return (char*) s;
+}
- [Bug-gnulib] [PATCH] New strchrnul module,
Simon Josefsson <=