/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped22/*23* Glenn Fowler24* AT&T Bell Laboratories25*/2627#include "univlib.h"2829/*30* create symbolic name from external representation text in buf31* the arg order matches link(2)32*/3334int35pathsetlink(const char* buf, const char* name)36{37register char* t = (char*)buf;38#ifdef UNIV_MAX39register char* s = (char*)buf;40register char* v;41int n;42char tmp[PATH_MAX];4344while (*s)45{46if (*s++ == univ_cond[0] && !strncmp(s - 1, univ_cond, univ_size))47{48s--;49t = tmp;50for (n = 0; n < UNIV_MAX; n++)51if (*univ_name[n])52{53*t++ = ' ';54#ifdef ATT_UNIV55*t++ = '1' + n;56*t++ = ':';57#else58for (v = univ_name[n]; *t = *v++; t++);59*t++ = '%';60#endif61for (v = (char*)buf; v < s; *t++ = *v++);62for (v = univ_name[n]; *t = *v++; t++);63for (v = s + univ_size; *t = *v++; t++);64}65t = tmp;66break;67}68}69#endif70return(symlink(t, name));71}727374