[comp.sys.ibm.pc] 'link'ing a la U*IX in DOS

umhudso7@ccu.umanitoba.ca (Wayne Hudson) (06/02/90)

I'm running DOS 3.3 on a '286 that's stretched in memory and disk space.  What
I'm looking for is something that will let me make symbolic links, like U*IX.

(ie. have file E:\FOOBAR\REPORT.FOO point to the actual file, D:\RALPH\HEER.XXX)
Can it be done? Cheaply? :-)
-- 
Wayne Hudson                 | Hartley's Second Law:
 - umhudso7@ccu.umanitoba.ca |  Never sleep with anyone crazier than yourself.

kdq@demott.COM (Kevin D. Quitt) (06/03/90)

    Sure, symbolic links on DOS are easy - as long as you never have to
CHKDSK.
-- 

 _
Kevin D. Quitt         Manager, Software Development    34 12 N  118 27 W
DeMott Electronics Co. 14707 Keswick St.   Van Nuys, CA 91405-1266
VOICE (818) 988-4975   FAX (818) 997-1190  
MODEM (818) 997-4496 Telebit PEP last      demott!kdq   kdq@demott.com

      96.37% of the statistics used in arguments are made up.

darcy@druid.uucp (D'Arcy J.M. Cain) (06/03/90)

In article <1990Jun1.193543.13903@ccu.umanitoba.ca> umhudso7@ccu.umanitoba.ca (Wayne Hudson) writes:
>I'm running DOS 3.3 on a '286 that's stretched in memory and disk space.  What
>I'm looking for is something that will let me make symbolic links, like U*IX.
>
>(ie. have file E:\FOOBAR\REPORT.FOO point to the actual file, D:\RALPH\HEER.XXX)
You can't do it with DOS.  Get a Unix system.

-- 
D'Arcy J.M. Cain (darcy@druid)     |   Government:
D'Arcy Cain Consulting             |   Organized crime with an attitude
West Hill, Ontario, Canada         |
(416) 281-6094                     |

dixon@sagittarius.crd.ge.com (walt dixon) (06/04/90)

In article 1990Jun3.054243.11711@druid.uucp D'Arcy J.M. Cain (darcy@druid) 
writes:
 
>In article <1990Jun1.193543.13903@ccu.umanitoba.ca>
>umhudso7@ccu.umanitoba.ca (Wayne Hudson) writes:

>>I'm running DOS 3.3 on a '286 that's stretched in memory and disk space.
>>What I'm looking for is something that will let me make symbolic links,
>>like U*IX.
>>
>>(ie. have file E:\FOOBAR\REPORT.FOO point to the actual file,
>>D:\RALPH\HEER.XXX)

>You can't do it with DOS.  Get a Unix system.

This statement isn't strictly true.  The directory entry for a file
contains the starting cluster on disk.  One could create a second
directory entry and insert the appropriate starting cluster.  There
are a couple of side effects from this hack.  Chkdsk will find clusters
that are multiply allocated.  Also it is possible to confuse DOS.  In
unix a reference count in the inode(?) keeps the file from being deleted
out from under a symbolic link.  There's no such facility within DOS.

Walt Dixon	{internet:	dixon@crd.ge.com	}
		{us mail:	ge-crd			}
		{		po box 8		}
		{		schenectady, ny 12301	}
		{phone:		518-387-5798		}

Walt Dixon dixon@crd.ge.com

darcy@druid.uucp (D'Arcy J.M. Cain) (06/04/90)

In article <8153@crdgw1.crd.ge.com> dixon@sagittarius.crd.ge.com (walt dixon) writes:
>In article 1990Jun3.054243.11711@druid.uucp D'Arcy J.M. Cain (darcy@druid) 
>writes:
>>In article <1990Jun1.193543.13903@ccu.umanitoba.ca>
>>umhudso7@ccu.umanitoba.ca (Wayne Hudson) writes:
>>>What I'm looking for is something that will let me make symbolic links,
>>>like U*IX.
>>You can't do it with DOS.  Get a Unix system.
>This statement isn't strictly true.  The directory entry for a file
>contains the starting cluster on disk.  One could create a second
>directory entry and insert the appropriate starting cluster.  There
>are a couple of side effects from this hack.  Chkdsk will find clusters
>that are multiply allocated.  Also it is possible to confuse DOS.  In
>unix a reference count in the inode(?) keeps the file from being deleted
>out from under a symbolic link.  There's no such facility within DOS.
>
OK so I guess what I meant to say was "You can't do it with DOS and expect
to have a healthy file system that acts in a predictable way and anyway you
can't do it easily."

As the man said, you could do it but "It would be wrong."

-- 
D'Arcy J.M. Cain (darcy@druid)     |   Government:
D'Arcy Cain Consulting             |   Organized crime with an attitude
West Hill, Ontario, Canada         |
(416) 281-6094                     |

jpc@fctunl.rccn.pt (Jose Pina Coelho) (06/04/90)

Well...

A few months ago I was making a program that was supposed to work like
simbolic/hard links.
It was a TSR that caught the INT 21, it only processed  the handle
calls and rename/remove

Physicaly both hard and simbolic links consist of a file with the name
of the 'true' file (which could be another link).
They started with a magic number "#@#$SOFTLINK$" or "#@#$HARDLINK$",
and were followed by the filename.
When you made an open, the new routine would open the file, and if it
started with a magic number it would call itself with the new name.

there was a database C:\UNIX\LINKS which said which files had hard links

C:\TC\TURBOC.CFG 20 <- There are 20 hard links to TURBOC.CFG

If you try to erase a symbolic link, you erase it. Final!
If you try to erase a hard link, the program find out the real file
and decreases it's reference count.
If you try to erase a file that is in the database, the program will:
	1 - Erase it, and hell with dangling hard links
	2 - Say: 'There are <n> hard links' and do nothing
	3 - Move the file to one of the hard links, and scan the disk
	    changing every hard-link to that file to the new file

1 - Is just like a symbolic link
2 - Is the easyest
3 - Is the HARD (only?) way.

Why didn't I post?
- I need a few more hundred hours of idle creative time.
- Currently, the only thing it does is CRASH.
- All the comments are in BAD portuguese.



--
Jose Pina Coelho        | BITNET/Internet: jpc@fctunl.rccn.pt
Rua Jau N 1, 2 Dto      | UUCP: jpc@unl.uucp
1300 Lisboa, PORTUGAL   | ARPA: jpc%hara.fctunl.rccn.pt@mitvma.mit.edu
Home phone: (+351) (1) 640767

- If all men were brothers, would you let one marry your sister ?

mlord@bnr-rsc.UUCP (Mark Lord) (06/05/90)

In article <1990Jun1.193543.13903@ccu.umanitoba.ca> umhudso7@ccu.umanitoba.ca (Wayne Hudson) writes:
>I'm running DOS 3.3 on a '286 that's stretched in memory and disk space.  What
>I'm looking for is something that will let me make symbolic links, like U*IX.
>
>(ie. have file E:\FOOBAR\REPORT.FOO point to the actual file, D:\RALPH\HEER.XXX)
>Can it be done? Cheaply? :-)




It can be done.. look for a program called FLINK   .. email me directly if you 
cannot find it.  The overhead cost of this implementation is one disk cluster 
per link, so it only saves space if the linked file is larger than one cluster,
although it NEVER will cost more space than having two copies of the file would.
-- 
 ______Mark S. Lord______________________ ______________________________
|    ..uunet!bnrgate!carrsc!mlord        | These are only MY opinions.  |
| or:  bnr-rsc!mlord@bnrgate             | I charge for official views. |
|________________________________________|______________________________|

bob@omni.com (Bob Weissman) (06/05/90)

In article <1990Jun4.025220.2149@druid.uucp>, darcy@druid.uucp (D'Arcy J.M. Cain) writes:
> OK so I guess what I meant to say was "You can't do it with DOS and expect
> to have a healthy file system that acts in a predictable way and anyway you
> can't do it easily."

Following is a DOS symlink facility from Fridrik Skulason of the
University of Iceland, posted back in February.

I have NOT personally tested it; you're on your own...

---------- Begin included message ----------

Two days ago I mentioned a program I had written for solving the "linking"
problem.  Since I have received a number of requests for it, I am posting
it here.  Before anybody starts flaming me for posting a program to a .d
group, please consider:

	a) comp.binaries.ibm.pc is currently not active
	b) this is a very short posting

