[Bug-wget] [GSoC] Proposal: “Design and implementation of a framework for plugins.”

2017-03-31 Thread Akash Rawal

Hello,

First of all, thanks for the initial review of my proposal!

I have made some changes in response to the comments as well as last
mail on the mailing list by Darshit Shah. Kindly consider reviewing it.
For reference here is the link.
https://docs.google.com/document/d/1SBM-jNG5dJL85C7iK9aid2eDlByrxOsYUNDrk4049vQ/edit?usp=sharing

The proposal is still not final, in the sense that I am analysing the
code for further ideas of what can be customized using plugins.

I was asked to elaborate on rewriting of command line option processing
code. So here are my thoughts on it.

The current code in src/options.c has following drawbacks:
  -  Built around order-insensitive and idempotent model (Supplying
 an option modifies a variable). This might be adequete for wget,
 but might not be the case for plugins. Repeated options or
 order of options can matter for plugins.
  -  The need for keeping the list of options sorted. I don't think
 we can expect plugin writers to do the same.
  -  And most importantly, options cannot be added at runtime.

So far I think rewriting the option processing code would be easier
than trying to patch existing code to support custom options.
Some parts of the original code could be reused but structure
would undergo a drastic change anyway.

The idea I have is to expose an interface for plugins to describe
command line options they want to receive. I have attached a
prototype header. From this interface, wget will have a list of
command line options to support, along with plugin function to
be called for handling plugin specific options. In addition to
using this to parse command line, wget can Use the descriptions
and category information provided to generate --help output.

Regarding the need to support plugin side addition of command line
options at the first place, here are my thoughts.
Plugins might need additional data from the user. I can think
of 3 ways in which it can be done:
  1. Environment variables.
  2. Files with well-known names.
  3. Command line.
Environment variables have a disadvantage that they are automatically
passed to the subprocesses, creating a chance for interference.
Also, name clashes cannot be discovered.

Using files with well-known names has a chance of interference
with parallel running instances of wget.

None of these disadvantages are shared with using command line
options.

Opinions are welcome.

Regards,
Akash Rawal.



/* This is a prototype. Final product can be different. */

/**
 * \addtogroup argp
 * \{
 *
 * This section documents functions for extending command line 
 * option processing. 
 *
 * The procedure is to first create a new option list using 
 * _wget_argp_optlist_init_. Options and categories are then added by
 * _wget_argp_optlist_add_option_ and _wget_argp_optlist_add_category_. 
 * Finally, options are added for consideration by _wget_argp_add_optlist_.
 * After this, option list should be free'd using _wget_argp_optlist_free_.
 */


///Data structure for command line options
typedef struct _wget_argp_optlist_t wget_argp_optlist_t;

/**Creates a new option list
 * \return A newly constructed option list. Free with _wget_argp_optlist_free_
 */
wget_argp_optlist_t *wget_argp_optlist_init();

/**Frees all memory associated with _optlist_.
 * \param optlist An option list created with _wget_argp_optlist_init_
 */
void wget_argp_optlist_free(wget_argp_optlist_t *optlist);

/**Adds a new category to command line options.
 * \param optlist An option list
 * \param catid Category identifier. This must be unique.
 * \param desc Description which will appear in the _--help_ output.
 */
void wget_argp_optlist_add_category
	(wget_argp_optlist_t *optlist, const char *catid, const char *desc);

///Type of command line options supported
typedef enum
{
	///Option accepts no arguments
	WGET_ARGP_ARG_NONE,
	//Option requires argument.
	WGET_ARGP_ARG_REQUIRED,
	//Option accepts argument, but it is optional.
	WGET_ARGP_ARG_OPTIONAL
} wget_argp_option_arg_type;

/**Adds a command line option to option list.
 * \param catid Category identifier to specify which category to 
 *  add option to in _--help_ output. 
 * \param optlist An option list
 * \param id A numeric ID to associate with the option.
 * \param short_option Single letter short option, or 0 for no short option.
 * \param option Long option. 
 * \param arg_desc A short description of the argument it takes.
 * \param argtype Argument accepting policy. See _wget_argp_option_arg_type_
 * \param negatable Nonzero if _option_ can be supplied as --no-option.
 * \param desc Description which will appear in _--help_ output.
 */
void wget_argp_optlist_add_option
	(wget_argp_optlist_t *optlist, 
	 const char *catid, int id, 
	 char short_option, const char *option, const char *arg_desc, 
	 wget_argp_option_arg_type argtype, int negatable,
	 const char *desc);

/**Type of function to be registered as a callback
 * \param id Identifier of the option matched
 * 

[Bug-wget] (unencrypted) Article explaining Wget in German computer magazin c't

2017-03-31 Thread Tim Rühsen
Ups, sorry for message encryption

On Freitag, 31. März 2017 14:49:45 CEST Tim Rühsen wrote:
> On 03/31/2017 02:47 PM, Giuseppe Scrivano wrote:
> > Hi Tim,
> > 
> > Tim Rühsen  writes:
> >> FYI,
> >> 
> >> c't 8/2017 has a 4 paged article explaining Wget and several kinds of
> >> usages (German language only).
> > 
> > cool!  Is there any online version of it?
> 
> Yes, but not for free, it is 1,49 €.
> 
> https://shop.heise.de/katalog/kleiner-datensauger
> 
> Regards, Tim



signature.asc
Description: This is a digitally signed message part.


Re: [Bug-wget] Article explaining Wget in German computer magazin c't

2017-03-31 Thread Tim Rühsen


binIXjEbOxIW2.bin
Description: PGP/MIME version identification


encrypted.asc
Description: OpenPGP encrypted message


Re: [Bug-wget] Article explaining Wget in German computer magazin c't

2017-03-31 Thread Giuseppe Scrivano
Hi Tim,

Tim Rühsen  writes:

> FYI,
>
> c't 8/2017 has a 4 paged article explaining Wget and several kinds of
> usages (German language only).

cool!  Is there any online version of it?

Regards,
Giuseppe



[Bug-wget] Article explaining Wget in German computer magazin c't

2017-03-31 Thread Tim Rühsen
FYI,

c't 8/2017 has a 4 paged article explaining Wget and several kinds of
usages (German language only).

Regards, Tim




signature.asc
Description: OpenPGP digital signature


Re: [Bug-wget] [GSoC] Proposal | Design and Implementation of Test Suite Using Libmicrohttpd

2017-03-31 Thread Darshit Shah
Adding Christian Grothoff to the CC. 

For all mails regarding this project, please remember to add Christian 
Grothoff, maintainer of libmicrohttpd to the recipients list 

On 30 March 2017 9:25:10 PM GMT+02:00, Didik Setiawan  
wrote:
>Hi!
>
>I have prepared a proposal for Google Summer of Code 2017. I make
>decision to 
>change my project from my initial subject intention, considering that
>currently 
>I working on small patch covering the area of test suite which make me
>more
>familiar with Wget2 codebase. 
>I know this is a bit late, but please try to give your comments and
>suggestions.
>
>Here is a Google doc for my proposal.
>https://docs.google.com/document/d/1CHy-8_yKVYrBmkC9i4Sb7shpd1feec3Dqtp2WI2KY9M/edit?usp=sharing
>
>Regards,
>Didik Setiawan

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.