12405Sdlw /* 2*23005Skre * Copyright (c) 1980 Regents of the University of California. 3*23005Skre * All rights reserved. The Berkeley software License Agreement 4*23005Skre * specifies the terms and conditions for redistribution. 52405Sdlw * 6*23005Skre * @(#)chdir_.c 5.1 06/07/85 7*23005Skre */ 8*23005Skre 9*23005Skre /* 102405Sdlw * change default directory 112405Sdlw * 122405Sdlw * calling sequence: 132405Sdlw * integer chdir 142405Sdlw * ierror = chdir(dirname) 152405Sdlw * where: 162405Sdlw * ierror will receive a returned status (0 == OK) 172405Sdlw * dirname is the directory name 182405Sdlw */ 192405Sdlw 202405Sdlw #include "../libI77/f_errno.h" 2112141Sdlw #include <sys/param.h> 2212141Sdlw #ifndef MAXPATHLEN 2312141Sdlw #define MAXPATHLEN 128 2412141Sdlw #endif 252405Sdlw 262405Sdlw long chdir_(dname, dnamlen) 272405Sdlw char *dname; 282405Sdlw long dnamlen; 292405Sdlw { 3012141Sdlw char buf[MAXPATHLEN]; 312405Sdlw 322534Sdlw if (dnamlen >= sizeof buf) 332534Sdlw return((long)(errno=F_ERARG)); 342405Sdlw g_char(dname, dnamlen, buf); 352405Sdlw if (chdir(buf) != 0) 362405Sdlw return((long)errno); 372405Sdlw return(0L); 382405Sdlw } 39