Go to the first, previous, next, last section, table of contents.


symlink

Syntax

#include <unistd.h>

int symlink(const char *exists, const char *new);

Description

MSDOS doesn't support symbolic links. However, DJGPP supports "symlinks" to DJGPP programs. This function simulates a symlink between two `.exe' files in the DJGPP style. It creates a program whose name is pointed to by new which, when run, will actually execute the program exists passing it the string pointed by new in argv[0] (some programs change their behavior depending on what's passed in argv[0]). The file referred to by exists doesn't really have to exist when this function is called. If exists points to an existing file, the function checks that it is a DJGPP executable; if not, the call will fail with EXDEV.

Both new and exists can point to a name with or without the `.exe' extension.

Note that both exists and new must specify file names which reside in the same directory (this is a restriction of the DJGPP "symlinks"); the function will fail and set errno to EXDEV if they aren't.

This functions runs the `stubify' and `stubedit' programs, so they should be somewhere on your `PATH' for the function to succeed. (These programs come with the DJGPP development distribution.)

Return Value

Zero in case of success, -1 in case of failure (and errno set to the appropriate error code).

Portability

not ANSI, not POSIX

Example

symlink ("c:/djgpp/bin/grep", "c:/djgpp/bin/fgrep");


Go to the first, previous, next, last section, table of contents.