BSD 4_3_Net_2 release
[unix-history] / usr / src / libexec / ftpd / ftpcmd.y
index 5025b48..ac4b3bd 100644 (file)
@@ -2,21 +2,35 @@
  * Copyright (c) 1985, 1988 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1985, 1988 Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. Neither the name of the University nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)ftpcmd.y    5.23 (Berkeley) 6/1/90
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)ftpcmd.y    5.24 (Berkeley) 2/25/91
  */
 
 /*
  */
 
 /*
 %{
 
 #ifndef lint
 %{
 
 #ifndef lint
-static char sccsid[] = "@(#)ftpcmd.y   5.23 (Berkeley) 6/1/90";
+static char sccsid[] = "@(#)ftpcmd.y   5.24 (Berkeley) 2/25/91";
 #endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/socket.h>
 #endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/socket.h>
-
+#include <sys/stat.h>
 #include <netinet/in.h>
 #include <netinet/in.h>
-
 #include <arpa/ftp.h>
 #include <arpa/ftp.h>
-
-#include <stdio.h>
 #include <signal.h>
 #include <signal.h>
-#include <ctype.h>
-#include <pwd.h>
 #include <setjmp.h>
 #include <syslog.h>
 #include <setjmp.h>
 #include <syslog.h>
-#include <sys/stat.h>
 #include <time.h>
 #include <time.h>
+#include <pwd.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
 
 extern struct sockaddr_in data_dest;
 extern int logged_in;
 
 extern struct sockaddr_in data_dest;
 extern int logged_in;
@@ -63,7 +77,7 @@ extern        char *globerr;
 extern int usedefault;
 extern  int transflag;
 extern  char tmpline[];
 extern int usedefault;
 extern  int transflag;
 extern  char tmpline[];
-char   **glob();
+char   **ftpglob();
 
 off_t  restart_point;
 
 
 off_t  restart_point;
 
@@ -73,7 +87,6 @@ static        int cmd_bytesz;
 char   cbuf[512];
 char   *fromname;
 
 char   cbuf[512];
 char   *fromname;
 
-char   *index();
 %}
 
 %token
 %}
 
 %token
@@ -619,7 +632,7 @@ pathname:   pathstring
                 * This is a valid reply in some cases but not in others.
                 */
                if (logged_in && $1 && strncmp((char *) $1, "~", 1) == 0) {
                 * This is a valid reply in some cases but not in others.
                 */
                if (logged_in && $1 && strncmp((char *) $1, "~", 1) == 0) {
-                       *(char **)&($$) = *glob((char *) $1);
+                       *(char **)&($$) = *ftpglob((char *) $1);
                        if (globerr != NULL) {
                                reply(550, globerr);
                                $$ = NULL;
                        if (globerr != NULL) {
                                reply(550, globerr);
                                $$ = NULL;
@@ -826,12 +839,10 @@ getline(s, n, iop)
        return (s);
 }
 
        return (s);
 }
 
-static int
+static void
 toolong()
 {
        time_t now;
 toolong()
 {
        time_t now;
-       extern char *ctime();
-       extern time_t time();
 
        reply(421,
          "Timeout (%d seconds): closing control connection.", timeout);
 
        reply(421,
          "Timeout (%d seconds): closing control connection.", timeout);
@@ -850,8 +861,7 @@ yylex()
        register char *cp, *cp2;
        register struct tab *p;
        int n;
        register char *cp, *cp2;
        register struct tab *p;
        int n;
-       char c, *strpbrk();
-       char *copy();
+       char c, *copy();
 
        for (;;) {
                switch (state) {
 
        for (;;) {
                switch (state) {
@@ -1077,7 +1087,6 @@ copy(s)
        char *s;
 {
        char *p;
        char *s;
 {
        char *p;
-       extern char *malloc(), *strcpy();
 
        p = malloc((unsigned) strlen(s) + 1);
        if (p == NULL)
 
        p = malloc((unsigned) strlen(s) + 1);
        if (p == NULL)