static int netHostChdir(char *path, struct hostent *hp) { char filename[MAXFILENAMELEN]; char *mp; if (AM_LAST || AM_NEVER) { if (chdir(usePath(path)) == 0) return(0); } if (strstr(path, "/net/") == path) return -1; if (strstr(path, "/tmp_mnt/") == path) return -1; if (hp == NULL) return -1; if ((mp=mountNet_(hp)) == NULL) return -1; sprintf(filename, "%s%s", mp, path); return (chdir(usePath(filename))); }
int mymkdir_ (char *filename, mode_t mode, struct hostent *hp) { char fnamebuf[MAXFILENAMELEN]; int i; char *mp; if (!hp || filename[0] != '/' || AM_NEVER) return (mkdir (usePath (filename), mode)); if (AM_LAST) if ((i = mkdir (usePath (filename), mode)) != -1) return i; if (strstr (filename, "/net/") == filename) return (mkdir (usePath (filename), mode)); if (strstr (filename, "/tmp_mnt/") == filename) return (mkdir (usePath (filename), mode)); if ((mp = mountNet_ (hp)) == NULL) return (mkdir (usePath (filename), mode)); sprintf (fnamebuf, "%s%s", mp, filename); i = mkdir (usePath (fnamebuf), mode); if (i >= 0) return i; return (mkdir (usePath (filename), mode)); }
FILE * myfopen_ (char *filename, char *type, struct hostent * hp) { char fnamebuf[MAXFILENAMELEN]; FILE *fp; char *mp; if (!hp || filename[0] != '/' || AM_NEVER) return (fopen (usePath (filename), type)); if (AM_LAST) if ((fp = fopen (usePath (filename), type)) != NULL) return fp; if (strstr (filename, "/net/") == filename) return (fopen (usePath (filename), type)); if (strstr (filename, "/tmp_mnt/") == filename) return (fopen (usePath (filename), type)); if ((mp = mountNet_ (hp)) == NULL) return (fopen (usePath (filename), type)); sprintf (fnamebuf, "%s%s", mp, filename); fp = fopen (usePath (fnamebuf), type); if (fp != NULL) return fp; return (fopen (usePath (filename), type)); }
int myrename_(char *from, char *to, struct hostent *hp) { char fnamebuf[MAXFILENAMELEN]; char tnamebuf[MAXFILENAMELEN]; int i; char *mp; /*Bug#169, set hp to NULL to let the function do operation directly * and do not try /net and /tmp_mnt */ hp = NULL; if (! hp || AM_NEVER) return (rename(from, to)); if (AM_LAST) if ((i=rename(from, to)) != -1) return i; if ((strstr(from, "/net/") == from) && (strstr(to,"/net") == to) ) return (rename(from, to)); if ((strstr(from, "/tmp_mnt/") == from) && (strstr(to,"/tmp_mnt/") == to) ) return (rename(from, to)); if ((mp=mountNet_(hp)) == NULL) return (rename(from, to)); if (from[0] == '/') sprintf(fnamebuf, "%s%s", mp, from); else strcpy(fnamebuf, from); if (to[0] == '/') sprintf(tnamebuf, "%s%s", mp, to); else strcpy(tnamebuf, to); i = rename(fnamebuf, tnamebuf); if (i>=0) return i; return (rename(from, to)); }
void myexecv_(char *filename, char **argv, struct hostent *hp) { char fnamebuf[MAXFILENAMELEN]; char *mp; /*Bug#169, set hp to NULL to let the function do operation directly * and do not try /net and /tmp_mnt */ hp = NULL; if (!hp || filename[0] != '/' || AM_NEVER) { lsfExecv(usePath(filename), argv); return; } if (AM_LAST) { lsfExecv(usePath(filename), argv); return; } if (strstr(filename, "/net/") == filename) { lsfExecv(usePath(filename), argv); return; } if (strstr(filename, "/tmp_mnt/") ==filename) { lsfExecv(usePath(filename), argv); return; } if ((mp=mountNet_(hp)) == NULL) { lsfExecv(usePath(filename), argv); return; } sprintf(fnamebuf, "%s%s", mp, filename); lsfExecv(usePath(fnamebuf), argv); lsfExecv(usePath(filename), argv); }
int myrename_ (char *from, char *to, struct hostent *hp) { char fnamebuf[MAXFILENAMELEN]; char tnamebuf[MAXFILENAMELEN]; int i; char *mp; if (!hp || AM_NEVER) return (rename (from, to)); if (AM_LAST) if ((i = rename (from, to)) != -1) return i; if ((strstr (from, "/net/") == from) && (strstr (to, "/net") == to)) return (rename (from, to)); if ((strstr (from, "/tmp_mnt/") == from) && (strstr (to, "/tmp_mnt/") == to)) return (rename (from, to)); if ((mp = mountNet_ (hp)) == NULL) return (rename (from, to)); if (from[0] == '/') sprintf (fnamebuf, "%s%s", mp, from); else strcpy (fnamebuf, from); if (to[0] == '/') sprintf (tnamebuf, "%s%s", mp, to); else strcpy (tnamebuf, to); i = rename (fnamebuf, tnamebuf); if (i >= 0) return i; return (rename (from, to)); }
void myexecv_ (char *filename, char **argv, struct hostent *hp) { char fnamebuf[MAXFILENAMELEN]; char *mp; if (!hp || filename[0] != '/' || AM_NEVER) { lsfExecv (usePath (filename), argv); return; } if (AM_LAST) { lsfExecv (usePath (filename), argv); return; } if (strstr (filename, "/net/") == filename) { lsfExecv (usePath (filename), argv); return; } if (strstr (filename, "/tmp_mnt/") == filename) { lsfExecv (usePath (filename), argv); return; } if ((mp = mountNet_ (hp)) == NULL) { lsfExecv (usePath (filename), argv); return; } sprintf (fnamebuf, "%s%s", mp, filename); lsfExecv (usePath (fnamebuf), argv); lsfExecv (usePath (filename), argv); }
int myunlink_(char *filename, struct hostent *hp, int doMount) { char fnamebuf[MAXFILENAMELEN]; int i; char *mp; /*Bug#169, set hp to NULL to let the function do operation directly * and do not try /net and /tmp_mnt */ hp = NULL; if (!hp || filename[0] != '/' || AM_NEVER) return (unlink(usePath(filename))); if (AM_LAST) if ((i=unlink(usePath(filename))) != -1) return(1); if(doMount) { if (strstr(filename, "/net/") == filename) return (unlink(usePath(filename))); if (strstr(filename, "/tmp_mnt/") ==filename) return (unlink(usePath(filename))); if ((mp=mountNet_(hp)) == NULL) { return (1); } sprintf(fnamebuf, "%s%s", mp, filename); i = unlink(usePath(fnamebuf)); if (i>=0) return i; } return (unlink(usePath(filename))); }
int mymkdir_(char *filename, mode_t mode, struct hostent *hp) { char fnamebuf[MAXFILENAMELEN]; int i; char *mp; /*Bug#169, set hp to NULL to let the function do operation directly * and do not try /net and /tmp_mnt */ hp = NULL; if (!hp || filename[0] != '/' || AM_NEVER) return (mkdir(usePath(filename), mode)); if (AM_LAST) if ((i=mkdir(usePath(filename), mode)) != -1) return i; if (strstr(filename, "/net/") == filename) return (mkdir(usePath(filename), mode)); if (strstr(filename, "/tmp_mnt/") == filename) return (mkdir(usePath(filename), mode)); if ((mp=mountNet_(hp)) == NULL) return (mkdir(usePath(filename), mode)); sprintf(fnamebuf, "%s%s", mp, filename); i = mkdir(usePath(fnamebuf), mode); if (i>=0) return i; return (mkdir(usePath(filename), mode)); }
FILE * myfopen_(char *filename, char *type, struct hostent *hp) { char fnamebuf[MAXFILENAMELEN]; FILE *fp; char *mp; /*Bug#169, set hp to NULL to let the function do operation directly * and do not try /net and /tmp_mnt */ hp = NULL; if (!hp || filename[0] != '/' || AM_NEVER) return (fopen(usePath(filename), type)); if (AM_LAST) if ((fp = fopen(usePath(filename),type)) != NULL) return fp; if (strstr(filename, "/net/") == filename) return (fopen(usePath(filename), type)); if (strstr(filename, "/tmp_mnt/") ==filename) return (fopen(usePath(filename), type)); if ((mp = mountNet_(hp)) == NULL) return (fopen(usePath(filename), type)); sprintf(fnamebuf, "%s%s", mp, filename); fp = fopen(usePath(fnamebuf), type); if (fp != NULL) return fp; return (fopen(usePath(filename), type)); }
int myunlink_ (char *filename, struct hostent *hp, int doMount) { char fnamebuf[MAXFILENAMELEN]; int i; char *mp; if (!hp || filename[0] != '/' || AM_NEVER) return (unlink (usePath (filename))); if (AM_LAST) if ((i = unlink (usePath (filename))) != -1) return (1); if (doMount) { if (strstr (filename, "/net/") == filename) return (unlink (usePath (filename))); if (strstr (filename, "/tmp_mnt/") == filename) return (unlink (usePath (filename))); if ((mp = mountNet_ (hp)) == NULL) { return (1); } sprintf (fnamebuf, "%s%s", mp, filename); i = unlink (usePath (fnamebuf)); if (i >= 0) return i; } return (unlink (usePath (filename))); }