- if (linkIntoDirFlag == TRUE)
- dirName = linkName;
-
- while (argc-- >= 2) {
- int status;
-
- if (linkIntoDirFlag == TRUE) {
- char *baseName = get_last_path_component(*argv);
- linkName = (char *)malloc(strlen(dirName)+strlen(baseName)+2);
- strcpy(linkName, dirName);
- if(dirName[strlen(dirName)-1] != '/')
- strcat(linkName, "/");
- strcat(linkName,baseName);
- }
-
- if (removeoldFlag == TRUE) {
- status = (unlink(linkName) && errno != ENOENT);
- if (status != 0) {
- perror(linkName);
- exit FALSE;
- }
- }
-
- if (symlinkFlag == TRUE)
- status = symlink(*argv, linkName);
- else
- status = link(*argv, linkName);
- if (status != 0) {
- perror(linkName);
- exit FALSE;
+extern int ln_main(int argc, char **argv)
+{
+ int status = EXIT_SUCCESS;
+ int flag = 0;
+ int opt;
+
+ /* Parse any options */
+ while ((opt=getopt(argc, argv, "sfn")) != -1) {
+ switch(opt) {
+ case 's':
+ flag |= LN_SYMLINK;
+ break;
+ case 'f':
+ flag |= LN_FORCE;
+ break;
+ case 'n':
+ flag |= LN_NODEREFERENCE;
+ break;
+ default:
+ usage(ln_usage);