Re: [PATCH] batch mode and cmd-line option treatment

Urs Janßen <[email protected]> Fri, 17 Jul 2009 23:41:59 +0200
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
On Fri, Jul 17, 2009 at 08:48:15PM +0200, Dennis Preiser wrote:
> Hello,
> 
> regarding batch-mode and cmd-line option treatment the attached patch  
> does the following:
> 
> - '-s', '-m' and '-G' cmd-line switches no longer changes the  
> corresponding tinrc values implicitly. A new struct 'cmdline' is used  
> which holds the given cmd-line options and a bitmap which indicates  
> which options were given via cmd-line. The former cmdline_nntpserver  
> is incorporated in this struct as well as use_color ('-a') (needed to  
> decide in read_config_file() whether to toggle tinrc.use_color or  
> not). cmd-line mail/savedir has higher priority as attributes and  
> tinrc values. Now, if '-s' was given when saving for later reading ('- 
> S -s dirname') the same savedir must be given when reading these  
> saved news ('-R -s dirname').

IIRC that's on the TODO-list for ages

> - batch mode (!verbose) was not really quiet (txt_reading_config_file  
> and an additional newline was shiped out, not useful for scripting).  

as cmd-line args were read after the configfile so at that stage we didn't
know if we have to be quiet or not, as you reordered the code (which wasn't
possible before you introduced the above struct) we now can surpess the
message and we can do the curses init before that (you missed that
in your patch - if localy done that) so the messages goes on the
curses-screen.

> - batch mode (verbose) was not really verbose (some of the startup  
> messages were printed and some not). See tin vs. tin -vZ. Now, tin  
> prints all startup messages in verbose batch mode. If this is not  
> useful, I can change this to a subset of the startup messages.

IMHO giving all messages is ok

> - I removed write_config_file() after create_mail_save_dirs() in  
> main.c. (no changes during startup -> no need to write the config file)

IIRC the create_mail_save_dirs() was some kind of 'first usage' check,
with the new code some files in $TIN_HOMEDIR/.tin are created but tinrc is
not

testcase:

TIN_HOMEDIR=/tmp tin -vZ
ls -la /tmp/.tin
 
> - The group->attribute->savefile update in feed.c:get_save_filename()  
> is deactivated now. If we want to update the value we have to adjust  
> the scope, but I'm not sure whether this update is needed here. I  
> think it's better to leave the attributes untouched except the user  
> changes them via the attributes menu.

not changing group->attribute->savefile here sounds reasonable

> - '-w' now suggests the first given cmd-line group as default group  
> to post to. In case of a wildcarded groupname the first match is  
> used. I decided to use only the first group because a wildcarded  
> group can result in a huge list (e.g., comp.*) which cannot be  
> reasonably handled.

IIRC a long term TODO-item

> If these changes are acceptable, I will send in another patch wich  
> updates the man-page (e.g., '-w' and cmd-line groups, impact on '- 
> S'/'-R'...).

and the TODO/WHATSNEW files, please.

urs
-- 
"Only whimps use tape backup: _real_ men just upload their important stuff
 on ftp, and let the rest of the world mirror it ;)" - Linus