ncurses

用於以文字為基礎的使用者介面程式函式庫

ncursesnew curses)是一個程式函式庫,它提供了API,可以允許程式設計師編寫獨立於終端的基於文字的使用者介面英語Text-based_user_interface。它是一個虛擬終端中的「類GUI應用軟體工具箱。它還最佳化了螢幕重新整理方法,以減少使用遠端shell時遇到的延遲

ncurses
基於ncurses的menuconfig(英語:Menuconfig)
基於ncurses的menuconfig英語Menuconfig
開發者GNU計劃
目前版本
  • 6.5 (2024年4月27日;穩定版本)[1]
編輯維基數據鏈結
原始碼函式庫 編輯維基數據鏈結
作業系統POSIX
類型部件工具箱
授權條款X11授權條款
網站invisible-island.net/ncurses/

歷史 編輯

ncurses中的n來源於單詞new。這是因為ncurses是System V第4.0版(SVr4)中curses自由軟體複製品, 而那又是停止開發的4.4 BSD curses的增強版。[2]System V嚴格遵守了X/Open釋出的XSI Curses標準。

curses 編輯

1980年左右,加州大學伯克利分校為BSD作業系統開發了最初的curses函式庫,以支援面向螢幕的遊戲。它最初使用了termcap函式庫,其他程式,如vi編輯器中也使用了這個函式庫。[2]

BSD curses函式庫的成功促使貝爾實驗室在他們的System III和System V第1版Unix系統中,釋出增強的curses函式庫。這個函式庫功能更強大,而且它用terminfo代替了termcap。然而,由於AT&T的原始碼分發政策,改進的curses函式庫並沒有被BSD社群廣泛接受。[2]

pcurses 編輯

約1982年時,帕維爾·柯蒂斯(Pavel Curtis)開發了貝爾實驗室curses的免費軟體複製品,名為pcurses。它由其他人維護到了1986年。[3]

ncurses 編輯

1991年年底時,在Zeyd Ben-Halim的努力下,pcurses函式庫得到了進一步改善。[2][3][4] 1993年11月,新函式庫以名字ncurses釋出了,它的首個主版本為1.8.1。 隨後版本1.8.8(1995)的工作由埃里克·雷蒙主導,他添加了Juergen Pfeifer編寫的表單和選單函式庫。[5]1996年起,它一直由Thomas E. Dickey維護。[3]

大多數ncurses呼叫可以很方便地移植到舊的curses上。只需重新編譯,System V的curses實現就可以支援BSD的curses程式。[6]然而,一些地方卻存在問題,如在處理終端縮放上,因為舊的curses沒有對應的功能。

終端資料庫 編輯

Ncurses可以使用terminfo(與可延伸資料)或termcap。其它curses的實現一般使用terminfo;少數使用termcap。有極少數實現(mytinfo是一個時間較久的例外[7])都可以使用。

授權 編輯

Ncurses是GNU計劃的一部分。 它是極少數不在GNU GPLLGPL下分發的GNU檔案;它是在一個類似於MIT授權條款寬自由軟體授權條款下分發的。[8] 這是由於在開發者指定著作權時,協定是由自由軟體基金會起草的。

在簽署協定以將權利交給FSF時,有條款寫道:

The Foundation promises that all distribution of the Package, or of any work "based on the Package", that takes place under the control of the Foundation or its agents or assignees, shall be on terms that explicitly and perpetually permit anyone possessing a copy of the work to which the terms apply, and possessing accurate notice of these terms, to redistribute copies of the work to anyone on the same terms.[8]

本基金會承諾,在本基金會、或其控制的代理人或受讓人中,所分發的任何本軟體套件,或「基於本軟體套件」的任何作品,應在條款中明確,永久允許任何人擁有一份適用此條款的作品副本,且在條款中明確聲明,以相同條款重分發此作品。

據維護者Thomas E. Dickey說,這排除了以任何版本的GPL重授權程式,因為它會對連結到這個函式庫的程式產生限制。[8]

使用ncurses的程式 編輯

有成百的程式使用ncurses。[9][10]一些程式,如GNU Screenw3m,只使用termcap介面執行螢幕管理。另一些,如GNU Midnight CommanderYaST,使用curses程式介面。

參見 編輯

參考資料 編輯

  1. ^ 托馬斯·迪基. ncurses 6.5. 2024年4月27日 [2024年4月28日] (英語). 
  2. ^ 2.0 2.1 2.2 2.3 Eric S. Raymond. ncurses: Portable Screen-Handling for Linux. Linux Journal. September 1995 [2013-05-10]. (原始內容存檔於2012-02-26). 
  3. ^ 3.0 3.1 3.2 Thomas E. Dickey. NCURSES - New Curses. December 1996 [2013-05-10]. (原始內容存檔於2019-05-08). 
  4. ^ The README file in ncurses 1.8.1 states "v0.1 July 31, 1992" and "v1.8.1 November 5, 1993", which agrees with the NEWS (changelog) file頁面存檔備份,存於網際網路檔案館
  5. ^ NCURSES - Frequently Asked Questions (FAQ): Who wrote NCURSES?. [2013-05-10]. (原始內容存檔於2018-08-21). 
  6. ^ A Hacker's Guide to Ncurses Internals. [2013-05-10]. (原始內容存檔於2018-03-21). 
  7. ^ Ross Ridge. mytinfo posting to comp.sources.unix newsgroup. Internet Systems Consortium, Inc. December 27, 1992 [2017年11月12日]. (原始內容存檔於2011年5月16日). 
  8. ^ 8.0 8.1 8.2 NCURSES - Frequently Asked Questions (FAQ): Is it GPL'd?. [2013-05-10]. (原始內容存檔於2018-08-21). 
  9. ^ Search results: +ncurses. freshmeat.net. [2013-05-10]. (原始內容存檔於2012-02-18). 
  10. ^ Projects tagged ‘ncurses’. ohloh. [2013-05-10]. (原始內容存檔於2013-05-15). 

外部連結 編輯

程式介紹 編輯

工具箱 編輯

語言繫結 編輯

分發和封裝 編輯