[comp.unix.xenix.misc] Soft links on Xenix 386 System V?

ltf@ncmicro.lonestar.org (Lance Franklin) (01/27/91)

I have a little problem I'd like to solve.  I have software that I'm
porting to run on either SCO Xenix 386 or Unix System V.  My problem is
that the package likes to see the directory in which the package resides
on the root directory.  There are reasons for this over which I have no
control at present, and on other Unix, we've been able to work around it
by doing a soft link on the root directory that points to the actual
directory.  However, there appears to be no command on Xenix that does
soft links, and the closest approximation on SCO Unix is the link
command.  Since this thing has to be able to install on either system
through a common mechanism (the custom command),  I was hoping that
someone would have a method that I could use to load the directories
elsewhere and make a link on the root to point to that directory.  I am
somewhat hesitant to load the directory right on the root, since some
customers might not have a large enough partition mounted on the root to
hold the package.  Any ideas?

Oh, and a second short question...Does anybody have any insights on the
best way to set up SCO Xenix or Unix as a single-user workstation?  I
am not running any terminals on the machine, it's only being used at
present as a development station, no external terminals, no mail or
uucp, and I am wondering if I can trim the system down somewhat.  Also,
having worked with GUI's on other Unix machines, I wonder if there's a
cheap (preferably PD) GUI I can put on the thing to make it a bit easier
to work with...hopefully one that won't take up all my disk and memory
space, eh?

Lance


-- 
Lance T. Franklin            +----------------------------------------------+
(ltf@ncmicro.lonestar.org)   | "You want I should bop you with this here    |
NC Microproducts, Inc.       |    Lollipop?!?"                 The Fat Fury |
Richardson, Texas            +----------------------------------------------+

mike@bria (01/28/91)

In an article, Lance Franklin writes:
>I have a little problem I'd like to solve.  I have software that I'm
>porting to run on either SCO Xenix 386 or Unix System V.  My problem is
>that the package likes to see the directory in which the package resides
>on the root directory.  There are reasons for this over which I have no
>control at present, and on other Unix, we've been able to work around it
>by doing a soft link on the root directory that points to the actual
>directory.  However, there appears to be no command on Xenix that does
>soft links, and the closest approximation on SCO Unix is the link
>command. [...]

As long as you don't want to put this package on a different filesystem,
a hard link will work under SCO XENIX as well (with one exception: using
the 'cd ..' command can confuse you and the shell, because pwd will show
you as being one place in the filesystem tree, when you're actually
somewhere else).  If you don't have an /etc/link and /etc/unlink for some
reason or other, here is a little something I whipped up.  I personally
prefer my 'unlink' over the simpler flavor because it will allow you
to remove directory links, but not let you clobber the "last" entry itself.
For that, there is always clri.

--[ cut here ]---------------------------------------------------------------

/*      @(#)link.c
*/

#include <stdio.h>

main(argc,argv)
int     argc;
char    *argv[];
{
        if ( argc != 3 ) {
                fprintf(stderr,"Usage: %s from to\n",argv[0]);
                return(0);
                }

        if ( link(argv[1],argv[2]) == -1 ) {
                fprintf(stderr,"%s: cannot link %s\n",argv[0],argv[1]);
                return(0);
                }

        return(0);
}

/*      @(#)unlink.c    
*/

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

main(argc,argv)
int     argc;
char    *argv[];
{
char    *image, *path;
struct stat buf;

        image = *argv;

        if ( argc < 2 ) {
                fprintf(stderr,"Usage: %s file [file ...]\n");
                return(1);
                }

        while ( --argc ) {
                path = *++argv;
                if ( stat(path,&buf) == -1 ) {
                        fprintf(stderr,"%s: cannot stat %s\n",image,path);
                        return(1);
                        }
                if ( (buf.st_mode & S_IFDIR) && (buf.st_nlink < 3) )
                        fprintf(stderr,"%s: will not unlink %s\n",image,path);
                else {
                        if ( unlink(path) == -1 ) 
                                fprintf(stderr,"%s: cannot unlink %s\n",
                                        image, path);
                        }
                }       

        return(0);
}

------------------------------------------------------------------------------

Compile these two and put them in /etc with persmissions of 500, owner root,
group root (so those hapless users can't get themselves into trouble :-)

-- 
Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation
UUCP: ...!uunet!bria!mike
--
technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly
found to be saying things like "Well, it works on my DOS machine ..."