function [ y, m, d ] = day_borrow_eg_civil ( y, m, d )

%*****************************************************************************80
%
%% day_borrow_eg_civil() borrows days from months in an Egyptian Civil date.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 June 2012
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer Y, M, D, the YMD date.
%
%  Output:
%
%    integer Y, M, D, the YMD date after borrowing.
%
  while ( d <= 0 )

    m = m - 1;

    [ y, m ] = month_borrow_eg_civil ( y, m );

    days = month_length_eg_civil ( y, m );

    d = d + days;

  end

  return
end
