# HG changeset patch # User John W. Eaton # Date 1264062323 18000 # Node ID be952ce74023db61d3288945628e51de199f8fc2 # Parent 326746625a51b244dc523f821d37959d8b4e2478 bootstrap.conf fixes diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-01-21 John W. Eaton + + * bootstrap.conf (gnulib_modules): Include unistd in the list. + Keep list sorted. + 2010-01-21 John W. Eaton * configure.ac: Delete checks for rename, link, readlink, rmdir, diff --git a/bootstrap.conf b/bootstrap.conf --- a/bootstrap.conf +++ b/bootstrap.conf @@ -37,6 +37,7 @@ strptime symlink times + unistd unlink round " diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,7 @@ 2010-01-21 John W. Eaton + * file-ops.h, file-ops.cc, lo-utils.h, lo-cutils.c: Untabify. + * file-ops.cc: Don't include unistd.h. (NOT_SUPPORTED): Delete unused macro. diff --git a/liboctave/file-ops.cc b/liboctave/file-ops.cc --- a/liboctave/file-ops.cc +++ b/liboctave/file-ops.cc @@ -79,7 +79,7 @@ if (! instance) { (*current_liboctave_error_handler) - ("unable to create file_ops::static_members object!"); + ("unable to create file_ops::static_members object!"); retval = false; } @@ -156,7 +156,7 @@ int file_ops::link (const std::string& old_name, - const std::string& new_name, std::string& msg) + const std::string& new_name, std::string& msg) { msg = std::string (); @@ -184,7 +184,7 @@ int file_ops::symlink (const std::string& old_name, - const std::string& new_name, std::string& msg) + const std::string& new_name, std::string& msg) { msg = std::string (); @@ -212,7 +212,7 @@ int file_ops::readlink (const std::string& path, std::string& result, - std::string& msg) + std::string& msg) { int status = -1; @@ -248,7 +248,7 @@ int file_ops::rename (const std::string& from, const std::string& to, - std::string& msg) + std::string& msg) { int status = -1; @@ -315,49 +315,49 @@ string_vector dirlist = dir.read (); for (octave_idx_type i = 0; i < dirlist.length (); i++) - { - octave_quit (); + { + octave_quit (); - std::string nm = dirlist[i]; + std::string nm = dirlist[i]; - // Skip current directory and parent. - if (nm == "." || nm == "..") - continue; + // Skip current directory and parent. + if (nm == "." || nm == "..") + continue; - std::string fullnm = name + file_ops::dir_sep_str () + nm; + std::string fullnm = name + file_ops::dir_sep_str () + nm; - // Get info about the file. Don't follow links. - file_stat fs (fullnm, false); + // Get info about the file. Don't follow links. + file_stat fs (fullnm, false); - if (fs) - { - if (fs.is_dir ()) - { - status = recursive_rmdir (fullnm, msg); + if (fs) + { + if (fs.is_dir ()) + { + status = recursive_rmdir (fullnm, msg); - if (status < 0) - break; - } - else - { - status = unlink (fullnm, msg); + if (status < 0) + break; + } + else + { + status = unlink (fullnm, msg); - if (status < 0) - break; - } - } - else - { - msg = fs.error (); - break; - } - } + if (status < 0) + break; + } + } + else + { + msg = fs.error (); + break; + } + } if (status >= 0) - { - dir.close (); - status = file_ops::rmdir (name, msg); - } + { + dir.close (); + status = file_ops::rmdir (name, msg); + } } else { @@ -425,16 +425,16 @@ OCTAVE_LOCAL_BUFFER (char, resolved, resolved_size); int resolved_len - = ::resolvepath (absolute_name.c_str (), resolved, resolved_size); + = ::resolvepath (absolute_name.c_str (), resolved, resolved_size); if (resolved_len < 0) - break; + break; if (resolved_len < resolved_size) - { - retval = resolved; - break; - } + { + retval = resolved; + break; + } } #elif defined (__WIN32__) @@ -452,13 +452,13 @@ else if (status < n) { win_path.resize (status); - retval = win_path; - break; + retval = win_path; + break; } else { n *= 2; - win_path.resize (n); + win_path.resize (n); } } @@ -506,7 +506,7 @@ std::string file_ops::tempnam (const std::string& dir, const std::string& pfx, - std::string& msg) + std::string& msg) { msg = std::string (); @@ -590,18 +590,18 @@ if (! prefixes.empty ()) { for (size_t i = 0; i < s_len; i++) - { - for (int j = 0; j < prefixes.length (); j++) - { - size_t pfx_len = prefixes[j].length (); + { + for (int j = 0; j < prefixes.length (); j++) + { + size_t pfx_len = prefixes[j].length (); - if (prefixes[j].compare (s.substr (i, pfx_len)) == 0) - { - len = pfx_len - 1; - return i + len; - } - } - } + if (prefixes[j].compare (s.substr (i, pfx_len)) == 0) + { + len = pfx_len - 1; + return i + len; + } + } + } } return s_len; @@ -622,18 +622,18 @@ for ( ; i < s_len; i++) { if (file_ops::is_dir_sep (s[i])) - break; + break; if (! suffixes.empty ()) - { - for (int j = 0; j < suffixes.length (); j++) - { - size_t sfx_len = suffixes[j].length (); + { + for (int j = 0; j < suffixes.length (); j++) + { + size_t sfx_len = suffixes[j].length (); - if (suffixes[j].compare (s.substr (i, sfx_len)) == 0) - return i; - } - } + if (suffixes[j].compare (s.substr (i, sfx_len)) == 0) + return i; + } + } } return i; @@ -681,10 +681,10 @@ if (file_ops::tilde_expansion_preexpansion_hook) { std::string expansion - = file_ops::tilde_expansion_preexpansion_hook (username); + = file_ops::tilde_expansion_preexpansion_hook (username); if (! expansion.empty ()) - return expansion + filename.substr (user_len+1); + return expansion + filename.substr (user_len+1); } // No preexpansion hook, or the preexpansion hook failed. Look in the @@ -698,19 +698,19 @@ // and we couldn't find a standard expansion, then let them try. if (file_ops::tilde_expansion_failure_hook) - { - std::string expansion - = file_ops::tilde_expansion_failure_hook (username); + { + std::string expansion + = file_ops::tilde_expansion_failure_hook (username); - if (! expansion.empty ()) - dirname = expansion + filename.substr (user_len+1); - } + if (! expansion.empty ()) + dirname = expansion + filename.substr (user_len+1); + } // If we don't have a failure hook, or if the failure hook did not // expand the tilde, return a copy of what we were passed. if (dirname.length () == 0) - dirname = filename; + dirname = filename; } else dirname = pw.dir () + filename.substr (user_len+1); @@ -737,42 +737,42 @@ size_t pos = 0; while (1) - { - if (pos > name_len) - break; + { + if (pos > name_len) + break; - size_t len; + size_t len; - // Make START point to the tilde which starts the expansion. + // Make START point to the tilde which starts the expansion. - size_t start = tilde_find_prefix (name.substr (pos), len); + size_t start = tilde_find_prefix (name.substr (pos), len); - result.append (name.substr (pos, start)); + result.append (name.substr (pos, start)); - // Advance STRING to the starting tilde. + // Advance STRING to the starting tilde. - pos += start; + pos += start; - // Make FINI be the index of one after the last character of the - // username. + // Make FINI be the index of one after the last character of the + // username. - size_t fini = tilde_find_suffix (name.substr (pos)); + size_t fini = tilde_find_suffix (name.substr (pos)); - // If both START and FINI are zero, we are all done. + // If both START and FINI are zero, we are all done. - if (! (start || fini)) - break; + if (! (start || fini)) + break; - // Expand the entire tilde word, and copy it into RESULT. + // Expand the entire tilde word, and copy it into RESULT. - std::string tilde_word = name.substr (pos, fini); + std::string tilde_word = name.substr (pos, fini); - pos += fini; + pos += fini; - std::string expansion = tilde_expand_word (tilde_word); + std::string expansion = tilde_expand_word (tilde_word); - result.append (expansion); - } + result.append (expansion); + } return result; } diff --git a/liboctave/file-ops.h b/liboctave/file-ops.h --- a/liboctave/file-ops.h +++ b/liboctave/file-ops.h @@ -66,7 +66,7 @@ static std::string tempnam (const std::string&, const std::string&); static std::string tempnam (const std::string&, const std::string&, - std::string&); + std::string&); typedef std::string (*tilde_expansion_hook) (const std::string&); diff --git a/liboctave/lo-cutils.c b/liboctave/lo-cutils.c --- a/liboctave/lo-cutils.c +++ b/liboctave/lo-cutils.c @@ -84,7 +84,7 @@ OCTAVE_API void octave_qsort (void *base, size_t n, size_t size, - int (*cmp) (const void *, const void *)) + int (*cmp) (const void *, const void *)) { qsort (base, n, size, cmp); } diff --git a/liboctave/lo-utils.h b/liboctave/lo-utils.h --- a/liboctave/lo-utils.h +++ b/liboctave/lo-utils.h @@ -41,7 +41,8 @@ extern OCTAVE_API char *strsave (const char *); -extern OCTAVE_API void octave_putenv (const std::string&, const std::string&); +extern OCTAVE_API void +octave_putenv (const std::string&, const std::string&); extern OCTAVE_API std::string octave_fgets (std::FILE *); extern OCTAVE_API std::string octave_fgetl (std::FILE *); @@ -60,23 +61,29 @@ extern "C" OCTAVE_API int octave_readlink (const char *name, char *buf, size_t size); -extern "C" OCTAVE_API int octave_mkdir (const char *name, mode_t mode); +extern "C" OCTAVE_API int +octave_mkdir (const char *name, mode_t mode); -extern "C" OCTAVE_API int octave_mkfifo (const char *name, mode_t mode); +extern "C" OCTAVE_API int +octave_mkfifo (const char *name, mode_t mode); -extern "C" OCTAVE_API void octave_qsort (void *base, size_t n, size_t size, - int (*cmp) (const void *, const void *)); +extern "C" OCTAVE_API void +octave_qsort (void *base, size_t n, size_t size, + int (*cmp) (const void *, const void *)); extern "C" OCTAVE_API int octave_rmdir (const char *name); -extern "C" OCTAVE_API int octave_rename (const char *from, const char *to); +extern "C" OCTAVE_API int +octave_rename (const char *from, const char *to); + +extern "C" OCTAVE_API char * +oct_strptime (const char *buf, const char *format, struct tm *tm); -extern "C" OCTAVE_API char *oct_strptime (const char *buf, const char *format, - struct tm *tm); +extern "C" OCTAVE_API int +octave_strcasecmp (const char *s1, const char *s2); -extern "C" OCTINTERP_API int octave_strcasecmp (const char *s1, const char *s2); - -extern "C" OCTINTERP_API int octave_strncasecmp (const char *s1, const char *s2, size_t n); +extern "C" OCTAVE_API int +octave_strncasecmp (const char *s1, const char *s2, size_t n); extern "C" OCTAVE_API char * octave_tempnam (const char *pdir, const char *ppfx); @@ -124,18 +131,26 @@ return octave_read_value (is); } -extern OCTAVE_API void octave_write_double (std::ostream& os, double dval); -extern OCTAVE_API void octave_write_complex (std::ostream& os, const Complex& cval); +extern OCTAVE_API void +octave_write_double (std::ostream& os, double dval); + +extern OCTAVE_API void +octave_write_complex (std::ostream& os, const Complex& cval); -extern OCTAVE_API void octave_write_float (std::ostream& os, float dval); -extern OCTAVE_API void octave_write_float_complex (std::ostream& os, const FloatComplex& cval); +extern OCTAVE_API void +octave_write_float (std::ostream& os, float dval); + +extern OCTAVE_API void +octave_write_float_complex (std::ostream& os, const FloatComplex& cval); #ifdef HAVE_LOADLIBRARY_API #include -extern "C" OCTAVE_API void * octave_w32_library_search (HINSTANCE handle, const char *name); +extern "C" OCTAVE_API void * +octave_w32_library_search (HINSTANCE handle, const char *name); #undef min #undef max #endif #endif -extern "C" OCTAVE_API pid_t octave_waitpid (pid_t pid, int *status, int options); +extern "C" OCTAVE_API pid_t +octave_waitpid (pid_t pid, int *status, int options);