1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright 2000 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate * Use is subject to license terms. 4*0Sstevel@tonic-gate */ 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 7*0Sstevel@tonic-gate /* All Rights Reserved */ 8*0Sstevel@tonic-gate 9*0Sstevel@tonic-gate /* 10*0Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California. 11*0Sstevel@tonic-gate * All rights reserved. The Berkeley Software License Agreement 12*0Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 13*0Sstevel@tonic-gate */ 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gate #include "sh.h" 18*0Sstevel@tonic-gate #include "sh.tconst.h" 19*0Sstevel@tonic-gate #include <fcntl.h> 20*0Sstevel@tonic-gate #include <unistd.h> 21*0Sstevel@tonic-gate 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * C Shell 24*0Sstevel@tonic-gate */ 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate any(c, s) 27*0Sstevel@tonic-gate register int c; 28*0Sstevel@tonic-gate register tchar *s; 29*0Sstevel@tonic-gate { 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate while (s && *s) 32*0Sstevel@tonic-gate if (*s++ == c) 33*0Sstevel@tonic-gate return (1); 34*0Sstevel@tonic-gate return (0); 35*0Sstevel@tonic-gate } 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate onlyread(cp) 38*0Sstevel@tonic-gate tchar *cp; 39*0Sstevel@tonic-gate { 40*0Sstevel@tonic-gate extern char end[]; 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate return ((char *)cp < end); 43*0Sstevel@tonic-gate } 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate /* 47*0Sstevel@tonic-gate * WARNING: changes here also need to occur in the XFREE macro in sh.h. 48*0Sstevel@tonic-gate */ 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate xfree(cp) 51*0Sstevel@tonic-gate char *cp; 52*0Sstevel@tonic-gate { 53*0Sstevel@tonic-gate extern char end[]; 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate #if defined(sparc) 56*0Sstevel@tonic-gate if ((char *)cp >= end && (char *)cp < (char *)&cp) 57*0Sstevel@tonic-gate free(cp); 58*0Sstevel@tonic-gate #elif defined(i386) 59*0Sstevel@tonic-gate if ((char *)cp >= end) 60*0Sstevel@tonic-gate free(cp); 61*0Sstevel@tonic-gate #else 62*0Sstevel@tonic-gate #error xfree function is machine dependent and no machine type is recognized 63*0Sstevel@tonic-gate #endif 64*0Sstevel@tonic-gate } 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate tchar * 67*0Sstevel@tonic-gate savestr(s) 68*0Sstevel@tonic-gate register tchar *s; 69*0Sstevel@tonic-gate { 70*0Sstevel@tonic-gate tchar *n; 71*0Sstevel@tonic-gate register tchar *p; 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate if (s == 0) 74*0Sstevel@tonic-gate s = S_ /* "" */; 75*0Sstevel@tonic-gate #ifndef m32 76*0Sstevel@tonic-gate for (p = s; *p++; ) 77*0Sstevel@tonic-gate ; 78*0Sstevel@tonic-gate n = p = (tchar *)xalloc((unsigned) (p - s)*sizeof (tchar)); 79*0Sstevel@tonic-gate while (*p++ = *s++) 80*0Sstevel@tonic-gate ; 81*0Sstevel@tonic-gate return (n); 82*0Sstevel@tonic-gate #else 83*0Sstevel@tonic-gate p = (tchar *) xalloc((strlen_(s) + 1)*sizeof (tchar)); 84*0Sstevel@tonic-gate strcpy_(p, s); 85*0Sstevel@tonic-gate return (p); 86*0Sstevel@tonic-gate #endif 87*0Sstevel@tonic-gate } 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate void * 90*0Sstevel@tonic-gate calloc(i, j) 91*0Sstevel@tonic-gate register unsigned i; 92*0Sstevel@tonic-gate unsigned j; 93*0Sstevel@tonic-gate { 94*0Sstevel@tonic-gate register char *cp; 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate i *= j; 97*0Sstevel@tonic-gate cp = (char *)xalloc(i); 98*0Sstevel@tonic-gate bzero(cp, (int)i); 99*0Sstevel@tonic-gate return (cp); 100*0Sstevel@tonic-gate } 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate nomem(i) 103*0Sstevel@tonic-gate unsigned i; 104*0Sstevel@tonic-gate { 105*0Sstevel@tonic-gate #ifdef debug 106*0Sstevel@tonic-gate static tchar *av[2] = {0, 0}; 107*0Sstevel@tonic-gate #endif 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate child++; 110*0Sstevel@tonic-gate #ifndef debug 111*0Sstevel@tonic-gate error("Out of memory"); 112*0Sstevel@tonic-gate #ifdef lint 113*0Sstevel@tonic-gate i = i; 114*0Sstevel@tonic-gate #endif 115*0Sstevel@tonic-gate #else 116*0Sstevel@tonic-gate showall(av); 117*0Sstevel@tonic-gate printf("i=%d: Out of memory\n", i); 118*0Sstevel@tonic-gate chdir("/usr/bill/cshcore"); 119*0Sstevel@tonic-gate abort(); 120*0Sstevel@tonic-gate #endif 121*0Sstevel@tonic-gate return (0); /* fool lint */ 122*0Sstevel@tonic-gate } 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate tchar ** 125*0Sstevel@tonic-gate blkend(up) 126*0Sstevel@tonic-gate register tchar **up; 127*0Sstevel@tonic-gate { 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate while (*up) 130*0Sstevel@tonic-gate up++; 131*0Sstevel@tonic-gate return (up); 132*0Sstevel@tonic-gate } 133*0Sstevel@tonic-gate 134*0Sstevel@tonic-gate blkpr(av) 135*0Sstevel@tonic-gate register tchar **av; 136*0Sstevel@tonic-gate { 137*0Sstevel@tonic-gate 138*0Sstevel@tonic-gate for (; *av; av++) { 139*0Sstevel@tonic-gate printf("%t", *av); 140*0Sstevel@tonic-gate if (av[1]) 141*0Sstevel@tonic-gate printf(" "); 142*0Sstevel@tonic-gate } 143*0Sstevel@tonic-gate } 144*0Sstevel@tonic-gate 145*0Sstevel@tonic-gate blklen(av) 146*0Sstevel@tonic-gate register tchar **av; 147*0Sstevel@tonic-gate { 148*0Sstevel@tonic-gate register int i = 0; 149*0Sstevel@tonic-gate 150*0Sstevel@tonic-gate while (*av++) 151*0Sstevel@tonic-gate i++; 152*0Sstevel@tonic-gate return (i); 153*0Sstevel@tonic-gate } 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gate tchar ** 156*0Sstevel@tonic-gate blkcpy(oav, bv) 157*0Sstevel@tonic-gate tchar **oav; 158*0Sstevel@tonic-gate register tchar **bv; 159*0Sstevel@tonic-gate { 160*0Sstevel@tonic-gate register tchar **av = oav; 161*0Sstevel@tonic-gate 162*0Sstevel@tonic-gate while (*av++ = *bv++) 163*0Sstevel@tonic-gate continue; 164*0Sstevel@tonic-gate return (oav); 165*0Sstevel@tonic-gate } 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate tchar ** 168*0Sstevel@tonic-gate blkcat(up, vp) 169*0Sstevel@tonic-gate tchar **up, **vp; 170*0Sstevel@tonic-gate { 171*0Sstevel@tonic-gate 172*0Sstevel@tonic-gate (void) blkcpy(blkend(up), vp); 173*0Sstevel@tonic-gate return (up); 174*0Sstevel@tonic-gate } 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate blkfree(av0) 177*0Sstevel@tonic-gate tchar **av0; 178*0Sstevel@tonic-gate { 179*0Sstevel@tonic-gate register tchar **av = av0; 180*0Sstevel@tonic-gate 181*0Sstevel@tonic-gate for (; *av; av++) 182*0Sstevel@tonic-gate XFREE(*av) 183*0Sstevel@tonic-gate XFREE((tchar *)av0) 184*0Sstevel@tonic-gate } 185*0Sstevel@tonic-gate 186*0Sstevel@tonic-gate tchar ** 187*0Sstevel@tonic-gate saveblk(v) 188*0Sstevel@tonic-gate register tchar **v; 189*0Sstevel@tonic-gate { 190*0Sstevel@tonic-gate register tchar **newv = 191*0Sstevel@tonic-gate (tchar **) calloc((unsigned) (blklen(v) + 1), 192*0Sstevel@tonic-gate sizeof (tchar **)); 193*0Sstevel@tonic-gate tchar **onewv = newv; 194*0Sstevel@tonic-gate 195*0Sstevel@tonic-gate while (*v) 196*0Sstevel@tonic-gate *newv++ = savestr(*v++); 197*0Sstevel@tonic-gate return (onewv); 198*0Sstevel@tonic-gate } 199*0Sstevel@tonic-gate 200*0Sstevel@tonic-gate tchar * 201*0Sstevel@tonic-gate strspl(cp, dp) 202*0Sstevel@tonic-gate tchar *cp, *dp; 203*0Sstevel@tonic-gate { 204*0Sstevel@tonic-gate tchar *ep; 205*0Sstevel@tonic-gate register tchar *p, *q; 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate #ifndef m32 208*0Sstevel@tonic-gate for (p = cp; *p++; ) 209*0Sstevel@tonic-gate ; 210*0Sstevel@tonic-gate for (q = dp; *q++; ) 211*0Sstevel@tonic-gate ; 212*0Sstevel@tonic-gate ep = (tchar *) xalloc((unsigned) (((p - cp) + 213*0Sstevel@tonic-gate (q - dp) - 1))*sizeof (tchar)); 214*0Sstevel@tonic-gate for (p = ep, q = cp; *p++ = *q++; ) 215*0Sstevel@tonic-gate ; 216*0Sstevel@tonic-gate for (p--, q = dp; *p++ = *q++; ) 217*0Sstevel@tonic-gate ; 218*0Sstevel@tonic-gate #else 219*0Sstevel@tonic-gate int len1 = strlen_(cp); 220*0Sstevel@tonic-gate int len2 = strlen_(dp); 221*0Sstevel@tonic-gate 222*0Sstevel@tonic-gate ep = (tchar *)xalloc((unsigned) (len1 + len2 + 1)*sizeof (tchar)); 223*0Sstevel@tonic-gate strcpy_(ep, cp); 224*0Sstevel@tonic-gate strcat_(ep, dp); 225*0Sstevel@tonic-gate #endif 226*0Sstevel@tonic-gate return (ep); 227*0Sstevel@tonic-gate } 228*0Sstevel@tonic-gate 229*0Sstevel@tonic-gate tchar ** 230*0Sstevel@tonic-gate blkspl(up, vp) 231*0Sstevel@tonic-gate register tchar **up, **vp; 232*0Sstevel@tonic-gate { 233*0Sstevel@tonic-gate register tchar **wp = 234*0Sstevel@tonic-gate (tchar **) calloc((unsigned) (blklen(up) + blklen(vp) + 1), 235*0Sstevel@tonic-gate sizeof (tchar **)); 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate (void) blkcpy(wp, up); 238*0Sstevel@tonic-gate return (blkcat(wp, vp)); 239*0Sstevel@tonic-gate } 240*0Sstevel@tonic-gate 241*0Sstevel@tonic-gate lastchr(cp) 242*0Sstevel@tonic-gate register tchar *cp; 243*0Sstevel@tonic-gate { 244*0Sstevel@tonic-gate 245*0Sstevel@tonic-gate if (!*cp) 246*0Sstevel@tonic-gate return (0); 247*0Sstevel@tonic-gate while (cp[1]) 248*0Sstevel@tonic-gate cp++; 249*0Sstevel@tonic-gate return (*cp); 250*0Sstevel@tonic-gate } 251*0Sstevel@tonic-gate 252*0Sstevel@tonic-gate donefds() 253*0Sstevel@tonic-gate { 254*0Sstevel@tonic-gate (void) close(0); 255*0Sstevel@tonic-gate (void) close(1); 256*0Sstevel@tonic-gate (void) close(2); 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gate /* 259*0Sstevel@tonic-gate * To avoid NIS+ functions to get hold of 0/1/2, 260*0Sstevel@tonic-gate * use descriptor 0, and dup it to 1 and 2. 261*0Sstevel@tonic-gate */ 262*0Sstevel@tonic-gate open("/dev/null", 0); 263*0Sstevel@tonic-gate dup(0); dup(0); 264*0Sstevel@tonic-gate didfds = 0; 265*0Sstevel@tonic-gate } 266*0Sstevel@tonic-gate 267*0Sstevel@tonic-gate /* 268*0Sstevel@tonic-gate * Move descriptor i to j. 269*0Sstevel@tonic-gate * If j is -1 then we just want to get i to a safe place, 270*0Sstevel@tonic-gate * i.e. to a unit > 2. This also happens in dcopy. 271*0Sstevel@tonic-gate */ 272*0Sstevel@tonic-gate dmove(i, j) 273*0Sstevel@tonic-gate register int i, j; 274*0Sstevel@tonic-gate { 275*0Sstevel@tonic-gate int fd; 276*0Sstevel@tonic-gate 277*0Sstevel@tonic-gate if (i == j || i < 0) 278*0Sstevel@tonic-gate return (i); 279*0Sstevel@tonic-gate if (j >= 0) { 280*0Sstevel@tonic-gate fd = dup2(i, j); 281*0Sstevel@tonic-gate if (fd != -1) 282*0Sstevel@tonic-gate setfd(fd); 283*0Sstevel@tonic-gate } else 284*0Sstevel@tonic-gate j = dcopy(i, j); 285*0Sstevel@tonic-gate if (j != i) { 286*0Sstevel@tonic-gate (void) close(i); 287*0Sstevel@tonic-gate unsetfd(i); 288*0Sstevel@tonic-gate } 289*0Sstevel@tonic-gate return (j); 290*0Sstevel@tonic-gate } 291*0Sstevel@tonic-gate 292*0Sstevel@tonic-gate dcopy(i, j) 293*0Sstevel@tonic-gate register int i, j; 294*0Sstevel@tonic-gate { 295*0Sstevel@tonic-gate 296*0Sstevel@tonic-gate int fd; 297*0Sstevel@tonic-gate 298*0Sstevel@tonic-gate if (i == j || i < 0 || j < 0 && i > 2) 299*0Sstevel@tonic-gate return (i); 300*0Sstevel@tonic-gate if (j >= 0) { 301*0Sstevel@tonic-gate fd = dup2(i, j); 302*0Sstevel@tonic-gate if (fd != -1) 303*0Sstevel@tonic-gate setfd(fd); 304*0Sstevel@tonic-gate return (j); 305*0Sstevel@tonic-gate } 306*0Sstevel@tonic-gate (void) close(j); 307*0Sstevel@tonic-gate unsetfd(j); 308*0Sstevel@tonic-gate return (renum(i, j)); 309*0Sstevel@tonic-gate } 310*0Sstevel@tonic-gate 311*0Sstevel@tonic-gate renum(i, j) 312*0Sstevel@tonic-gate register int i, j; 313*0Sstevel@tonic-gate { 314*0Sstevel@tonic-gate register int k = dup(i); 315*0Sstevel@tonic-gate 316*0Sstevel@tonic-gate if (k < 0) 317*0Sstevel@tonic-gate return (-1); 318*0Sstevel@tonic-gate if (j == -1 && k > 2) { 319*0Sstevel@tonic-gate setfd(k); 320*0Sstevel@tonic-gate return (k); 321*0Sstevel@tonic-gate } 322*0Sstevel@tonic-gate if (k != j) { 323*0Sstevel@tonic-gate j = renum(k, j); 324*0Sstevel@tonic-gate (void) close(k); /* no need ofr unsetfd() */ 325*0Sstevel@tonic-gate return (j); 326*0Sstevel@tonic-gate } 327*0Sstevel@tonic-gate return (k); 328*0Sstevel@tonic-gate } 329*0Sstevel@tonic-gate 330*0Sstevel@tonic-gate #ifndef copy 331*0Sstevel@tonic-gate copy(to, from, size) 332*0Sstevel@tonic-gate register tchar *to, *from; 333*0Sstevel@tonic-gate register int size; 334*0Sstevel@tonic-gate { 335*0Sstevel@tonic-gate 336*0Sstevel@tonic-gate if (size) 337*0Sstevel@tonic-gate do 338*0Sstevel@tonic-gate *to++ = *from++; 339*0Sstevel@tonic-gate while (--size != 0); 340*0Sstevel@tonic-gate } 341*0Sstevel@tonic-gate #endif 342*0Sstevel@tonic-gate 343*0Sstevel@tonic-gate /* 344*0Sstevel@tonic-gate * Left shift a command argument list, discarding 345*0Sstevel@tonic-gate * the first c arguments. Used in "shift" commands 346*0Sstevel@tonic-gate * as well as by commands like "repeat". 347*0Sstevel@tonic-gate */ 348*0Sstevel@tonic-gate lshift(v, c) 349*0Sstevel@tonic-gate register tchar **v; 350*0Sstevel@tonic-gate register int c; 351*0Sstevel@tonic-gate { 352*0Sstevel@tonic-gate register tchar **u = v; 353*0Sstevel@tonic-gate 354*0Sstevel@tonic-gate while (*u && --c >= 0) 355*0Sstevel@tonic-gate xfree(*u++); 356*0Sstevel@tonic-gate (void) blkcpy(v, u); 357*0Sstevel@tonic-gate } 358*0Sstevel@tonic-gate 359*0Sstevel@tonic-gate number(cp) 360*0Sstevel@tonic-gate tchar *cp; 361*0Sstevel@tonic-gate { 362*0Sstevel@tonic-gate 363*0Sstevel@tonic-gate if (*cp == '-') { 364*0Sstevel@tonic-gate cp++; 365*0Sstevel@tonic-gate if (!digit(*cp++)) 366*0Sstevel@tonic-gate return (0); 367*0Sstevel@tonic-gate } 368*0Sstevel@tonic-gate while (*cp && digit(*cp)) 369*0Sstevel@tonic-gate cp++; 370*0Sstevel@tonic-gate return (*cp == 0); 371*0Sstevel@tonic-gate } 372*0Sstevel@tonic-gate 373*0Sstevel@tonic-gate tchar ** 374*0Sstevel@tonic-gate copyblk(v) 375*0Sstevel@tonic-gate register tchar **v; 376*0Sstevel@tonic-gate { 377*0Sstevel@tonic-gate register tchar **nv = 378*0Sstevel@tonic-gate (tchar **) calloc((unsigned) (blklen(v) + 1), 379*0Sstevel@tonic-gate sizeof (tchar **)); 380*0Sstevel@tonic-gate 381*0Sstevel@tonic-gate return (blkcpy(nv, v)); 382*0Sstevel@tonic-gate } 383*0Sstevel@tonic-gate 384*0Sstevel@tonic-gate tchar * 385*0Sstevel@tonic-gate strend(cp) 386*0Sstevel@tonic-gate register tchar *cp; 387*0Sstevel@tonic-gate { 388*0Sstevel@tonic-gate 389*0Sstevel@tonic-gate while (*cp) 390*0Sstevel@tonic-gate cp++; 391*0Sstevel@tonic-gate return (cp); 392*0Sstevel@tonic-gate } 393*0Sstevel@tonic-gate 394*0Sstevel@tonic-gate tchar * 395*0Sstevel@tonic-gate strip(cp) 396*0Sstevel@tonic-gate tchar *cp; 397*0Sstevel@tonic-gate { 398*0Sstevel@tonic-gate register tchar *dp = cp; 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gate while (*dp++ &= TRIM) 401*0Sstevel@tonic-gate continue; 402*0Sstevel@tonic-gate return (cp); 403*0Sstevel@tonic-gate } 404*0Sstevel@tonic-gate 405*0Sstevel@tonic-gate udvar(name) 406*0Sstevel@tonic-gate tchar *name; 407*0Sstevel@tonic-gate { 408*0Sstevel@tonic-gate 409*0Sstevel@tonic-gate setname(name); 410*0Sstevel@tonic-gate bferr("Undefined variable"); 411*0Sstevel@tonic-gate } 412*0Sstevel@tonic-gate 413*0Sstevel@tonic-gate prefix(sub, str) 414*0Sstevel@tonic-gate register tchar *sub, *str; 415*0Sstevel@tonic-gate { 416*0Sstevel@tonic-gate 417*0Sstevel@tonic-gate for (;;) { 418*0Sstevel@tonic-gate if (*sub == 0) 419*0Sstevel@tonic-gate return (1); 420*0Sstevel@tonic-gate if (*str == 0) 421*0Sstevel@tonic-gate return (0); 422*0Sstevel@tonic-gate if (*sub++ != *str++) 423*0Sstevel@tonic-gate return (0); 424*0Sstevel@tonic-gate } 425*0Sstevel@tonic-gate } 426*0Sstevel@tonic-gate 427*0Sstevel@tonic-gate /* 428*0Sstevel@tonic-gate * blk*_ routines 429*0Sstevel@tonic-gate */ 430*0Sstevel@tonic-gate 431*0Sstevel@tonic-gate char ** 432*0Sstevel@tonic-gate blkend_(up) 433*0Sstevel@tonic-gate register char **up; 434*0Sstevel@tonic-gate { 435*0Sstevel@tonic-gate 436*0Sstevel@tonic-gate while (*up) 437*0Sstevel@tonic-gate up++; 438*0Sstevel@tonic-gate return (up); 439*0Sstevel@tonic-gate } 440*0Sstevel@tonic-gate 441*0Sstevel@tonic-gate blklen_(av) 442*0Sstevel@tonic-gate register char **av; 443*0Sstevel@tonic-gate { 444*0Sstevel@tonic-gate register int i = 0; 445*0Sstevel@tonic-gate 446*0Sstevel@tonic-gate while (*av++) 447*0Sstevel@tonic-gate i++; 448*0Sstevel@tonic-gate return (i); 449*0Sstevel@tonic-gate } 450*0Sstevel@tonic-gate 451*0Sstevel@tonic-gate char ** 452*0Sstevel@tonic-gate blkcpy_(oav, bv) 453*0Sstevel@tonic-gate char **oav; 454*0Sstevel@tonic-gate register char **bv; 455*0Sstevel@tonic-gate { 456*0Sstevel@tonic-gate register char **av = oav; 457*0Sstevel@tonic-gate 458*0Sstevel@tonic-gate while (*av++ = *bv++) 459*0Sstevel@tonic-gate continue; 460*0Sstevel@tonic-gate return (oav); 461*0Sstevel@tonic-gate } 462*0Sstevel@tonic-gate 463*0Sstevel@tonic-gate char ** 464*0Sstevel@tonic-gate blkcat_(up, vp) 465*0Sstevel@tonic-gate char **up, **vp; 466*0Sstevel@tonic-gate { 467*0Sstevel@tonic-gate 468*0Sstevel@tonic-gate (void) blkcpy_(blkend_(up), vp); 469*0Sstevel@tonic-gate return (up); 470*0Sstevel@tonic-gate } 471*0Sstevel@tonic-gate 472*0Sstevel@tonic-gate char ** 473*0Sstevel@tonic-gate blkspl_(up, vp) 474*0Sstevel@tonic-gate register char **up, **vp; 475*0Sstevel@tonic-gate { 476*0Sstevel@tonic-gate register char **wp = 477*0Sstevel@tonic-gate (char **) calloc((unsigned) (blklen_(up) + blklen_(vp) + 1), 478*0Sstevel@tonic-gate sizeof (char **)); 479*0Sstevel@tonic-gate 480*0Sstevel@tonic-gate (void) blkcpy_(wp, up); 481*0Sstevel@tonic-gate return (blkcat_(wp, vp)); 482*0Sstevel@tonic-gate } 483