chiark / gitweb /
debian: Use debhelper to generate maint scripts
[userv.git] / both.c
diff --git a/both.c b/both.c
index 46cf85c73823f1ae16b49b2254a38f1f67c12faf..eed238946abde786ad04b27ef58ff418e14f0de8 100644 (file)
--- a/both.c
+++ b/both.c
@@ -4,11 +4,12 @@
  * These do not (and cannot) depend on infrastructure eg syscallerror,
  * because these are not the same.
  *
- * Copyright (C)1999 Ian Jackson
+ * userv is copyright Ian Jackson and other contributors.
+ * See README for full authorship information.
  *
  * This 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 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
@@ -17,8 +18,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with userv; if not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * along with userv; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /* Some nasty people can return 0/EOF + EINTR from stdio !
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <string.h>
 
+#include "config.h"
 #include "both.h"
 
+void *xmalloc(size_t s) {
+  void *p;
+  p= malloc(s?s:1); if (!p) syscallerror("malloc");
+  return p;
+}
+
+void *xrealloc(void *p, size_t s) {
+  p= realloc(p,s);
+  if (!p) syscallerror("realloc");
+  return p;
+}
+
+char *xstrsave(const char *s) {
+  char *r;
+
+  r= xmalloc(strlen(s)+1);
+  strcpy(r,s);
+  return r;
+}
+
+
 int working_getc(FILE *file) {
   int c;