00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <Basics.H>
00028 #include <Text.H>
00029 #include <VestaConfig.H>
00030 #include <VestaSource.H>
00031 #include <VDirSurrogate.H>
00032 #if !defined(__sun__)
00033 extern "C" {
00034 #include <getopt.h>
00035 }
00036 #endif
00037
00038 using std::cout;
00039 using std::cerr;
00040 using std::endl;
00041
00042 Text program_name;
00043
00044 void
00045 Usage()
00046 {
00047 cerr << "Usage: " << program_name <<
00048 " [-R repos]" << endl << endl;
00049 exit(3);
00050 }
00051
00052 int
00053 main(int argc, char* argv[])
00054 {
00055 try {
00056 program_name = argv[0];
00057 Text repos;
00058
00059 int c;
00060 for (;;) {
00061 c = getopt(argc, argv, "h?R:");
00062 if (c == EOF) break;
00063 switch (c) {
00064 case 'R': repos = optarg; break;
00065 case 'h':
00066 case '?':
00067 default:
00068 Usage();
00069 }
00070 }
00071
00072 Text lhost(VDirSurrogate::defaultHost());
00073 Text lport(VDirSurrogate::defaultPort());
00074 if (repos != "") {
00075 int colon = repos.FindCharR(':');
00076 if (colon == -1) {
00077 lhost = repos;
00078 repos = repos + ":" + lport;
00079 } else {
00080 lhost = repos.Sub(0, colon);
00081 lport = repos.Sub(colon+1);
00082 }
00083 }
00084
00085
00086
00087 VDirSurrogate::refreshAccessTables(NULL, lhost, lport);
00088
00089
00090 cout << "Repository access tables refreshed." << endl;
00091
00092 } catch (VestaConfig::failure f) {
00093 cerr << program_name << ": " << f.msg << endl;
00094 exit(1);
00095 } catch (SRPC::failure f) {
00096 cerr << program_name
00097 << ": SRPC failure; " << f.msg << " (" << f.r << ")" << endl;
00098 exit(2);
00099 }
00100
00101 return 0;
00102 }
00103