unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] config: read user.name from $NAME if set
@ 2014-07-21  3:06 Mark Oteiza
  2014-07-21  6:58 ` Tomi Ollila
  2014-07-31 10:17 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Oteiza @ 2014-07-21  3:06 UTC (permalink / raw)
  To: notmuch


Try to read the config parameter user.name from $NAME before taking the
user name from /etc/passwd.
---
 notmuch-config.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/notmuch-config.c b/notmuch-config.c
index 4886d36..8f1f48d 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -219,7 +219,8 @@ get_username_from_passwd_file (void *ctx)
  *
  *		database_path:		$HOME/mail
  *
- *		user_name:		From /etc/passwd
+ *		user_name:		$NAME variable if set, otherwise
+ *					read from /etc/passwd
  *
  *		user_primary_mail: 	$EMAIL variable if set, otherwise
  *					constructed from the username and
@@ -329,7 +330,9 @@ notmuch_config_open (void *ctx,
     }
 
     if (notmuch_config_get_user_name (config) == NULL) {
-	char *name = get_name_from_passwd_file (config);
+	char *name = getenv ("NAME");
+	if (! name)
+	    name = get_name_from_passwd_file (config);
 	notmuch_config_set_user_name (config, name);
 	talloc_free (name);
     }
-- 
2.0.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] config: read user.name from $NAME if set
  2014-07-21  3:06 [PATCH] config: read user.name from $NAME if set Mark Oteiza
@ 2014-07-21  6:58 ` Tomi Ollila
  2014-07-31 10:17 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2014-07-21  6:58 UTC (permalink / raw)
  To: Mark Oteiza, notmuch

On Mon, Jul 21 2014, Mark Oteiza <mvoteiza@udel.edu> wrote:

> Try to read the config parameter user.name from $NAME before taking the
> user name from /etc/passwd.

LGTM. $NAME is used for the same purpose in

https://www.gnu.org/software/emacs/manual/html_node/emacs/General-Variables.html

(and probably in many other places too)


Tomi

> ---
>  notmuch-config.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/notmuch-config.c b/notmuch-config.c
> index 4886d36..8f1f48d 100644
> --- a/notmuch-config.c
> +++ b/notmuch-config.c
> @@ -219,7 +219,8 @@ get_username_from_passwd_file (void *ctx)
>   *
>   *		database_path:		$HOME/mail
>   *
> - *		user_name:		From /etc/passwd
> + *		user_name:		$NAME variable if set, otherwise
> + *					read from /etc/passwd
>   *
>   *		user_primary_mail: 	$EMAIL variable if set, otherwise
>   *					constructed from the username and
> @@ -329,7 +330,9 @@ notmuch_config_open (void *ctx,
>      }
>  
>      if (notmuch_config_get_user_name (config) == NULL) {
> -	char *name = get_name_from_passwd_file (config);
> +	char *name = getenv ("NAME");
> +	if (! name)
> +	    name = get_name_from_passwd_file (config);
>  	notmuch_config_set_user_name (config, name);
>  	talloc_free (name);
>      }
> -- 
> 2.0.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] config: read user.name from $NAME if set
  2014-07-21  3:06 [PATCH] config: read user.name from $NAME if set Mark Oteiza
  2014-07-21  6:58 ` Tomi Ollila
@ 2014-07-31 10:17 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2014-07-31 10:17 UTC (permalink / raw)
  To: Mark Oteiza, notmuch

Mark Oteiza <mvoteiza@udel.edu> writes:

> Try to read the config parameter user.name from $NAME before taking the
> user name from /etc/passwd.

pushed

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-31 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-21  3:06 [PATCH] config: read user.name from $NAME if set Mark Oteiza
2014-07-21  6:58 ` Tomi Ollila
2014-07-31 10:17 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).