#include
List of all members.
Public Types |
|
enum ? |
status { ??locked_by_user, locked_by_another_user, not_locked, still_locked, ??still_unlocked } |
Static Public Methods |
|
status? | lock () |
status? | unlock () |
status? | check () |
|
? |
Definition at line 13 of file cmt_lock.h. Referenced by check(), Cmt::do_lock(), Cmt::do_unlock(), lock(), and unlock(). 00014 { 00015 locked_by_user, 00016 locked_by_another_user, 00017 not_locked, 00018 still_locked, 00019 still_unlocked 00020 } status; |
|
? |
Definition at line 105 of file cmt_lock.cxx. References cmt_string::read(), cmt_vector< cmt_string >::size(), CmtSystem::split(), status, and CmtSystem::user(). Referenced by Cmt::do_broadcast(), Cmt::do_build_constituent_makefile(), Cmt::do_build_constituents_makefile(), Cmt::do_build_dependencies(), Cmt::do_build_library_links(), Cmt::do_build_make_setup(), Cmt::do_build_msdev(), Cmt::do_build_os9_makefile(), Cmt::do_build_prototype(), Cmt::do_build_readme(), Cmt::do_build_tag_makefile(), Cmt::do_build_triggers(), Cmt::do_build_vsnet(), Cmt::do_build_windefs(), Cmt::do_config(), Cmt::do_remove_library_links(), lock(), and unlock(). 00106 { 00107 cmt_string me = CmtSystem::user (); 00108 cmt_string text; 00109 00110 if (text.read ("lock.cmt")) 00111 { 00112 CmtSystem::cmt_string_vector words; 00113 00114 CmtSystem::split (text, " ", words); 00115 00116 if (words.size () >= 3) 00117 { 00118 if (words[2] == me) 00119 { 00120 return (locked_by_user); 00121 } 00122 else 00123 { 00124 return (locked_by_another_user); 00125 } 00126 } 00127 } 00128 00129 return (not_locked); 00130 } |
|
? |
Definition at line 14 of file cmt_lock.cxx. References Symbol::build_macro_value(), CmtError::cannot_lock, CmtError::cannot_run_lock_command, CmtError::cannot_write_lock, check(), CmtSystem::execute(), Symbol::find(), locked_by_another_user, locked_by_user, not_locked, CmtSystem::now(), CmtError::set(), status, CmtSystem::user(), and cmt_string::write(). Referenced by Cmt::do_lock(). 00015 { 00016 status s = check (); 00017 00018 switch (s) 00019 { 00020 case locked_by_user: 00021 cout << "Package already locked by you" << endl; 00022 return (s); 00023 case locked_by_another_user: 00024 CmtError::set (CmtError::cannot_lock, "lock> Package already locked by another user"); 00025 return (s); 00026 case not_locked: 00027 break; 00028 } 00029 00030 cmt_string text = "locked by "; 00031 text += CmtSystem::user (); 00032 text += " date "; 00033 text += CmtSystem::now (); 00034 00035 if (!text.write ("lock.cmt")) 00036 { 00037 CmtError::set (CmtError::cannot_write_lock, "lock>"); 00038 return (still_unlocked); 00039 } 00040 00041 Symbol* lock_command = Symbol::find ("lock_command"); 00042 if (lock_command != 0) 00043 { 00044 cmt_string command = lock_command->build_macro_value (); 00045 00046 if (command != "") 00047 { 00048 if (CmtSystem::execute (command) != 0) 00049 { 00050 CmtError::set (CmtError::cannot_run_lock_command, "lock>"); 00051 return (still_unlocked); 00052 } 00053 } 00054 } 00055 00056 cout << "Package now locked" << endl; 00057 00058 return (locked_by_user); 00059 } |
|
? |
Definition at line 62 of file cmt_lock.cxx. References Symbol::build_macro_value(), CmtError::cannot_remove_lock, CmtError::cannot_run_unlock_command, CmtError::cannot_unlock, check(), CmtSystem::execute(), Symbol::find(), locked_by_another_user, locked_by_user, not_locked, CmtSystem::remove_file(), CmtError::set(), and status. Referenced by Cmt::do_unlock(). 00063 { 00064 status s = check (); 00065 00066 switch (s) 00067 { 00068 case locked_by_user: 00069 break; 00070 case locked_by_another_user: 00071 CmtError::set (CmtError::cannot_unlock, "unlock> Package locked by another user"); 00072 return (s); 00073 case not_locked: 00074 cout << "The package was not locked" << endl; 00075 return (s); 00076 } 00077 00078 Symbol* unlock_command = Symbol::find ("unlock_command"); 00079 if (unlock_command != 0) 00080 { 00081 cmt_string command = unlock_command->build_macro_value (); 00082 00083 if (command != "") 00084 { 00085 if (CmtSystem::execute (command) != 0) 00086 { 00087 CmtError::set (CmtError::cannot_run_unlock_command, "unlock>"); 00088 return (still_locked); 00089 } 00090 } 00091 } 00092 00093 if (!CmtSystem::remove_file ("lock.cmt")) 00094 { 00095 CmtError::set (CmtError::cannot_remove_lock, "unlock>"); 00096 return (still_locked); 00097 } 00098 00099 cout << "Package now unlocked" << endl; 00100 00101 return (not_locked); 00102 } |