Anyhow - this xxencoded (note - not uuencoded) PKARCed file contains two
programs.  LINKFILE (C source provided - use Turbo C to compile) is used
to create the "links". 

Example:  If you give the command

		LINKFILE E:\LIBRARY\MYINCL.H

	  the file MYINCL.H will be created in the current directory.
	  It contains:

		FLFLE:\LIBRARY\MYINCL.H

F-LINK.EXE is a resident program. It intercepts INT 21 calls, functions
3C, 3D and 5B (Open and create file). If the file being opened (or created)
exists and starts with "FLFL", the rest of the file is assumed to contain
the actual path name.

The programs do not provide a full solution to the problem, but I hope they
will be of use to somebody.

-frisk

begin 400 f-link.arc
h4UV49Il7HYgiFJV3+0I+ik2++26IwM2kYI+2+++AHPE++H++E+2+6++czDSD
hV26+XT6l+L+-U6S5+E0Qm+VU-gQz3+3M0ZYg78Fz+0--An93EAckUDXlcDAU
hNUwu0a7icJB+rIA+9YO-+Nf6UFU+IePU+h01Yshz5iU+Y9BY2HMD1XvcUU+U
h3lE+h5ssVGeJZcylIM24wg5J07Au6JmgZE1+PFoAiWU+1HLIlG8X+B-8zP-3
hWn6-EDwS7On3-Jw+umGZT-0UllEXR0ms4CE1EQMu0HPvID+tk1CT1kTZ2p0b
hr8-x+CcEkALkqSg+ROvV0Z4XKEV4k5ccfCACpsjSjsAD3yT0YE2k+KUZwRrQ
hUtr23eHi9Y5RYETGTWpsBgsxl9CI2FccAB80GF6bGo0YaEAW1-gtNQ8EmGDT
hnFkuxf3F-VYie2S0Simt-lw6RdEVllldjC24014sQ+A6O6F-blVZZ13V4js-
hm6O+--eMZL56+PT+AA6-EAQ4i3mK0q6nPBDA0nokJ+Q1iWV2Gk8ysF6+2vvd
h2U7ME6Ok3+0CM2B939sZsU3oXanX5+hUHOSYEYqW48I5bX3W+4aul+A+SI5m
hxeJIMZub0lZbVZ0S9VKhM+3oGwLU4lc6H2ZCGoN7H2IiEk+Z7IU-++-035dy
hPH1G+E++10DGi-b1dUuNAW-sn8317goP3qVwB3+EQ41-UkYLYa4HFUl2WFE3
h2XG6Y6T1XlAfXgGcAAwQ9Uj1o22NoW97X5HY01l1IyL3YUrZo7nM7cl+3+9d
hU+UXtwkM3aDEA+KVUiYNCpiud7WsNm86fm0GUX0nkmjMe3DBd43HNYiC9Wn8
hs84ndEPQBrLcldXFdOk0g45BU2-VREm621pYPDo9hei0-01Ut7q1EYGJCK5C
hZB2-UYYG7oiA743GNCnOAW7Gy6IgBkoR313IazrONzNMBrDUQ5lh3KgAi2ue
hA4506jVk3afNldofaz3LAqvOZ4ZO-UJSCWl2WAWyDLaNtLGO+lPQ+wEMCKJY
hKgz9MgeL73SY783GF1nMCnfdJ1SHrEUHzxjFMBxLy9aq5kixPT2P0kj7kNMP
JV1LZapMflCMLM+GxAQRynTKV+Fc+
+
end
--
         Fridrik Skulason          University of Iceland
         frisk@rhi.hi.is           Computing Services

          Guvf yvar vagragvbanyyl yrsg oynax .................

