//********************************************************// int main(int argc, char *argv[]) { struct dpm_filestatus *filestatuses; int i; int nbfiles; int nbprotocols; int nbreplies; static char *protocols[] = {"rfio"}; int r = 0; //char r_token[CA_MAXDPMTOKENLEN+1]; //struct dpm_putfilereq *reqfiles; int status; //time_t lifetime; time_t actual_lifetime; int nbprotos; char **lprotos; int nbsurls; //char **lsurls; int thisarg; int nbargs; char **remargs; #include "dpmgdebug.h" if (argc < 2) { fprintf (stderr, "usage: %s SURL\n", argv[0]); exit (1); } // gnu opts reset_global(); /* must be before parser */ prog_gname = strdup(argv[0]); printf (" before arg_parse \n"); thisarg = arg_parse(argc, argv); printf ("\n after arg_parse %s %d %d \n", argv[thisarg], argc, thisarg); remargs = NULL; nbargs = 0; if ( argc > thisarg ) { remargs = realloc(remargs, sizeof(char*)*(argc-thisarg)); } while ( thisarg < argc ) { remargs[nbargs++] = strdup(argv[thisarg++]); } if ( nbargs != 1 ) { perror (" dpm-replicate: one SURL, and only one, must be provided "); exit(1); } nbfiles = nbargs; printf( " Last arg: %d %s %s \n\n", nbargs, remargs[0], remargs[nbargs-1]); // Loading inputs printf (" \n"); /* #define V_LSTR(NAME, UNAME) \ nb ## NAME = 0; \ l ## NAME = NULL; \ item_store(DPM_ ## UNAME, &nb ## NAME, &l ## NAME); \ p_array( #UNAME , nb ## NAME, l ## NAME); V_LSTR(protos, PROT) */ // Setting defaults if ( ! dpm_rtoken ) { perror (" Reqid token option is mandatory: --dpmrtoken=request_token "); exit(1); } if ( ! dpm_lifet ) { dpm_lifet = 0; } nbsurls = nbargs; printf (" \n"); if ((status = dpm_replicate (dpm_rtoken, remargs[0], dpm_lifet, &actual_lifetime )) < 0) { sperror ("dpm_replicate"); exit (1); } printf ("request state %s\n", status == DPM_DONE ? "Done" : "Failed"); if (status == DPM_FAILED) exit (1); return 0; }
//********************************************************// int main(int argc, char *argv[]) { //struct dpm_filestatus *filestatuses; //struct dpm_tokeninfo *tokeninfos; struct dpm_pool *lpools; int i; int nbfiles; int nbprotocols; int nbreplies; static char *protocols[] = {"rfio"}; int r = 0; //char r_token[CA_MAXDPMTOKENLEN+1]; //struct dpm_putfilereq *reqfiles; int status; int nbprotos; //char **lpools; int nbsurls; //char **lsurls; int thisarg; int nbargs; char **remargs; #include "dpmgdebug.h" if (argc > 1) { fprintf (stderr, "usage: %s \n", argv[0]); exit (1); } // gnu opts reset_global(); /* must be before parser */ prog_gname = strdup(argv[0]); //printf (" before arg_parse \n"); thisarg = arg_parse(argc, argv); //printf ("\n after arg_parse %s %d %d \n", argv[thisarg], argc, thisarg); remargs = NULL; nbargs = 0; if ( argc > thisarg ) { remargs = realloc(remargs, sizeof(char*)*(argc-thisarg)); } while ( thisarg < argc ) { remargs[nbargs++] = strdup(argv[thisarg++]); } /* if ( nbargs != 1 ) { */ /* perror (" dpm-getpools: 1 arg must be provided, see --help"); */ /* exit(1); */ /* } */ nbfiles = nbargs; if ( nbargs ) printf( " Last arg: %d %s %s \n\n", nbargs, remargs[0], remargs[nbargs-1]); // Loading inputs printf (" \n"); /* #define V_LSTR(NAME, UNAME) \ nb ## NAME = 0; \ l ## NAME = NULL; \ item_store(DPM_ ## UNAME, &nb ## NAME, &l ## NAME); \ p_array( #UNAME , nb ## NAME, l ## NAME); V_LSTR(protos, PROT) */ // Setting defaults /* if ( ! dpm_rtoken ) { */ /* perror (" Reqid token option is mandatory: --dpmrtoken=request_token "); */ /* exit(1); */ /* } */ nbsurls = nbargs; printf (" \n"); if ((status = dpm_getpools (&nbreplies, &lpools )) < 0) { sperror ("dpm_getpools"); exit (1); } printf ("request state %s\n", status == DPM_SUCCESS ? "Done" : "Failed"); if (status == DPM_FAILED) exit (1); printf ("Current pools: "); for (i = 0; i < nbreplies; i++) { printf(" %s", lpools[i].poolname); } printf (" \n"); free(lpools); return 0; }
//********************************************************// int main(int argc, char *argv[]) { //static char *f_stat[] = {"Success", "Queued", "Active", "Ready", "Running", "Done", "Failed", "Aborted"}; //#include "dpmestat.h" int i; //int r = 0; //char s_token[CA_MAXDPMTOKENLEN+1]; char** s_tokens; //char* s_tokens[CA_MAXDPMTOKENLEN+1]; char u_token[CA_MAXDPMTOKENLEN+1]; int status; int thisarg; int nbreplies; /* char s_type; */ /* u_signed64 req_t_space; */ /* u_signed64 req_g_space; */ /* time_t req_lifetime; */ /* char actual_s_type; */ /* u_signed64 actual_t_space; */ /* u_signed64 actual_g_space; */ /* time_t actual_lifetime; */ #include "dpmgdebug.h" if (argc < 2) { fprintf (stderr, "usage: %s [-|user_space_token_description]\n", argv[0]); exit (1); } // gnu opts reset_global(); /* must be before parser */ prog_gname = strdup(argv[0]); //Pprintf (" before arg_parse \n"); thisarg = arg_parse(argc, argv); //Pprintf ("\n after arg_parse %s %d %d \n", argv[thisarg], argc, thisarg); //u_token = argv[thisarg++]; strncpy(u_token, argv[thisarg++], CA_MAXDPMTOKENLEN+1); // Loading inputs //Pprintf (" \n"); // Setting defaults printf (" u_token: %s \n", u_token); if ( strchr(u_token, '-' ) == u_token ) { printf (" Nu_token: %s \n", u_token); if ((status = dpm_getspacetoken (NULL, &nbreplies, &s_tokens )) < 0) { sperror ("dpm_getspacetoken"); exit (1); } } else { printf (" Cu_token: %s \n", u_token); if ((status = dpm_getspacetoken (u_token, &nbreplies, &s_tokens )) < 0) { sperror ("dpm_getspacetoken"); exit (1); } } printf ("dpm_getspacetoken returned nbreplies: %d\n", nbreplies); printf ("request state %s\n", status == DPM_SUCCESS ? "Done" : "Failed"); if (status == DPM_FAILED) exit (1); for (i = 0; i < nbreplies; i++) { printf ("s_token[%d] = %s\n", i, s_tokens[i]); free(s_tokens[i]); } return 0; }