]> granicus.if.org Git - sudo/commitdiff
Initial revision
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 4 Jun 1994 18:39:23 +0000 (18:39 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 4 Jun 1994 18:39:23 +0000 (18:39 +0000)
strdup.c [new file with mode: 0644]

diff --git a/strdup.c b/strdup.c
new file mode 100644 (file)
index 0000000..81265cd
--- /dev/null
+++ b/strdup.c
@@ -0,0 +1,78 @@
+/*
+ * CU sudo version 1.3.1 (based on Root Group sudo version 1.1)
+ *
+ * This software comes with no waranty whatsoever, use at your own risk.
+ *
+ * Please send bugs, changes, problems to sudo-bugs.cs.colorado.edu
+ *
+ */
+
+/*
+ *  sudo version 1.1 allows users to execute commands as root
+ *  Copyright (C) 1991  The Root Group, 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *******************************************************************
+ *
+ *  This module contains strdup() for those systems without it.
+ *
+ *  Jeff Nieusma  Thu Mar 21 23:11:23 MST 1991
+ */
+
+#ifndef lint
+static char rcsid[] = "$Id$";
+#endif /* lint */
+
+#include "config.h"
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#endif /* STDC_HEADERS */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif /* HAVE_STRING_H */
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif /* HAVE_STRINGS_H */
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif /* HAVE_MALLOC_H */
+
+#ifndef STDC_HEADERS
+extern char *malloc();
+extern char *strcpy();
+#endif /* !STDC_HEADERS */
+
+
+/******************************************************************
+ *
+ *  strdup()
+ *
+ *  this function returns a pointer a string copied into 
+ *  a malloc()ed buffer
+ */
+
+char * strdup(s1)
+    const char * s1;
+{
+    register char * s;
+
+    if ((s = (char *) malloc(strlen(s1) + 1)) == NULL)
+       return(NULL);
+
+    (void) strcpy(s, s1);
+    return(s);
+}