changed to use MAXPATHLEN. DLW
authorDavid Wasley <dlw@ucbvax.Berkeley.EDU>
Sun, 1 May 1983 08:07:02 +0000 (00:07 -0800)
committerDavid Wasley <dlw@ucbvax.Berkeley.EDU>
Sun, 1 May 1983 08:07:02 +0000 (00:07 -0800)
SCCS-vsn: usr.bin/f77/libU77/chmod_.c 1.2
SCCS-vsn: usr.bin/f77/libU77/getcwd_.c 1.5
SCCS-vsn: usr.bin/f77/libU77/link_.c 1.2
SCCS-vsn: usr.bin/f77/libU77/rename_.c 1.2
SCCS-vsn: usr.bin/f77/libU77/stat_.c 1.3

usr/src/usr.bin/f77/libU77/chmod_.c
usr/src/usr.bin/f77/libU77/getcwd_.c
usr/src/usr.bin/f77/libU77/link_.c
usr/src/usr.bin/f77/libU77/rename_.c
usr/src/usr.bin/f77/libU77/stat_.c

index 23bf515..992b0f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-char   id_chmod[]      = "@(#)chmod_.c 1.1";
+char   id_chmod[]      = "@(#)chmod_.c 1.2";
  *
  * chmod - change file mode bits
  *
  *
  * chmod - change file mode bits
  *
@@ -9,12 +9,16 @@ char  id_chmod[]      = "@(#)chmod_.c 1.1";
  */
 
 #include "../libI77/f_errno.h"
  */
 
 #include "../libI77/f_errno.h"
+#include <sys/param.h>
+#ifndef        MAXPATHLEN
+#define MAXPATHLEN     128
+#endif
 
 long chmod_(name, mode, namlen, modlen)
 char   *name, *mode;
 long   namlen, modlen;
 {
 
 long chmod_(name, mode, namlen, modlen)
 char   *name, *mode;
 long   namlen, modlen;
 {
-       char    nambuf[256];
+       char    nambuf[MAXPATHLEN];
        char    modbuf[32];
        int     retcode;
 
        char    modbuf[32];
        int     retcode;
 
index 174fbca..4adaf0e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-char id_getcwd[] = "@(#)getcwd_.c      1.4";
+char id_getcwd[] = "@(#)getcwd_.c      1.5";
  * Get pathname of current working directory.
  *
  * calling sequence:
  * Get pathname of current working directory.
  *
  * calling sequence:
@@ -10,6 +10,11 @@ char id_getcwd[] = "@(#)getcwd_.c    1.4";
  *     ierr will be 0 if successful, a system error code otherwise.
  */
 
  *     ierr will be 0 if successful, a system error code otherwise.
  */
 
+#include <sys/param.h>
+#ifndef        MAXPATHLEN
+#define MAXPATHLEN     128
+#endif
+
 extern int errno;
 char   *getwd();
 
 extern int errno;
 char   *getwd();
 
@@ -19,7 +24,7 @@ char *path;
 long len;
 {
        char    *p;
 long len;
 {
        char    *p;
-       char    pathname[1024];
+       char    pathname[MAXPATHLEN];
 
        p = getwd(pathname);
        b_char(pathname, path, len);
 
        p = getwd(pathname);
        b_char(pathname, path, len);
index ee072c6..5cc0d0c 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-char id_link[] = "@(#)link_.c  1.1";
+char id_link[] = "@(#)link_.c  1.2";
  *
  * make a link to an existing file
  *
  *
  * make a link to an existing file
  *
@@ -12,19 +12,23 @@ char id_link[] = "@(#)link_.c       1.1";
  */
 
 #include "../libI77/f_errno.h"
  */
 
 #include "../libI77/f_errno.h"
+#include <sys/param.h>
+#ifndef        MAXPATHLEN
+#define MAXPATHLEN     128
+#endif
 
 long link_(name1, name2, n1len, n2len)
 char *name1, *name2;
 long n1len, n2len;
 {
 
 long link_(name1, name2, n1len, n2len)
 char *name1, *name2;
 long n1len, n2len;
 {
-       char buf1[128];
-       char buf2[128];
+       char buf1[MAXPATHLEN];
+       char buf2[MAXPATHLEN];
 
        if (n1len >= sizeof buf1 || n2len >= sizeof buf2)
                return((long)(errno=F_ERARG));
        g_char(name1, n1len, buf1);
        g_char(name2, n2len, buf2);
 
        if (n1len >= sizeof buf1 || n2len >= sizeof buf2)
                return((long)(errno=F_ERARG));
        g_char(name1, n1len, buf1);
        g_char(name2, n2len, buf2);
-       if (buf2[0] == '\0')
+       if (buf1[0] == '\0' || buf2[0] == '\0')
                return((long)(errno=F_ERARG));
        if (link(buf1, buf2) != 0)
                return((long)errno);
                return((long)(errno=F_ERARG));
        if (link(buf1, buf2) != 0)
                return((long)errno);
index f75a4e6..66cb097 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-char   id_rename[] = "@(#)rename_.c    1.1";
+char   id_rename[] = "@(#)rename_.c    1.2";
  *
  * rename a file atomically
  *
  *
  * rename a file atomically
  *
@@ -12,14 +12,18 @@ char        id_rename[] = "@(#)rename_.c    1.1";
  */
 
 #include "../libI77/f_errno.h"
  */
 
 #include "../libI77/f_errno.h"
+#include <sys/param.h>
+#ifndef        MAXPATHLEN
+#define MAXPATHLEN     128
+#endif
 
 long
 rename_ (from, to, frlen, tolen)
 char   *from, *to;
 long   frlen, tolen;
 {
 
 long
 rename_ (from, to, frlen, tolen)
 char   *from, *to;
 long   frlen, tolen;
 {
-       char    frbuf[256];
-       char    tobuf[256];
+       char    frbuf[MAXPATHLEN];
+       char    tobuf[MAXPATHLEN];
 
        if (frlen <= 0 || tolen <= 0 || *from == ' ' || *to == ' ')
                return ((long)(errno = F_ERARG));
 
        if (frlen <= 0 || tolen <= 0 || *from == ' ' || *to == ' ')
                return ((long)(errno = F_ERARG));
index 087ec9e..5e1aaed 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-char id_stat[] = "@(#)stat_.c  1.2";
+char id_stat[] = "@(#)stat_.c  1.3";
  *
  * get file status
  *
  *
  * get file status
  *
@@ -10,14 +10,17 @@ char id_stat[] = "@(#)stat_.c       1.2";
  *     'statb' will receive the stat structure for file 'name'.
  */
 
  *     'statb' will receive the stat structure for file 'name'.
  */
 
-#include <sys/types.h>
+#include <sys/param.h>
+#ifndef        MAXPATHLEN
+#define MAXPATHLEN     128
+#endif
 #include <sys/stat.h>
 #include "../libI77/f_errno.h"
 
 long stat_(name, stbuf, namlen)
 char *name; long *stbuf, namlen;
 {
 #include <sys/stat.h>
 #include "../libI77/f_errno.h"
 
 long stat_(name, stbuf, namlen)
 char *name; long *stbuf, namlen;
 {
-       char buf[256];
+       char buf[MAXPATHLEN];
        struct stat statb;
 
        if (namlen >= sizeof buf)
        struct stat statb;
 
        if (namlen >= sizeof buf)