Add define for Kirk Smith's USR Courier driver. Change default baud
[unix-history] / usr / src / usr.bin / window / string.c
index 2b82f5e..dd781fa 100644 (file)
@@ -1,7 +1,13 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)string.c    3.5 84/03/23";
+static char sccsid[] = "@(#)string.c   3.8 %G%";
 #endif
 
 #endif
 
+/*
+ * Copyright (c) 1983 Regents of the University of California,
+ * All rights reserved.  Redistribution permitted subject to
+ * the terms of the Berkeley Software License Agreement.
+ */
+
 #include "string.h"
 
 char *malloc();
 #include "string.h"
 
 char *malloc();
@@ -22,6 +28,26 @@ register char *s;
        return str;
 }
 
        return str;
 }
 
+char *
+str_ncpy(s, n)
+register char *s;
+register n;
+{
+       int l = strlen(s);
+       char *str;
+       register char *p;
+
+       if (n > l)
+               n = l;
+       str = p = str_alloc(n + 1);
+       if (p == 0)
+               return 0;
+       while (--n >= 0)
+               *p++ = *s++;
+       *p = 0;
+       return str;
+}
+
 char *
 str_itoa(i)
 int i;
 char *
 str_itoa(i)
 int i;