Re: [PATCH 07/10] cal: make user request to be part of read-only control struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 27, 2013 at 08:42:33PM +0000, Sami Kerola wrote:
> +struct cal_request {
> +	int day;
> +	int month;
> +	long year;
> +	int week;
> +};

 It makes more sense than cal_width :-)

> +			ctl.req.day = day_in_year(ctl.req.day, ctl.req.month, ctl.req.year);

   req.day = calculate_request_day(&req);

> -static void monthly(int day, int month, long year, const struct cal_control *ctl)
> +static void monthly(const struct cal_control *ctl)
...  
> -	rows = do_monthly(day, month, year, &out, -1, ctl);
> +	rows = do_monthly(ctl->req.day, ctl->req.month, ctl->req.year, &out, -1, ctl);
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 Well, if you have a request struct then use it!

      do_monthly(req, &out, -1, ctl);


 Maybe you can keep request and control structs independent, so then
 one day you can implement something like  
 
    cal --date=Dec-2013 --date=Dec-2014

 to print more independent calendars :-)

 
    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux