Bitcointalk · JSON-RPC password

中本聪,2010 年 7 月 21 日

SN-1433 已核对来源,附原文与上下文。

阅读语言
中文译文

我刚在我 debian 系统的 /etc 里快速扫了 20 个 .conf 文件,发现: 1 个文件用 "key value" 5 个用 "key=value"

谢谢这份调查!

我觉得 "key value" 有点不自然。键和值之间理应有一个更明确的、暗示赋值的分隔符。用空格的人,兴许只是懒得用他们语言自带的 split 函数。 key=some full sentence with spaces in it. # 看起来比这样清晰 key some full sentence with spaces in it. #

那好,就用自解析的 mapConfig,语法: # comment key=value

扩展名 .conf。文件名叫什么?~/.bitcoin/settings.conf 还是 ~/.bitcoin/bitcoin.conf 还是别的?

我觉得最好把键和值开头结尾的空白都去掉。 # 喜欢列对齐的用户 k = value key = value longerkey = this sentence would be this # "this sentence would be this" key = value # 猜这样也行 nextkey = value right = justified

正常语法理应是 "key=value",只不过偶尔有人写 "key = value" 也不能怪人家。

ORIGINAL · 英文原文
I just did a quick survey of 20 .conf files in /etc on my debian system, and found:
 1 file used "key value"
 5 used "key=value" 
Thanks for that survey!

I find "key value" a little unnatural.  There ought to be a more definite separator between key and value that suggests assignment.  The space people may just be getting lazy using their language's split function.
key=some full sentence with spaces in it.  # seems more clear
key some full sentence with spaces in it.  # than this

Allright then, lets go with self-parsed mapConfig, syntax:
# comment
key=value

file extension .conf.  What's the filename, is it ~/.bitcoin/settings.conf or ~/.bitcoin/bitcoin.conf or what?   

I think we better strip whitespace at the beginning and end of the key and the value.
# user who likes column formatted
k            = value
key         = value
longerkey =   this sentence would be this    # "this sentence would be this"
        key = value   # guess this is ok too
  nextkey = value
      right = justified

The normal syntax should be "key=value", but you can't blame people for the occasional "key = value".
来源
Bitcointalk 原始链接 ↗ 记录编号 SN-1433