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
-char id_chmod[] = "@(#)chmod_.c 1.1";
+char id_chmod[] = "@(#)chmod_.c 1.2";
*
* chmod - change file mode bits
*
*
* chmod - change file mode bits
*
*/
#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[MAXPATHLEN];
char modbuf[32];
int retcode;
char modbuf[32];
int retcode;
-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:
* 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();
+ char pathname[MAXPATHLEN];
p = getwd(pathname);
b_char(pathname, path, len);
p = getwd(pathname);
b_char(pathname, path, len);
-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
*
*/
#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 (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);
-char id_rename[] = "@(#)rename_.c 1.1";
+char id_rename[] = "@(#)rename_.c 1.2";
*
* rename a file atomically
*
*
* rename a file atomically
*
*/
#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));
-char id_stat[] = "@(#)stat_.c 1.2";
+char id_stat[] = "@(#)stat_.c 1.3";
* 'statb' will receive the stat structure for file 'name'.
*/
* 'statb' will receive the stat structure for file 'name'.
*/
+#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;
{
struct stat statb;
if (namlen >= sizeof buf)
struct stat statb;
if (namlen >= sizeof buf)