home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / sup / salloc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  1.5 KB  |  49 lines

  1. /*
  2.  * Copyright (c) 1991 Carnegie Mellon University
  3.  * All Rights Reserved.
  4.  * 
  5.  * Permission to use, copy, modify and distribute this software and its
  6.  * documentation is hereby granted, provided that both the copyright
  7.  * notice and this permission notice appear in all copies of the
  8.  * software, derivative works or modified versions, and any portions
  9.  * thereof, and that both notices appear in supporting documentation.
  10.  *
  11.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  12.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  13.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  14.  *
  15.  * Carnegie Mellon requests users of this software to return to
  16.  *
  17.  *  Software Distribution Coordinator   or   Software.Distribution@CS.CMU.EDU
  18.  *  School of Computer Science
  19.  *  Carnegie Mellon University
  20.  *  Pittsburgh PA 15213-3890
  21.  *
  22.  * any improvements or extensions that they make and grant Carnegie the rights
  23.  * to redistribute these changes.
  24.  */
  25. /*
  26.  **********************************************************************
  27.  * HISTORY
  28.  * 09-Apr-87  Glenn Marcy (gm0w) at Carnegie-Mellon University
  29.  *    Changed to save length and use bcopy instead of strcpy.
  30.  *
  31.  * 02-Nov-85  Glenn Marcy (gm0w) at Carnegie-Mellon University
  32.  *    Created from routine by same name in Steve Shafer's sup program.
  33.  *
  34.  **********************************************************************
  35.  */
  36. char *malloc();
  37.  
  38. char *salloc(p)
  39. char *p;
  40. {
  41.     register char *q;
  42.     register int l;
  43.  
  44.     q = malloc(l = strlen(p) + 1);
  45.     if (q != 0)
  46.         bcopy(p, q, l);
  47.     return(q);
  48. }
  49.