Re: [PATCH 1/1] Client: Added support for the history file.

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

 



On Thu, 2018-04-12 at 12:34 +0200, Maico Timmerman wrote:
> +       // First check HOME env variable, otherwise read homedir from
> /etc/passwd.
> +       if ((homedir = getenv("HOME")) == NULL) {
> +               homedir = getpwuid(getuid())->pw_dir;
> +       }
> +       data.bt_shell_history = strcat(strcat(homedir, "/"),
> string);;
> +
> +       // Read history file and set index of history beyond latest
> position.
> +       read_history(data.bt_shell_history);
> +       history_set_pos(history_length);

It's in the wrong location (should be under ~/.cache), that's awfully
low-level C (I'm pretty sure the bluez maintainers wouldn't mind if you
used existing glib code, or copy/pasted those), and I doubt that C++-
style comments are the accepted usage.

g_get_user_cache_dir() is what you want.

Cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux