[patch] doc fixes

View: New views
3 Messages — Rating Filter:   Alert me  

[patch] doc fixes

by David Kuehling :: Rate this Message:

| View Threaded | Show Only this Message

Hi,

attached you find a patch (against head) that fixes the gnunet-search
manual page and the --help output of gnunet-pseudonym.

BTW I somewhat dislike the current implementation of keyword parsing in
gnunet-search: if there is only one argument, the argument is broken at
spaces, if there is more than one arguments, each argument is taken
(almost) literally as a keyword.

$ gnunet-search "Das Kapital"

searches for ("Das" OR "Kapital")

while

$ gnunet-search "Marx" "Das Kapital"

searches for ("Marx" OR "Das Kapital")

I'd suggest to _not_ change argument treatment based on the number of
arguments, and never break arguments at spaces.  However, for shell
scripts etc it might be nice to have an option to specify a single
keyword string to be broken.  Why not support that via specific option?

e.g.

$ gnunet-search --search-string="Das Kapital"

to search for ("Das" OR "Kapital")

If you're ok with it, I could submit a patch that implements such a fix
and updates the man-page once again.

cheers,

David
--
GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40


Index: src/applications/fs/tools/gnunet-pseudonym.c
===================================================================
--- src/applications/fs/tools/gnunet-pseudonym.c (revision 8452)
+++ src/applications/fs/tools/gnunet-pseudonym.c (working copy)
@@ -88,7 +88,7 @@
    gettext_noop
    ("use the given keyword to advertise the namespace (use when creating a new pseudonym)"),
    1, &GNUNET_ECRS_getopt_configure_set_keywords, &advertisement},
