AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 440463
Accepted
林果皞
林果皞
Asked: 2018-04-28 07:52:15 +0800 CST2018-04-28 07:52:15 +0800 CST 2018-04-28 07:52:15 +0800 CST

X11 语言环境文件中 47 个空行的目的是什么?

  • 772

我注意到语言环境文件顶部有 47 个空白行:

xb@dnxb:/usr/share/X11/locale$ hexdump -Cv locale.alias | head
00000000  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 0a  |................|
00000010  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 0a  |................|
00000020  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 23  |...............#|
00000030  0a 23 09 54 68 69 73 20  66 69 6c 65 20 63 6f 6e  |.#.This file con|
00000040  74 61 69 6e 73 20 61 6c  69 61 73 20 6e 61 6d 65  |tains alias name|
00000050  20 6f 66 20 6c 6f 63 61  6c 65 2e 0a 23 09 45 61  | of locale..#.Ea|
00000060  63 68 20 61 6c 69 61 73  20 6e 61 6d 65 20 69 73  |ch alias name is|
00000070  20 64 65 73 63 72 69 62  65 64 20 77 69 74 68 69  | described withi|
00000080  6e 20 6f 6e 65 20 6c 69  6e 65 2e 0a 23 09 54 68  |n one line..#.Th|
00000090  65 20 66 69 72 73 74 20  77 6f 72 64 20 69 73 20  |e first word is |
xb@dnxb:/usr/share/X11/locale$ hexdump -Cv locale.dir | head
00000000  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 0a  |................|
00000010  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 0a  |................|
00000020  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 23  |...............#|
00000030  0a 23 09 54 68 69 73 20  66 69 6c 65 20 63 6f 6e  |.#.This file con|
00000040  74 61 69 6e 73 20 6c 6f  63 61 6c 65 20 64 61 74  |tains locale dat|
00000050  61 62 61 73 65 20 66 69  6c 65 20 6e 61 6d 65 73  |abase file names|
00000060  0a 23 09 54 68 65 20 66  69 72 73 74 20 77 6f 72  |.#.The first wor|
00000070  64 20 69 73 20 74 68 65  20 6c 6f 63 61 6c 65 20  |d is the locale |
00000080  64 61 74 61 62 61 73 65  20 66 69 6c 65 20 6e 61  |database file na|
00000090  6d 65 20 61 6e 64 0a 23  09 74 68 65 20 73 65 63  |me and.#.the sec|
xb@dnxb:/usr/share/X11/locale$ hexdump -Cv compose.dir | head                                   
00000000  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 0a  |................|
00000010  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 0a  |................|
00000020  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 23  |...............#|
00000030  0a 23 09 54 68 69 73 20  66 69 6c 65 20 63 6f 6e  |.#.This file con|
00000040  74 61 69 6e 73 20 63 6f  6d 70 6f 73 65 20 74 61  |tains compose ta|
00000050  62 6c 65 20 66 69 6c 65  20 6e 61 6d 65 73 2e 0a  |ble file names..|
00000060  23 09 54 68 65 20 66 69  72 73 74 20 77 6f 72 64  |#.The first word|
00000070  20 69 73 20 74 68 65 20  63 6f 6d 70 6f 73 65 20  | is the compose |
00000080  74 61 62 6c 65 20 66 69  6c 65 20 6e 61 6d 65 0a  |table file name.|
00000090  23 09 61 6e 64 20 74 68  65 20 73 65 63 6f 6e 64  |#.and the second|
xb@dnxb:/usr/share/X11/locale$ hexdump -Cv C/XLC_LOCALE | head
00000000  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 0a  |................|
00000010  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 0a  |................|
00000020  0a 0a 0a 0a 0a 0a 0a 0a  0a 0a 0a 0a 0a 0a 0a 23  |...............#|
00000030  20 20 58 4c 6f 63 61 6c  65 20 44 61 74 61 62 61  |  XLocale Databa|
00000040  73 65 20 53 61 6d 70 6c  65 20 66 6f 72 20 43 2e  |se Sample for C.|
00000050  0a 23 20 0a 0a 23 20 0a  23 20 09 58 4c 43 5f 46  |.# ..# .# .XLC_F|
00000060  4f 4e 54 53 45 54 20 63  61 74 65 67 6f 72 79 0a  |ONTSET category.|
00000070  23 20 0a 58 4c 43 5f 46  4f 4e 54 53 45 54 0a 23  |# .XLC_FONTSET.#|
00000080  20 09 66 73 30 20 63 6c  61 73 73 20 28 37 20 62  | .fs0 class (7 b|
00000090  69 74 20 41 53 43 49 49  29 0a 66 73 30 09 7b 0a  |it ASCII).fs0.{.|
xb@dnxb:/usr/share/X11/locale$ 

vi如果我只看到文件并看到空白页,我可能不会向下滚动,如果我这样做了,我只会注意到这cat一点。我检查了这个规范,但似乎没有提到任何关于 47 个空白行的内容。语言环境文件开头的这 47 个空白行的目的是什么?

x11 locale
  • 1 1 个回答
  • 142 Views

1 个回答

  • Voted
  1. Best Answer
    derobert
    2018-04-28T08:37:20+08:002018-04-28T08:37:20+08:00

    我很确定它真的不存在,出于任何原因;这是如何构建这些文件的副作用。如果您查看locale.alias 的源代码,您会发现它们丢失了(注意左侧的数字是添加的行号,它们实际上并不存在于文件中):

    1  XCOMM
    2  XCOMM   This file contains alias name of locale.
    3  XCOMM   Each alias name is described within one line.
    4  XCOMM   The first word is the alias name (simplified locale name)
    5  XCOMM   the second word is full locale name.
    6  XCOMM
    7  XCOMM
    
    8  POSIX:                                          C
    9  POSIX-UTF2:                                     C
    

    如果您查看通过相当多的 C 预处理器和 sed 生成文件的Makefile.am :

    locale.alias: locale.alias.pre
        $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $(srcdir)/locale.alias.pre | $(CPP_SED_MAGIC) > locale.alias.l1
        $(SED) -e '/^[^#][^  ]*:/s/://' -e '/^[^#].*[    ].*:/d' \
            < locale.alias.l1 > locale.alias.l2
        cat locale.alias.l2 locale.alias.l1 > locale.alias
    

    如果您查看Makefile.in,CPP_SED_MAGIC则为:

    CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
                           -e '/^\#line  *[0-9][0-9]*  *.*$$/d' \
                           -e '/^[   ]*XCOMM$$/s/XCOMM/\#/' \
                           -e '/^[   ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
                           -e '/^[   ]*XHASH/s/XHASH/\#/' \
                           -e 's,X11_LOCALEDATADIR,$(X11_LOCALEDATADIR),g' \
                           -e '/\@\@$$/s/\@\@$$/\\/'
    

    其中,除其他外,它用空行替换了 C 预处理器吐出的所有行号注释。所以他们就是从那里来的。

    • 2

相关问题

  • 没有 x 会话的 gnome-keyring 用法

  • Arch Linux:在没有窗口管理器的情况下运行 VirtualBox (VM)

  • xrdb 冒号丢失错误

  • 在不改变分辨率的情况下让事情变得更大?[伴侣]

  • SSH X11 转发仅在使用受信任时有效

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    ssh 无法协商:“找不到匹配的密码”,正在拒绝 cbc

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    如何卸载内核模块“nvidia-drm”?

    • 13 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Wong Jia Hau ssh-add 返回:“连接代理时出错:没有这样的文件或目录” 2018-08-24 23:28:13 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST
  • Martin Hope
    Bagas Sanjaya 为什么 Linux 使用 LF 作为换行符? 2017-12-20 05:48:21 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve