Replaced projects with products/projects.
[oweals/busybox.git] / ln.c
diff --git a/ln.c b/ln.c
index beaa58fac52c5f010bc8e4b080c47c1c78101951..ac1f68e0024034e84a0ad6ee17f9b1d97107f04c 100644 (file)
--- a/ln.c
+++ b/ln.c
@@ -40,9 +40,7 @@ static const char ln_usage[] =
        "\t-s\tmake symbolic links instead of hard links\n"
 
        "\t-f\tremove existing destination files\n"
-#if 0
        "\t-n\tno dereference symlinks - treat like normal file\n"
-#endif
 #endif
        ;
 
@@ -52,7 +50,7 @@ static int followLinks = TRUE;
 
 extern int ln_main(int argc, char **argv)
 {
-       char *linkName, *dirName;
+       char *linkName, *dirName=NULL;
        int linkIntoDirFlag;
        int stopIt = FALSE;
 
@@ -92,13 +90,7 @@ extern int ln_main(int argc, char **argv)
 
        linkName = argv[argc - 1];
 
-       if (strlen(linkName) > BUFSIZ) {
-               fprintf(stderr, name_too_long, "ln");
-               exit FALSE;
-       }
-
-       linkIntoDirFlag = isDirectory(linkName, TRUE, NULL);
-
+       linkIntoDirFlag = isDirectory(linkName, followLinks, NULL);
        if ((argc >= 3) && linkIntoDirFlag == FALSE) {
                fprintf(stderr, not_a_directory, "ln", linkName);
                exit FALSE;
@@ -108,27 +100,8 @@ extern int ln_main(int argc, char **argv)
                dirName = linkName;
 
        while (argc-- >= 2) {
-#if 0
-               char srcName[BUFSIZ + 1];
-               int nChars;
-#endif
                int status;
 
-               if (strlen(*argv) > BUFSIZ) {
-                       fprintf(stderr, name_too_long, "ln");
-                       exit FALSE;
-               }
-
-#if 0
-               if (followLinks == FALSE) {
-                       strcpy(srcName, *argv);
-               } else {
-                       /* Warning!  This can silently truncate if > BUFSIZ, but
-                          I don't think that there can be one > BUFSIZ anyway. */
-                       nChars = readlink(*argv, srcName, BUFSIZ);
-                       srcName[nChars] = '\0';
-               }
-#endif
                if (linkIntoDirFlag == TRUE) {
                        char *baseName = get_last_path_component(*argv);
                        linkName = (char *)malloc(strlen(dirName)+strlen(baseName)+2);
@@ -155,7 +128,7 @@ extern int ln_main(int argc, char **argv)
                        exit FALSE;
                }
 
-               if (linkIntoDirFlag)
+               if (linkIntoDirFlag == TRUE)
                        free(linkName);
 
                argv++;