-  {'m', "meta", "TYPE=VALUE",
+  {'m', "meta", "TYPE:VALUE",
    gettext_noop ("specify metadata describing the namespace or collection"),
    1, &GNUNET_ECRS_getopt_configure_set_metadata, &meta},
   {'n', "no-advertisement", NULL,
Index: doc/man/gnunet-search.1
===================================================================
--- doc/man/gnunet-search.1 (revision 8452)
+++ doc/man/gnunet-search.1 (working copy)
@@ -3,7 +3,7 @@
 gnunet\-search \- a command line interface to search for content on GNUnet
 .SH SYNOPSIS
 .B gnunet\-search
-[\fIOPTIONS\fR] KEYWORD [AND KEYWORD]*
+[\fIOPTIONS\fR] [+]KEYWORD [[+]KEYWORD]*
 .SH DESCRIPTION
 .PP
 Search for content on GNUnet. The keywords are case-sensitive.  gnunet\-search can be used both for a search in the global namespace as well as for searching a private subspace.
@@ -40,17 +40,21 @@
 print the version number
 .SH NOTES
 
-You can run gnunet\-search with an URI instead of a keyword.  The URI can have the format for a namespace search or for a keyword search.  For a namespace search, the format is gnunet://ecrs/sks/NAMESPACE/IDENTIFIER.  For a keyword search, use gnunet://ecrs/ksk/KEYWORD[+KEYWORD]*.  If the format does not correspond to a GNUnet URI, GNUnet will automatically assume that keywords are supplied directly.  If multiple words are passed as keywords that are not separated by an AND, gnunet-search will concatenate them to one bigger keyword.  Thus
+You can run gnunet\-search with an URI instead of a keyword.  The URI can have the format for a namespace search or for a keyword search.  For a namespace search, the format is gnunet://ecrs/sks/NAMESPACE/IDENTIFIER.  For a keyword search, use gnunet://ecrs/ksk/KEYWORD[+KEYWORD]*.  If the format does not correspond to a GNUnet URI, GNUnet will automatically assume that keywords are supplied directly.  If only one keyword argument is supplied, gnunet\-search will split the argument at any spaces to yield more keywords:
 
-# gnunet\-search Das Kapital
+# gnunet\-search +Das +Kapital
 
 and
 
-# gnunet\-search "Das Kapital"
+# gnunet\-search "+Das +Kapital"
 
-are identical. You can use AND to separate keywords. In that case, gnunet\-search will only display results that match all the keywords.  gnunet\-search cannot do multiple independent queries ("OR"), you must use multiple processes for that.
+are identical.  Both search for any content matching keywords "Das" and "Kapital".  In general, if multiple keywords are passed, gnunet-search will look for content matching any of the keywords.  The prefix "+" makes a keyword mandatory.  Quotes "..." can be used to form keywords that contain spaces.  But be carefull to protect these quotes from the shell:
+
+# gnunet\-search "\\"Das Kapital\\""
+
+searches for content matching the keyword "Das Kapital".  
+
 Search results are printed by gnunet\-search like this:
-
 .P
  gnunet\-download \-o "COPYING" gnunet://ecrs/chk/HASH1.HASH2.SIZE
 


_______________________________________________
GNUnet-developers mailing list
GNUnet-developers@...
http://lists.gnu.org/mailman/listinfo/gnunet-developers

attachment0 (194 bytes) Download Attachment

Re: [patch] doc fixes

by Christian Grothoff :: Rate this Message:

| View Threaded | Show Only this Message

On Wednesday 06 May 2009 08:01:21 am David Kuehling wrote:
> Hi,
>
> attached you find a patch (against head) that fixes the gnunet-search
> manual page and the --help output of gnunet-pseudonym.

Patch applied. Thank you!

> BTW I somewhat dislike the current implementation of keyword parsing in
> gnunet-search: if there is only one argument, the argument is broken at
> spaces, if there is more than one arguments, each argument is taken
> (almost) literally as a keyword.
>
> $ gnunet-search "Das Kapital"
>
> searches for ("Das" OR "Kapital")
>
> while
>
> $ gnunet-search "Marx" "Das Kapital"
>
> searches for ("Marx" OR "Das Kapital")

I agree that this is not nice.

> I'd suggest to _not_ change argument treatment based on the number of
> arguments, and never break arguments at spaces.  However, for shell
> scripts etc it might be nice to have an option to specify a single
> keyword string to be broken.  Why not support that via specific option?
>
> e.g.
>
> $ gnunet-search --search-string="Das Kapital"
>
> to search for ("Das" OR "Kapital")
>
> If you're ok with it, I could submit a patch that implements such a fix
> and updates the man-page once again.

Sounds good to me.

Christian


_______________________________________________
GNUnet-developers mailing list
GNUnet-developers@...
http://lists.gnu.org/mailman/listinfo/gnunet-developers

Re: [patch] doc fixes

by David Kuehling :: Rate this Message:

| View Threaded | Show Only this Message

>>>>> "Christian" == Christian Grothoff <christian@...> writes:

>> BTW I somewhat dislike the current implementation of keyword parsing
>> in gnunet-search: if there is only one argument, the argument is
>> broken at spaces, if there is more than one arguments, each argument
>> is taken (almost) literally as a keyword.
[..]

> I agree that this is not nice.

>> I'd suggest to _not_ change argument treatment based on the number of
>> arguments, and never break arguments at spaces.  
[..]

> Sounds good to me.

Looking at the source code again, it looks like special treatment in
case of a single argument does _only_ apply to gnunet:// URIs.
GNUNET_ECRS_keyword_command_line_to_uri() always strcmps against
GNUNET_ECRS_URI_PREFIX before calling GNUNET_ECRS_string_to_uri().

I was mislead to assume the wrong behaviour by the outdated manpage.  

Another man-page update to document the correct, real behaviour is
attached.  This one also fixes a number of minor formatting
inconsistencies.

cheers,

David
--
GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40

Index: doc/man/gnunet-search.1
===================================================================
--- doc/man/gnunet-search.1 (revision 8453)
+++ doc/man/gnunet-search.1 (working copy)
@@ -3,12 +3,15 @@
 gnunet\-search \- a command line interface to search for content on GNUnet
 .SH SYNOPSIS
 .B gnunet\-search
-[\fIOPTIONS\fR] [+]KEYWORD [[+]KEYWORD]*
+[\fIOPTIONS\fR] [+]\fIKEYWORD\fR [[+]\fIKEYWORD\fR]*
+
+.B gnunet\-search
+[\fIOPTIONS\fR] [+]\fIURI\fR
 .SH DESCRIPTION
 .PP
 Search for content on GNUnet. The keywords are case-sensitive.  gnunet\-search can be used both for a search in the global namespace as well as for searching a private subspace.
 .TP
-\fB\-a \fILEVEL\fR, \fB\-\-anonymity=LEVEL\fR
+\fB\-a \fILEVEL\fR, \fB\-\-anonymity=\fILEVEL\fR
 The \fB-a\fR option can be used to specify additional anonymity constraints.  If set to 0, GNUnet will try to download the file as fast as possible without any additional slowdown for anonymous routing.  Note that you may still have some amount of anonymity depending on the current network load and the power of the adversary.  Use at least 1 to force GNUnet to use anonymous routing.
 
 This option can be used to limit requests further than that. In particular, you can require GNUnet to have a certain amount of cover traffic from other peers before sending your queries. This way, you can gain very high levels of anonymity \- at the expense of much more traffic and much higher latency. So set this option to values beyond 1 only if you really believe you need it.
@@ -18,7 +21,7 @@
 The default is 1 and this should be fine for most users.  Also notice that if you choose values above 1000, you may end up having no throughput at all, especially if many of your fellow GNUnet\-peers do the same.
 
 .TP
-\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
+\fB\-c \fIFILENAME\fR, \fB\-\-config=\fIFILENAME\fR
 use config file (defaults: ~/.gnunet/gnunet.conf)
 .TP
 \fB\-h\fR, \fB\-\-help\fR
@@ -27,40 +30,40 @@
 \fB\-H \fIHOSTNAME\fR, \fB\-\-host=\fIHOSTNAME\fR
 on which host is gnunetd running (default: localhost).  You can also specify a port using the syntax HOSTNAME:PORT.  The default port is 2087.
 .TP
-\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=LOGLEVEL\fR
+\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=\fILOGLEVEL\fR
 Change the loglevel.  Possible values for LOGLEVEL are NOTHING, FATAL,
 ERROR, WARNING, INFO, STATUS and DEBUG.  Note that options in the
 configuration file take precedence over this option (the argument
 will be ignored in that case).
 .TP
-\fB\-o PREFIX, \fB\-\-output=PREFIX\fR
+\fB\-o \fIPREFIX\fR, \fB\-\-output=\fIPREFIX\fR
 Writes the encountered (unencrypted) RBlocks or SBlocks to files with name PREFIX.XXX, where XXX is a number. This is useful to keep search results around.
 .TP
 \fB\-v\fR, \fB\-\-version\fR
 print the version number
 .SH NOTES
 
-You can run gnunet\-search with an URI instead of a keyword.  The URI can have the format for a namespace search or for a keyword search.  For a namespace search, the format is gnunet://ecrs/sks/NAMESPACE/IDENTIFIER.  For a keyword search, use gnunet://ecrs/ksk/KEYWORD[+KEYWORD]*.  If the format does not correspond to a GNUnet URI, GNUnet will automatically assume that keywords are supplied directly.  If only one keyword argument is supplied, gnunet\-search will split the argument at any spaces to yield more keywords:
+You can run gnunet\-search with an URI instead of a keyword.  The URI can have the format for a namespace search or for a keyword search.  For a namespace search, the format is gnunet://ecrs/sks/NAMESPACE/IDENTIFIER.  For a keyword search, use gnunet://ecrs/ksk/KEYWORD[+KEYWORD]*.  If the format does not correspond to a GNUnet URI, GNUnet will automatically assume that keywords are supplied directly.  
 
-# gnunet\-search +Das +Kapital
+If multiple keywords are passed, gnunet-search will look for content matching any of the keywords.  The prefix "+" makes a keyword mandatory.  
 
-and
+# gnunet\-search "Das Kapital"
 
-# gnunet\-search "+Das +Kapital"
+searches for content matching the keyword "Das Kapital".  Whereas
 
-are identical.  Both search for any content matching keywords "Das" and "Kapital".  In general, if multiple keywords are passed, gnunet-search will look for content matching any of the keywords.  The prefix "+" makes a keyword mandatory.  Quotes "..." can be used to form keywords that contain spaces.  But be carefull to protect these quotes from the shell:
+# gnunet\-search +Das +Kapital
 
-# gnunet\-search "\\"Das Kapital\\""
+Searches for content matching both mandatory keywords "Das" and "Kapital".
 
-searches for content matching the keyword "Das Kapital".  
-
 Search results are printed by gnunet\-search like this:
 .P
+.ad l
  gnunet\-download \-o "COPYING" gnunet://ecrs/chk/HASH1.HASH2.SIZE
 
  Description: The GNU Public License
 
  Mime-type: text/plain
+.ad b
 
 The first line contains the command to run to download the file.  The suggested filename in the example is COPYING.  The GNUnet URI consists of the key and query hash of the file and finally the size of the file.  After the command to download the file GNUnet will print meta\-data about the file as advertised in the search result, here "The GNU Public License" and the mime\-type (see the options for gnunet\-insert on how to supply meta-data by hand).
 


_______________________________________________
GNUnet-developers mailing list
GNUnet-developers@...
http://lists.gnu.org/mailman/listinfo/gnunet-developers

attachment0 (194 bytes) Download Attachment