/* * Take a little-endian domain name and * transform into a big-endian Un*x pathname. * For example: kiska.doc.ic -> ic/doc/kiska */ static char * compute_hostpath(char *hn) { char *p = xmalloc(MAXPATHLEN); char *d; char path[MAXPATHLEN]; xstrlcpy(p, hn, MAXPATHLEN); domain_strip(p, hostname); path[0] = '\0'; do { d = strrchr(p, '.'); if (d) { *d = 0; xstrlcat(path, d + 1, sizeof(path)); xstrlcat(path, "/", sizeof(path)); } else { xstrlcat(path, p, sizeof(path)); } } while (d); fsi_log("hostpath of '%s' is '%s'", hn, path); xstrlcpy(p, path, MAXPATHLEN); return p; }
/* * Take a little-endian domain name and * transform into a big-endian Un*x pathname. * For example: kiska.doc.ic -> ic/doc/kiska */ static char * compute_hostpath(char *hn) { char *p = strdup(hn); char *d; char path[MAXPATHLEN]; domain_strip(p, hostname); path[0] = '\0'; do { d = strrchr(p, '.'); if (d) { *d = 0; strcat(path, d + 1); strcat(path, "/"); } else { strcat(path, p); } } while (d); log("hostpath of '%s' is '%s'", hn, path); strcpy(p, path); return p; }
/* * Write a host/path in NFS format */ static int write_nfsname(FILE *ef, fsmount *fp, char *hn) { int errors = 0; char *h = xstrdup(fp->f_ref->m_dk->d_host->h_hostname); domain_strip(h, hn); fprintf(ef, "%s:%s", h, fp->f_volname); XFREE(h); return errors; }
static void write_ultrix_dkrmount(FILE *ef, char *hn, fsmount *fp) { char *h = strdup(fp->f_ref->m_dk->d_host->h_hostname); domain_strip(h, hn); fprintf(ef, "%s@%s:%s:%s:%s:0:0\n", fp->f_volname, h, fp->f_localname, fp->f_fstype, fp->f_opts); XFREE(h); }
static void write_aix3_dkrmount(FILE *ef, char *hn, fsmount *fp) { char *h = strdup(fp->f_ref->m_dk->d_host->h_hostname); domain_strip(h, hn); fprintf(ef, "\n%s:\n\tdev = %s:%s\n\tvfs = %s\n\ttype = %s\n\tvol = %s\n\topts = %s\n\tmount = true\n\tcheck = true\n\tfree = false\n", fp->f_localname, h, fp->f_volname, fp->f_fstype, fp->f_fstype, fp->f_localname, fp->f_opts); XFREE(h); }
static void write_generic_dkrmount(FILE *ef, char *hn, fsmount *fp) { char *h; if (fp->f_ref) { h = strdup(fp->f_ref->m_dk->d_host->h_hostname); } else { h = strdup(fp->f_from); } domain_strip(h, hn); fprintf(ef, "%s:%s %s %s %s 0 0\n", h, fp->f_volname, fp->f_localname, fp->f_fstype, fp->f_opts); XFREE(h); }
/* * Normalize a host name */ void host_normalize(char **chp) { /* * Normalize hosts is used to resolve host name aliases * and replace them with the standard-form name. * Invoked with "-n" command line option. */ if (gopt.flags & CFM_NORMALIZE_HOSTNAMES) { struct hostent *hp; clock_valid = 0; hp = gethostbyname(*chp); if (hp && hp->h_addrtype == AF_INET) { dlog("Hostname %s normalized to %s", *chp, hp->h_name); *chp = strealloc(*chp, (char *) hp->h_name); } } domain_strip(*chp, hostd); }