int main(int argc,char *argv[]) { if (argc !=3) { printf("usage: %s from to\n", argv[0]); return(1); } return(rsync(argc, argv)); }
int aggiorna_collezione (char *collezione) { if (getuid () != 0) { printf ("ilenia: only root can update the ports tree\n\n"); return (-1); } FILE *file; char nome_file[255] = ""; strcpy (nome_file, CACHE); if ((file = fopen (nome_file, "w"))) { fclose (file); } strcpy (nome_file, "/etc/ports/"); strcat (nome_file, collezione); strcat (nome_file, ".cvsup"); if ((file = fopen (nome_file, "r"))) { fclose (file); cvsup (nome_file); return (0); } strcpy (nome_file, "/etc/ports/"); strcat (nome_file, collezione); strcat (nome_file, ".httpup"); if ((file = fopen (nome_file, "r"))) { fclose (file); httpup (nome_file); return (0); } // supporting crux ppc strcpy (nome_file, "/etc/ports/"); strcat (nome_file, collezione); strcat (nome_file, ".cvs"); if ((file = fopen (nome_file, "r"))) { fclose (file); httpup (nome_file); return (0); } strcpy (nome_file, "/etc/ports/"); strcat (nome_file, collezione); strcat (nome_file, ".rsync"); if ((file = fopen (nome_file, "r"))){ fclose(file); rsync(nome_file); return(0); } printf ("ilenia: %s not found\n\n", collezione); return (-1); }
int aggiorna_ports () { if (getuid () != 0) { printf ("ilenia: only root can update the ports tree\n\n"); return (-1); } DIR *etc_ports; struct dirent *info_file; char nome_file[255]; char estensione[255]; FILE *file; strcpy (nome_file, CACHE); if ((file = fopen (nome_file, "w"))) { fclose (file); } etc_ports = opendir ("/etc/ports"); while ((info_file = readdir (etc_ports))) { if (strstr (info_file->d_name, ".")) { strcpy (estensione, strstr (info_file->d_name, ".")); strcpy (estensione, mid (estensione, 1, FINE)); strcpy (nome_file, "/etc/ports/"); strcat (nome_file, info_file->d_name); if (strcmp (estensione, "cvsup") == 0) { cvsup (nome_file); } else if (strcmp (estensione, "httpup") == 0) { httpup (nome_file); } // supporting crux ppc else if (strcmp (estensione, "cvs") == 0) { cvs (nome_file); } else if(!strcmp(estensione, "rsync")) rsync(nome_file); } } return (0); }
/* Takes optional arguments, consult optargs_bitmask. */ int do_rsync_in (const char *remote, const char *dest_orig, int archive, int deletedest) { CLEANUP_FREE char *dest = NULL; dest = sysroot_path (dest_orig); if (!dest) { reply_with_perror ("malloc"); return -1; } if (!(optargs_bitmask & GUESTFS_RSYNC_IN_ARCHIVE_BITMASK)) archive = 0; if (!(optargs_bitmask & GUESTFS_RSYNC_IN_DELETEDEST_BITMASK)) deletedest = 0; return rsync (remote, remote, dest, dest_orig, archive, deletedest); }
/* Takes optional arguments, consult optargs_bitmask. */ int do_rsync_out (const char *src_orig, const char *remote, int archive, int deletedest) { CLEANUP_FREE char *src = NULL; src = sysroot_path (src_orig); if (!src) { reply_with_perror ("malloc"); return -1; } if (!(optargs_bitmask & GUESTFS_RSYNC_OUT_ARCHIVE_BITMASK)) archive = 0; if (!(optargs_bitmask & GUESTFS_RSYNC_OUT_DELETEDEST_BITMASK)) deletedest = 0; return rsync (src, src_orig, remote, remote, archive, deletedest); }