---------- End included message ----------

-- 
Bob Weissman
Internet:	bob@omni.com
UUCP:		...!{apple,pyramid,sgi,uunet}!omni!bob

einari@rhi.hi.is (Einar Indridason) (06/05/90)

In article <1990Jun4.025220.2149@druid.uucp> darcy@druid.UUCP (D'Arcy J.M. Cain) writes:
>>>You can't do it with DOS.  Get a Unix system.

What about a TSR program that monitors the file operations of INT 21h
(such as: find-first, find-next, open file .....) and whenever there is
a request for a file-operation, the TSR could open (using the old file
system) a special file in (say) the root.  This file would be build in a
special way (indexed) and if the TSR found a match in that file, it
could substitute the real file for the requested.

In short, you would have one file (in the root) that would serve as some
kind of a 'link map'.  You would have that TSR to control those links
and the advantage of this method is that 'chkdsk' would not hickup on it
since there are no 'crossed-clusters'.

(Any volanteers out there?  :-)

--
I just learned a new curse: "You #$@! son of SCROLLBAR!"

Internet:       einari@rhi.hi.is   | 'Just give me my command line and throw
UUCP: ..!mcsun!isgate!rhi!einari   | the GUIs in the dust-bin!!!!!!!!!'

poffen@sj.ate.slb.com (Russ Poffenberger) (06/05/90)

In article <1990Jun4.025220.2149@druid.uucp> darcy@druid.UUCP (D'Arcy J.M. Cain) writes:
>In article <8153@crdgw1.crd.ge.com> dixon@sagittarius.crd.ge.com (walt dixon) writes:
>>In article 1990Jun3.054243.11711@druid.uucp D'Arcy J.M. Cain (darcy@druid) 
>>writes:
>>>In article <1990Jun1.193543.13903@ccu.umanitoba.ca>
>>>umhudso7@ccu.umanitoba.ca (Wayne Hudson) writes:
>>>>What I'm looking for is something that will let me make symbolic links,
>>>>like U*IX.
>>>You can't do it with DOS.  Get a Unix system.
>>This statement isn't strictly true.  The directory entry for a file
>>contains the starting cluster on disk.  One could create a second
>>directory entry and insert the appropriate starting cluster.  There
>>are a couple of side effects from this hack.  Chkdsk will find clusters
>>that are multiply allocated.  Also it is possible to confuse DOS.  In
>>unix a reference count in the inode(?) keeps the file from being deleted
>>out from under a symbolic link.  There's no such facility within DOS.
>>
>OK so I guess what I meant to say was "You can't do it with DOS and expect
>to have a healthy file system that acts in a predictable way and anyway you
>can't do it easily."
>
>As the man said, you could do it but "It would be wrong."
>

This was discussed very recently. What you are implying above is NOT a symbolic
link, but a hard link. This is undesireable. The way Unix implements a symbolic
link is to create a special file with the text of the destination in it. The
OS, upon seeing this, would then vector to the destination pointed to by the
link.

This is possible on DOS, although a TSR would be required for the translation.
In fact, someone wrote one a little while back. I don't have that info though.
`

Russ Poffenberger               DOMAIN: poffen@sj.ate.slb.com
Schlumberger Technologies       UUCP:   {uunet,decwrl,amdahl}!sjsca4!poffen
1601 Technology Drive		CIS:	72401,276
San Jose, Ca. 95110             (408)437-5254

PHYS169@canterbury.ac.nz (Mark Aitchison, U of Canty; Physics) (06/07/90)

In article <8153@crdgw1.crd.ge.com> dixon@sagittarius.crd.ge.com (walt dixon) writes:
>In article 1990Jun3.054243.11711@druid.uucp D'Arcy J.M. Cain (darcy@druid) 
>writes:
>>In article <1990Jun1.193543.13903@ccu.umanitoba.ca>
>>umhudso7@ccu.umanitoba.ca (Wayne Hudson) writes:
>>>What I'm looking for is something that will let me make symbolic links,
>>>like U*IX.
>>You can't do it with DOS.  Get a Unix system.
>This statement isn't strictly true.  The directory entry for a file
>contains the starting cluster on disk.  One could create a second
>directory entry and insert the appropriate starting cluster.

There are 3 ways to do this, one is to let two directory entries point to the
same cluster, as suggested.  I have done this and, yes, ChkDsk gets upset (and
you have to be careful not to delete the files). But there are two other ways,
with less worries.  The JOIN command is "pure legal DOS" and does close to what
the original post requested (i.e. let space on another drive be used as a
directory on an already-crowded disk). But you have to join the whole disk, not
just a single directory. The first method only applies to files on the same
disk (which is good if you need to make font directories, for example,
accessible as different names for stupid hard-coded software). It would be nice
to have a method that combines the good features of both methods.  Such a third
method is theoretically possible, by intercepting DOS calls (it doesn't have to
capture int 21h, there are a few hooks that network software & JOIN itself use,
but I haven't gone into this thoroughly). Does anyone know of something like
this already? Anyone interested in such a thing if I went ahead and wrote one??

Mark Aitchison.

cak@vpnet.chi.il.us (Cindi Knox) (06/07/90)

There is a program called CED which will alias commands, but it ONLY
works for commands/programs, NOT other files.

Cindi Knox	| You've got a lot of living to do without life.
		| 
cak@vpnet	| ``Little Miss S.'' by  Edie Brickell and New Bohemians.

jan@cancol.oz (Jan Newmarch) (06/08/90)

In article <1990Jun1.193543.13903@ccu.umanitoba.ca>
umhudso7@ccu.umanitoba.ca (Wayne Hudson) writes:

>I'm running DOS 3.3 on a '286 that's stretched in memory and disk space.
>What I'm looking for is something that will let me make symbolic links,
>like U*IX.

If you want to save on multiple copies of files, why not use the DOS
command APPEND to give a search path for data files? It may mean
reoorganising directories to fit the search path, but it does save
space.
+----------------------+---+
| Jan Newmarch	       |:-)|  ACSnet: jan@cancol.oz
| Info. Sciences & Eng.|___|  ARPA:   jan%cancol.oz.au@uunet.uu.net
| Univ Canberra            |  UUCP:   {uunet,ukc}!munnari!cancol.oz.au!jan
| P.O. Box 1               |  CSNET:  jan%cancol.oz@australia
| Belconnen  A.C.T. 2616   |  JANET:  jan%au.oz.cancol@EAN-RELAY
| AUSTRALIA                |  telephone: 06-522 422
+--------------------------+