Import nvi 2.2.0

This commit is contained in:
Baptiste Daroussin 2020-09-09 07:57:59 +00:00
parent 5a709d61a3
commit 2a1ac9cdf3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/nvi/dist/; revision=365495
155 changed files with 1492 additions and 2149 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
*.swp
*~
*.orig
*.core
extern.h
*_def.h
version.h
tags
build/

190
CMakeLists.txt Normal file
View File

@ -0,0 +1,190 @@
cmake_minimum_required(VERSION 3.9)
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING
"Semicolon separated list of supported configuration types")
mark_as_advanced(CMAKE_CONFIGURATION_TYPES)
elseif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS)
message(WARNING "No CMAKE_BUILD_TYPE is selected")
endif()
project(nvi2 C)
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckCSourceCompiles)
mark_as_advanced(CMAKE_INSTALL_PREFIX)
option(USE_WIDECHAR "Enable wide character support" ON)
option(USE_ICONV "Enable iconv support" ON)
add_compile_options(-fcolor-diagnostics)
add_compile_options($<$<CONFIG:Debug>:-Wall>)
add_compile_options($<$<CONFIG:Debug>:-Wno-parentheses>)
add_compile_options($<$<CONFIG:Debug>:-Wno-uninitialized>)
add_compile_options($<$<CONFIG:Debug>:-Wmissing-prototypes>)
add_compile_options($<$<CONFIG:Debug>:-Wsystem-headers>)
add_compile_options($<$<CONFIG:Release>:-Wuninitialized>)
add_compile_options($<$<CONFIG:Release>:-Wno-dangling-else>)
add_compile_options(-Wstack-protector -fstack-protector)
add_compile_options(-Wstrict-aliasing -fstrict-aliasing)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(MAIN_PROTOS
cl/extern.h common/extern.h ex/extern.h vi/extern.h
common/options_def.h ex/ex_def.h ex/version.h)
set(CL_SRCS
cl/cl_funcs.c cl/cl_main.c cl/cl_read.c cl/cl_screen.c cl/cl_term.c)
set(COMMON_SRCS
common/conv.c common/cut.c common/delete.c common/encoding.c common/exf.c
common/key.c common/line.c common/log.c common/main.c common/mark.c
common/msg.c common/options.c common/options_f.c common/put.c
common/recover.c common/screen.c common/search.c common/seq.c
common/util.c)
set(EX_SRCS
ex/ex.c ex/ex_abbrev.c ex/ex_append.c ex/ex_args.c ex/ex_argv.c ex/ex_at.c
ex/ex_bang.c ex/ex_cd.c ex/ex_cmd.c ex/ex_cscope.c ex/ex_delete.c
ex/ex_display.c ex/ex_edit.c ex/ex_equal.c ex/ex_file.c ex/ex_filter.c
ex/ex_global.c ex/ex_init.c ex/ex_join.c ex/ex_map.c ex/ex_mark.c
ex/ex_mkexrc.c ex/ex_move.c ex/ex_open.c ex/ex_preserve.c ex/ex_print.c
ex/ex_put.c ex/ex_quit.c ex/ex_read.c ex/ex_screen.c ex/ex_script.c
ex/ex_set.c ex/ex_shell.c ex/ex_shift.c ex/ex_source.c ex/ex_stop.c
ex/ex_subst.c ex/ex_tag.c ex/ex_txt.c ex/ex_undo.c ex/ex_usage.c
ex/ex_util.c ex/ex_version.c ex/ex_visual.c ex/ex_write.c ex/ex_yank.c
ex/ex_z.c)
set(VI_SRCS
vi/getc.c vi/v_at.c vi/v_ch.c vi/v_cmd.c vi/v_delete.c vi/v_ex.c
vi/v_increment.c vi/v_init.c vi/v_itxt.c vi/v_left.c vi/v_mark.c
vi/v_match.c vi/v_paragraph.c vi/v_put.c vi/v_redraw.c vi/v_replace.c
vi/v_right.c vi/v_screen.c vi/v_scroll.c vi/v_search.c vi/v_section.c
vi/v_sentence.c vi/v_status.c vi/v_txt.c vi/v_ulcase.c vi/v_undo.c
vi/v_util.c vi/v_word.c vi/v_xchar.c vi/v_yank.c vi/v_z.c vi/v_zexit.c
vi/vi.c vi/vs_line.c vi/vs_msg.c vi/vs_refresh.c vi/vs_relative.c
vi/vs_smap.c vi/vs_split.c)
set(REGEX_SRCS
regex/regcomp.c regex/regerror.c regex/regexec.c regex/regfree.c)
# commands to generate the public headers
set(extract_protos sed -n 's/^ \\* PUBLIC: \\\(.*\\\)/\\1/p')
set(extract_version sed -n
's/^.*version \\\([^\)]*\)\\\).*/\#define VI_VERSION \\\"\\1\\\"/p')
add_custom_command(OUTPUT cl/extern.h
COMMAND ${extract_protos} ${CL_SRCS} > cl/extern.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CL_SRCS})
add_custom_command(OUTPUT common/extern.h
COMMAND ${extract_protos} ${COMMON_SRCS} > common/extern.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${COMMON_SRCS})
add_custom_command(OUTPUT ex/extern.h
COMMAND ${extract_protos} ${EX_SRCS} > ex/extern.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${EX_SRCS})
add_custom_command(OUTPUT vi/extern.h
COMMAND ${extract_protos} ${VI_SRCS} > vi/extern.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${VI_SRCS})
add_custom_command(OUTPUT common/options_def.h
COMMAND awk -f common/options.awk
common/options.c > common/options_def.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS common/options.c)
add_custom_command(OUTPUT ex/ex_def.h
COMMAND awk -f ex/ex.awk ex/ex_cmd.c > ex/ex_def.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ex/ex_cmd.c)
add_custom_command(OUTPUT ex/version.h
COMMAND ${extract_version} README > ex/version.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS README)
add_executable(nvi)
target_sources(nvi PRIVATE ${MAIN_PROTOS} ${CL_SRCS} ${COMMON_SRCS}
${EX_SRCS} ${VI_SRCS})
target_compile_definitions(nvi PRIVATE $<$<CONFIG:Debug>:DEBUG>
$<$<CONFIG:Debug>:COMLOG>)
check_function_exists(openpty UTIL_IN_LIBC)
if(NOT UTIL_IN_LIBC)
find_library(UTIL_LIBRARY util)
target_link_libraries(nvi PRIVATE ${UTIL_LIBRARY})
endif()
check_function_exists(__b64_ntop RESOLV_IN_LIBC)
if(NOT RESOLV_IN_LIBC)
find_library(RESOLV_LIBRARY resolv)
target_link_libraries(nvi PRIVATE ${RESOLV_LIBRARY})
endif()
if(USE_WIDECHAR)
find_library(CURSES_LIBRARY NAMES ncursesw cursesw curses HINTS /usr/lib)
# link to the wchar_t awared BSD libregex.a
add_library(regex STATIC)
target_sources(regex PRIVATE ${REGEX_SRCS})
target_include_directories(regex PUBLIC regex)
target_compile_definitions(regex PUBLIC __REGEX_PRIVATE)
target_link_libraries(nvi PRIVATE regex)
else()
find_library(CURSES_LIBRARY NAMES ncurses curses HINTS /usr/lib)
target_compile_options(nvi PRIVATE -Wno-pointer-sign)
endif()
target_link_libraries(nvi PRIVATE ${CURSES_LIBRARY})
if(USE_ICONV)
check_function_exists(__iconv ICONV_IN_LIBC)
if(NOT ICONV_IN_LIBC)
find_path(ICONV_INCLUDE_DIR iconv.h)
find_library(ICONV_LIBRARY iconv)
endif()
# detect the prototype of iconv(3)
set(CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
set(CMAKE_REQUIRED_INCLUDES "${ICONV_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${ICONV_LIBRARY}")
check_c_source_compiles("
#include <iconv.h>
int main() {
iconv_t conv = 0;
char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;
iconv(conv, &in, &ilen, &out, &olen);
return 0;
}
" ICONV_TRADITIONAL)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
target_include_directories(nvi PRIVATE ${ICONV_INCLUDE_DIR})
target_link_libraries(nvi PRIVATE ${ICONV_LIBRARY})
endif()
check_include_files(libutil.h HAVE_LIBUTIL_H)
check_include_files(ncurses.h HAVE_NCURSES_H)
check_include_files(term.h HAVE_TERM_H)
configure_file(files/config.h.in config.h)
set(vi_cv_path_preserve /var/tmp/vi.recover/)
if(APPLE)
set(vi_cv_path_msgcat /usr/local/share/vi/catalog/)
else()
set(vi_cv_path_msgcat /usr/share/vi/catalog/)
endif()
configure_file(files/pathnames.h.in pathnames.h)
configure_file(files/recover.in recover @ONLY)

View File

@ -1,7 +1,3 @@
/*-
* $Id: LICENSE,v 8.18 2011/07/10 11:58:35 zy Exp $
*/
The following are the copyrights and redistribution conditions that apply
to this copy of the Vi software.

10
README
View File

@ -1,6 +1,4 @@
# $Id: README,v 9.2 2015/04/08 17:18:56 zy Exp $
This is version 2.1.3 (2015-04-08) of nex/nvi, a reimplementation of the ex/vi
This is version 2.2.0 (2020-08-01) of nex/nvi, a reimplementation of the ex/vi
text editors originally distributed as part of the Fourth Berkeley
Software Distribution (4BSD), by the University of California, Berkeley.
@ -8,12 +6,12 @@ The directory layout is as follows:
LICENSE ....... Copyright, use and redistribution information.
README ........ This file.
build ......... Build directory.
catalog ....... Message catalogs; see catalog/README.
cl ............ Vi interface to the curses(3) library.
common ........ Code shared by ex and vi.
docs .......... Ex/vi documentation, both current and historic.
ex ............ Ex source code.
files ......... Template files.
man ........... Ex/vi documentation.
regex ......... Modified regex library with wide character support.
vi ............ Vi source code.
@ -29,7 +27,7 @@ o Nvi was written by Keith Bostic, and the last version is 1.79. After that,
The following acknowledgments were written by Keith Bostic:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
o This software is several years old and is the product of many folks' work.
o This software is several years old and is the product of many folks' work.
This software was originally derived from software contributed to
the University of California, Berkeley by Steve Kirkendall, the

View File

@ -1,7 +1,5 @@
# $Id: Makefile,v 9.0 2012/10/19 15:13:11 zy Exp $
CAT= dutch english french german polish ru_RU.KOI8-R spanish swedish \
uk_UA.KOI8-U zh_CN.GB2312
CAT= dutch english french german polish ru_RU.KOI8-R spanish \
swedish tr_TR.ISO8859-9 tr_TR.UTF-8 uk_UA.KOI8-U zh_CN.GB2312
FILES= ../cl/*.c ../common/*.c ../ex/*.c ../vi/*.c
all: dump ${CAT}
@ -33,7 +31,8 @@ ${CAT}: english.base
CHK= dutch.check english.check french.check german.check \
polish.check ru_RU.KOI8-R.check spanish.check swedish.check \
uk_UA.KOI8-U.check zh_CN.GB2312.check
tr_TR.ISO8859-9.check tr_TR.UTF-8.check uk_UA.KOI8-U.check \
zh_CN.GB2312.check
check: ${CHK}
${CHK}: ${CAT}
@echo "... $@"; \

View File

@ -1,5 +1,3 @@
# $Id: README,v 9.0 2012/10/19 17:06:15 zy Exp $
Generally, all non-system error and informational messages in nvi are
catalog messages, i.e. they can be tailored to a specific langauge.
Command strings, usage strings, system errors and other 'known text'

View File

@ -27,10 +27,6 @@
* SUCH DAMAGE.
*/
#ifndef lint
static char sccsid[] = "$Id: dump.c,v 8.2 2011/07/14 00:05:25 zy Exp $";
#endif /* not lint */
#include <ctype.h>
#include <stdio.h>

View File

@ -0,0 +1,304 @@
002 "Satır uzunluğu taşımı"
003 "%lu numaralı satır silinemiyor"
004 "%lu numaralı satıra iliştirilemiyor"
005 "%lu numaralı satırda ekleme yapılamıyor"
006 "%lu numaralı satır kaydedilemiyor"
007 "Son satır alınamıyor"
008 "Hata: %lu numaralı satır okunamıyor"
009 "Günlük dosyası"
010 "Günlükleme gerçekleştirilmiyor, geri alma olanaklı değil"
011 "Geri alınacak bir değişiklik yok"
012 "Günlükleme gerçekleştirilmiyor, geri alma olanaklı değil"
013 "Günlükleme gerçekleştirilmiyor, ileri sarma olanaklı değil"
014 "Yinelenecek bir değişiklik yok"
015 "%s/%d: Günlük kayıt hatası"
016 "Vi'nin standart girdisi ve çıktısı bir uçbirim olmalı"
017 "İm %s: Ayarlanmamış"
018 "İm %s: Satır silinmiş"
019 "İm %s: İmleç konumu artık yok"
020 "Hata: "
021 "yeni dosya
022 "adı değişti"
023 "değiştirildi"
024 "değiştirilmedi"
025 "KİLİDİ AÇILDI"
026 "saltokunur"
027 "satır %lu/%lu [%ld%%]"
028 "boş dosya"
029 "%lu. satır"
030 "%s dosyası bir ileti kataloğu değil"
031 "Öntanımlı %s seçeneği ayarlanamadı"
032 "Kullanım: %s"
033 "set: %s seçeneği yok: 'set all' tüm seçenek değerlerini verir"
034 "set: [no]%s seçeneği bir değer almaz"
035 "set: %s seçeneği bir Boole değeri değil"
036 "set: %s seçeneği: %s"
037 "set: %s seçeneği: %s: Değer taşımı"
038 "set: %s seçeneği: %s izin verilmeyen bir sayı"
039 "set: %s seçeneği bir Boole değeri değil"
040 "Ekran sütun sayısı çok küçük, şundan daha az: %d"
041 "Ekran sütun sayısı çok büyük, şundan daha çok: %d"
042 "Ekran satır sayısı çok küçük, şundan daha az: %d"
043 "Ekran satır sayısı çok büyük, şundan daha çok: %d"
044 "Lisp seçeneği eklenmemiş"
045 "İletiler kapatılmamış: %s"
046 "İletiler açılmamış: %s"
047 "%s seçeneği iki karakterli öbekler biçiminde olmalı"
053 "Başlangıç arabelleği boş"
054 "%s arabelleği boş"
056 "Oturum başarısız olursa değişiklikler kurtarılamaz"
057 "Dosya, kurtarma için kopyalanıyor..."
058 "Koruma başarısız oldu: %s"
059 "Oturum başarısız olursa değişiklikler kurtarılamaz"
060 "Dosya yedeklemesi başarısız oldu: %s"
061 "Dosya, kurtarma için kopyalanıyor..."
062 "%u kullanıcısı üzerine bilgi bulunamadı"
063 "Kurtarma dosyası kilitlenemiyor"
065 "Kurtarma dosyası"
066 "%s: Hatalı oluşturulmuş kurtarma dosyası"
067 "%s: Hatalı oluşturulmuş kurtarma dosyası"
068 "Kurtarılacak %s adında sizce okunabilir bir dosya yok"
069 "Bu dosyanın kurtarabileceğiniz eski sürümleri var"
070 "Kurtarabileceğiniz başka dosyalar var"
071 "E-posta gönderilmedi: %s"
072 "Dosya boş, aranacak bir şey yok"
073 "Dizgi bulunamadan dosyanın sonuna erişildi"
074 "Arama dizgisi yok"
075 "Dizgi bulunamadı"
076 "Dizgi bulunamadan dosyanın başına erişildi"
077 "Arama tamamlandı"
078 "Aranıyor..."
079 "Yazdırılamaz karakter bulunmadı"
080 "Bilinmeyen komut adı"
082 "%s: Komut ex kipinde kullanılamaz"
083 "Sayım sıfır olmayabilir"
084 "%s: Hatalı satır belirtimi"
085 "İç sözdizim tablo hatası (%s: %s)"
086 "Kullanım: %s"
087 "%s: Geçici arabellek salıverilmedi"
088 "Bayrak göreli konumu birinci satırdan önceye"
089 "Bayrak göreli konumu dosya sonunu geçiyor"
090 "Erimli @, dosya/ekran değiştiğinde çalışır"
091 "Global/v komutu dosya/ekran değiştiğinde çalışır"
092 "Ex komutu başarısız: Sıradaki komutlar çıkarıldı"
093 "Ex komutu başarısız: Eşlemlenen düğmeler çıkarıldı"
094 "İkinci adres ilkinden daha küçük"
095 "Bir im adı sağlanmadı"
096 "\\ sonrasında / veya ? gelmiyor"
097 "Bir satır numarasına yapılan başvuru sayısı sıfırdan az"
098 "Bilinmeyen komut: %s"
099 "Adres değeri taşımı"
100 "Adres değeri alttaşımı"
101 "İzin verilmeyen adres birleşimi"
102 "İzin verilmeyen adres: Dosyada yalnızca %lu satır var"
103 "İzin verilmeyen adres: Dosya boş"
104 "%s komutu bir 0 adresine izin vermiyor"
105 "Görüntülenecek kısaltma yok"
106 "Kısaltmalar bir \"sözcük\" karakteri ile bitmelidir"
107 "Kısaltmalar sekme veya boşluk içeremez"
108 "Kısaltmalar sonu dışında sözcük/sözcük olmayan karakterleri karıştıramaz"
109 "\"%s\" bir kısaltma değil"
110 "Vi komutu başarısız: Eşlemlenen düğmeler çıkarıldı"
111 "Düzenlenecek başka dosya yok"
112 "Öncesinde düzenlenecek başka dosya yok"
113 "Öncesinde geri sarılacak dosyalar yok"
114 "Görüntülenecek dosya yok"
115 "Öncesinde \"!\" ögesinin yerine geçecek bir komut yok"
116 "%% yerine geçecek bir dosya adı yok"
117 "# yerine geçecek bir dosya adı yok"
118 "Hata: execl: %s"
119 "Girdi/Çıktı hatası: %s"
120 "Dosya son tam yazımdan bu yana değiştirilmiş; yazın veya yok saymak için ! kullanın"
121 "Ev dizini konumu bulunamıyor"
122 "Yeni şimdiki dizin: %s"
123 "Görüntülenecek kesilmiş arabellek yok"
124 "%s komutu bir global veya v komutunun parçası olarak kullanılamaz"
128 "%s: kaynak alınmıyor: İyesi siz veya kök değil"
129 "%s: kaynak alınmıyor: İyesi siz değilsiniz"
130 "%s: kaynak alınmıyor: İyesi dışında başka bir kullanıcı tarafından yazılabilir"
131 "Uç uca eklenecek bir satır yok"
132 "Girdi eşlem girdisi yok"
133 "Komut eşlem girdisi yok"
134 "%s yeniden eşlemlenemeyebilir"
135 "\"%s\" şu anda eşlemlenmemiş"
136 "İm adları tek bir karakter olmalıdır"
137 "%s mevcut, yazılmamış; yok saymak için ! kullanın"
138 "Yeni exrc dosyası: %s"
139 "Hedef satırı taşıma erimi içinde"
140 "'open' komutu 'open' seçeneğinin ayarlı olmasını gerektirir"
141 "'open' komutu henüz eklenmemiş"
142 "Bu dosyanın korunması olanaklı değil"
143 "Dosya korundu"
144 "%s: Çok fazla dosya adına genişletilmiş"
145 "Yalnızca sıradan dosyalar ve adlandırılmış veri yolları okunabilir"
146 "%s: Okuma kilidi kullanılabilir değildi"
147 "Okunuyor..."
148 "%s: %lu satır, %lu karakter"
149 "Görüntülenecek arkaplan ekranı yok"
150 "'script' komutu yalnızca vi kipinde kullanılabilir"
151 "Çalıştırılacak komut yok"
152 "'shiftwidth' seçeneği 0 olarak ayarlanmış"
153 "Sayım taşımı"
154 "Sayım alttaşımı"
155 "Düzenli ifade belirtilmiş; r bayrağı anlamsız"
156 "#, l ve p bayrakları vi kipinde c bayrağı ile birlikte kullanılamaz"
157 "Eşleşme bulunamadı"
158 "Önceden bir etiket girilmemiş"
159 "Etiket yığınında %s sayısından az girdi; :display t[ags] kullanın"
160 "Etiket yığınında dönülecek bir %s dosyası yok; :display t[ags] kullanın"
161 "Sürdürmek için Enter'a basın:"
162 "%s: Etiket bulunamadı"
163 "%s: %s içinde hasar görmüş etiket"
164 "%s: Etiketin satır numarası dosya sonunu geçmiş"
165 "Etiket yığını boş"
166 "%s: Arama dizgisi bulunamadı"
167 "%d dosya daha düzenlenecek"
168 "%s arabelleği boş"
169 "Değişikliği onayla? [n]"
170 "Yarıda kesildi"
171 "Öncesinde çalıştırılacak arabellek yok"
172 "Öncesinde düzenli ifade yok"
173 "%s komutu bir dosyanın halihazırda okunmuş olmasını gerektirir"
174 "Kullanım: %s"
175 "'visual' komutu 'open' seçeneğinin ayarlanmış olmasını gerektirir"
177 "Boş dosya"
178 "Öncesinde F, f, T veya t araması yok"
179 "%s bulunamadı"
180 "Düzenlenecek dosya yok"
181 "İmleç bir sayıda değil"
182 "Ortaya çıkan sayı çok büyük"
183 "Ortaya çıkan sayı çok küçük"
184 "Bu satırda eşleşen karakter yok"
185 "Eşleşen karakter bulunamadı"
186 "Değiştirilecek karakter yok"
187 "Geçilecek başka ekran yok"
188 "Arama dizgisinden, satır ofsetinden ve/veya 'z' komutundan sonraki karakterler"
189 "Öncesinde arama dizgisi yok"
190 "Arama başlanan konumda tamamlandı"
191 "Kısaltma genişleme sınırını aştı: Karakterler çıkarıldı"
192 "İzin verilmeyen karakter; giriş için tırnak içine alın"
193 "Halihazırda eklemenin başında"
194 "Silinecek başka karakter yok"
195 "Hareket dosya sonunu geçti"
196 "Hareket satır sonunu geçti"
197 "İmleç hareket ettirilmedi"
198 "Halihazırda dosyanın başında"
199 "Hareket dosyanın başını geçti"
200 "Halihazırda ilk sütunda"
201 "Arabellekler komuttan önce belirtilmeli"
202 "Halihazırda dosya sonunda"
203 "Halihazırda satır sonunda"
204 "%s bir vi komutu değil"
205 "Kullanım: %s"
206 "Silinecek karakter yok"
207 "Q komutu ex uçbirim arabirimini gerektirir"
208 "Yinelenecek komut yok"
209 "Dosya boş"
210 "%s bir hareket komutu olarak kullanılamaz"
211 "Halihazırda komut kipi içinde"
212 "İmleç bir sözcükte değil"
214 "'windows' seçeneği değeri çok büyük, en çok %u olabilir"
215 "İliştir"
216 "Değişiklik yap"
217 "Komut"
218 "Ekle"
219 "Değiştir"
220 "Hareket ekran sonunu geçti"
221 "Hareket ekran başını geçti"
222 "Ekran bölünebilmesi için %d satırdan daha geniş olmalıdır"
223 "Arkaplan ekranı yok"
224 "Arkaplanda %s dosyasını düzenleyen bir ekran yok"
225 "Açık olan tek ekranınızı arkaplana alamazsınız"
226 "Ekran yalnızca %d satıra küçültülebilir"
227 "Ekran küçülemez"
228 "Ekran büyüyemez"
230 "Bu ekran askıya alınamaz"
231 "Yarıda kesildi: Eşlemlenen düğmeler çıkarıldı"
232 "vi: Geçici arabellek salıverilmedi"
233 "Bu uçbirimde %s düğmesi yok"
234 "Yalnızca bir arabellek belirtilebilir"
235 "Sayı şundan daha büyük: %lu"
236 "Yarıda kesildi"
237 "Geçici dosya oluşturulamıyor"
238 "Uyarı: %s sıradan bir dosya değil"
239 "%s halihazırda kilitlenmiş, oturum saltokunur"
240 "%s: Kaldır"
241 "%s: Kapat"
242 "%s: Kaldır"
243 "%s: Kaldır"
244 "Saltokunur dosya, yazılmadı; yok saymak için ! kullanın"
245 "Saltokunur dosya, yazılmadı"
246 "%s mevcut, yazılmadı; yok saymak için ! kullanın"
247 "%s mevcut, yazılmadı"
248 "Kısmi dosya, yazılmadı; yok saymak için ! kullanın"
249 "Kısmi dosya, yazılmadı"
250 "%s: Dosya bu kopyadan daha önce değiştirilmiş; yok saymak için ! kullanın"
251 "%s: Dosya bu kopyadan daha önce değiştirilmiş"
252 "%s: Yazım koruması kullanılabilir değildi"
253 "Yazılıyor..."
254 "%s: UYARI: DOSYA KIRPILMIŞ"
255 "Halihazırda bu grubun ilk etiketinde"
256 "%s: Yeni dosya: %lu satır, %lu karakter"
257 "%s: %lu satır, %lu karakter"
258 "%s çok fazla dosya adına genişletilmiş"
259 "%s: Sıradan bir dosya değil"
260 "%s: İyesi siz değilsiniz"
261 "%s: İyesi dışında başka bir kullanıcı tarafından da erişilebilir"
262 "Dosya son tam yazımdan bu yana değiştirilmiş; yazın veya yok saymak için ! kullanın"
263 "Dosya son tam yazımdan bu yana değiştirilmiş; yazın veya yok saymak için :edit! kullanın"
264 "Dosya son tam yazımdan bu yana değiştirilmiş; yazın veya yok saymak için ! kullanın"
265 "Dosya geçici; çıkarsanız değişiklikler atılacaktır"
266 "Dosya saltokunur, değişiklikler kendiliğinden yazılmaz"
267 "Günlük yeniden başlatıldı"
268 "Onayla? [ynq]"
269 "Sürdürmek için herhangi bir düğmeye basın: "
270 "Sürdürmek için herhangi bir düğmeye basın [ex komutu girmek için :]: "
271 "Sürdürmek için herhangi bir düğmeye basın [çıkış için q]: "
272 "Bu biçim %s ex uçbirim arabirimini gerektirir"
273 "ex girdisi kipine giriliyor"
274 "Komut başarısız, henüz bir dosya okunmadı."
275 " sürdür?"
276 "Beklenmedik karakter olayı"
277 "Beklenmedik dosya sonu olayı"
278 "Sorgu eşleşmesi bulunamadı"
279 "Beklenmedik yarıda kesme olayı"
281 "Beklenmedik yeniden boyama olayı"
282 "Halihazırda bu grubun son etiketinde"
283 "%s komutu ex uçbirim arabirimini gerektirir"
284 "Bu biçim %s 'secure edit' seçeneği ayarlandığında desteklenmez"
285 "Beklenmedik dizi olayı"
286 "Beklenmedik zaman aşımı olayı"
288 "Bölünebilmesi için ekran %d sütundan daha geniş olmalıdır"
289 "Kabuk genişletmeleri 'secure edit' seçeneği ayarlandığında desteklenmez"
290 "%s komutu 'secure edit' seçeneği ayarlandığında desteklenmez"
291 "set: %s seçeneği kapatılamaz"
292 "Ekran çok küçük."
293 "eklendi"
294 "değiştirildi"
295 "silindi"
296 "uç uca eklendi"
297 "taşındı"
298 "kaydırıldı"
299 "kopyalandı"
300 "satır"
301 "satır"
303 "Dosya son yazımdan bu yana değiştirilmiş."
304 "Kabuk genişletmesi başarısız"
305 "Bir '%s' düzenleme seçeneği belirtilmedi"
307 "Çalıştırılacak ex komutu yok"
308 "Bir komut çalıştırmak için <CR>, çıkmak için :q girin"
309 "Yardım için \"cscope help\" kullanın"
310 "Çalışan bir cscope bağlantısı yok"
311 "%s: Bilinmeyen arama türü: Şunlardan bir tanesini kullanın: %s"
312 "%d: Böyle bir cscope oturumu yok"
313 "set: %s seçeneği hiçbir zaman açılamaz"
314 "set: %s seçeneği hiçbir zaman 0 olarak ayarlanamaz"
315 "%s: İliştirildi: %lu satır, %lu karakter"
316 "Beklenmedik yeniden boyutlandırma olayı"
317 "Düzenlenecek %d dosya var"
319 "%d ekran arkaplana alındı; onları listelemek için :display kullanın"
320 "Bilinmeyen imleç konumu"
321 "Dosya kodlama dönüştürmesi desteklenmiyor"
322 "Girdi kodlama dönüştürmesi desteklenmiyor"
323 "Geçersiz girdi. Kırpıldı."
324 "%d numaralı satırda dönüştürme hatası"

View File

@ -0,0 +1 @@
Emir SARI <bitigchi@me.com>

304
catalog/tr_TR.UTF-8.base Normal file
View File

@ -0,0 +1,304 @@
002 "Satır uzunluğu taşımı"
003 "%lu numaralı satır silinemiyor"
004 "%lu numaralı satıra iliştirilemiyor"
005 "%lu numaralı satırda ekleme yapılamıyor"
006 "%lu numaralı satır kaydedilemiyor"
007 "Son satır alınamıyor"
008 "Hata: %lu numaralı satır okunamıyor"
009 "Günlük dosyası"
010 "Günlükleme gerçekleştirilmiyor, geri alma olanaklı değil"
011 "Geri alınacak bir değişiklik yok"
012 "Günlükleme gerçekleştirilmiyor, geri alma olanaklı değil"
013 "Günlükleme gerçekleştirilmiyor, ileri sarma olanaklı değil"
014 "Yinelenecek bir değişiklik yok"
015 "%s/%d: Günlük kayıt hatası"
016 "Vi'nin standart girdisi ve çıktısı bir uçbirim olmalı"
017 "İm %s: Ayarlanmamış"
018 "İm %s: Satır silinmiş"
019 "İm %s: İmleç konumu artık yok"
020 "Hata: "
021 "yeni dosya
022 "adı değişti"
023 "değiştirildi"
024 "değiştirilmedi"
025 "KİLİDİ AÇILDI"
026 "saltokunur"
027 "satır %lu/%lu [%ld%%]"
028 "boş dosya"
029 "%lu. satır"
030 "%s dosyası bir ileti kataloğu değil"
031 "Öntanımlı %s seçeneği ayarlanamadı"
032 "Kullanım: %s"
033 "set: %s seçeneği yok: 'set all' tüm seçenek değerlerini verir"
034 "set: [no]%s seçeneği bir değer almaz"
035 "set: %s seçeneği bir Boole değeri değil"
036 "set: %s seçeneği: %s"
037 "set: %s seçeneği: %s: Değer taşımı"
038 "set: %s seçeneği: %s izin verilmeyen bir sayı"
039 "set: %s seçeneği bir Boole değeri değil"
040 "Ekran sütun sayısı çok küçük, şundan daha az: %d"
041 "Ekran sütun sayısı çok büyük, şundan daha çok: %d"
042 "Ekran satır sayısı çok küçük, şundan daha az: %d"
043 "Ekran satır sayısı çok büyük, şundan daha çok: %d"
044 "Lisp seçeneği eklenmemiş"
045 "İletiler kapatılmamış: %s"
046 "İletiler açılmamış: %s"
047 "%s seçeneği iki karakterli öbekler biçiminde olmalı"
053 "Başlangıç arabelleği boş"
054 "%s arabelleği boş"
056 "Oturum başarısız olursa değişiklikler kurtarılamaz"
057 "Dosya, kurtarma için kopyalanıyor..."
058 "Koruma başarısız oldu: %s"
059 "Oturum başarısız olursa değişiklikler kurtarılamaz"
060 "Dosya yedeklemesi başarısız oldu: %s"
061 "Dosya, kurtarma için kopyalanıyor..."
062 "%u kullanıcısı üzerine bilgi bulunamadı"
063 "Kurtarma dosyası kilitlenemiyor"
065 "Kurtarma dosyası"
066 "%s: Hatalı oluşturulmuş kurtarma dosyası"
067 "%s: Hatalı oluşturulmuş kurtarma dosyası"
068 "Kurtarılacak %s adında sizce okunabilir bir dosya yok"
069 "Bu dosyanın kurtarabileceğiniz eski sürümleri var"
070 "Kurtarabileceğiniz başka dosyalar var"
071 "E-posta gönderilmedi: %s"
072 "Dosya boş, aranacak bir şey yok"
073 "Dizgi bulunamadan dosyanın sonuna erişildi"
074 "Arama dizgisi yok"
075 "Dizgi bulunamadı"
076 "Dizgi bulunamadan dosyanın başına erişildi"
077 "Arama tamamlandı"
078 "Aranıyor..."
079 "Yazdırılamaz karakter bulunmadı"
080 "Bilinmeyen komut adı"
082 "%s: Komut ex kipinde kullanılamaz"
083 "Sayım sıfır olmayabilir"
084 "%s: Hatalı satır belirtimi"
085 "İç sözdizim tablo hatası (%s: %s)"
086 "Kullanım: %s"
087 "%s: Geçici arabellek salıverilmedi"
088 "Bayrak göreli konumu birinci satırdan önceye"
089 "Bayrak göreli konumu dosya sonunu geçiyor"
090 "Erimli @, dosya/ekran değiştiğinde çalışır"
091 "Global/v komutu dosya/ekran değiştiğinde çalışır"
092 "Ex komutu başarısız: Sıradaki komutlar çıkarıldı"
093 "Ex komutu başarısız: Eşlemlenen düğmeler çıkarıldı"
094 "İkinci adres ilkinden daha küçük"
095 "Bir im adı sağlanmadı"
096 "\\ sonrasında / veya ? gelmiyor"
097 "Bir satır numarasına yapılan başvuru sayısı sıfırdan az"
098 "Bilinmeyen komut: %s"
099 "Adres değeri taşımı"
100 "Adres değeri alttaşımı"
101 "İzin verilmeyen adres birleşimi"
102 "İzin verilmeyen adres: Dosyada yalnızca %lu satır var"
103 "İzin verilmeyen adres: Dosya boş"
104 "%s komutu bir 0 adresine izin vermiyor"
105 "Görüntülenecek kısaltma yok"
106 "Kısaltmalar bir \"sözcük\" karakteri ile bitmelidir"
107 "Kısaltmalar sekme veya boşluk içeremez"
108 "Kısaltmalar sonu dışında sözcük/sözcük olmayan karakterleri karıştıramaz"
109 "\"%s\" bir kısaltma değil"
110 "Vi komutu başarısız: Eşlemlenen düğmeler çıkarıldı"
111 "Düzenlenecek başka dosya yok"
112 "Öncesinde düzenlenecek başka dosya yok"
113 "Öncesinde geri sarılacak dosyalar yok"
114 "Görüntülenecek dosya yok"
115 "Öncesinde \"!\" ögesinin yerine geçecek bir komut yok"
116 "%% yerine geçecek bir dosya adı yok"
117 "# yerine geçecek bir dosya adı yok"
118 "Hata: execl: %s"
119 "Girdi/Çıktı hatası: %s"
120 "Dosya son tam yazımdan bu yana değiştirilmiş; yazın veya yok saymak için ! kullanın"
121 "Ev dizini konumu bulunamıyor"
122 "Yeni şimdiki dizin: %s"
123 "Görüntülenecek kesilmiş arabellek yok"
124 "%s komutu bir global veya v komutunun parçası olarak kullanılamaz"
128 "%s: kaynak alınmıyor: İyesi siz veya kök değil"
129 "%s: kaynak alınmıyor: İyesi siz değilsiniz"
130 "%s: kaynak alınmıyor: İyesi dışında başka bir kullanıcı tarafından yazılabilir"
131 "Uç uca eklenecek bir satır yok"
132 "Girdi eşlem girdisi yok"
133 "Komut eşlem girdisi yok"
134 "%s yeniden eşlemlenemeyebilir"
135 "\"%s\" şu anda eşlemlenmemiş"
136 "İm adları tek bir karakter olmalıdır"
137 "%s mevcut, yazılmamış; yok saymak için ! kullanın"
138 "Yeni exrc dosyası: %s"
139 "Hedef satırı taşıma erimi içinde"
140 "'open' komutu 'open' seçeneğinin ayarlı olmasını gerektirir"
141 "'open' komutu henüz eklenmemiş"
142 "Bu dosyanın korunması olanaklı değil"
143 "Dosya korundu"
144 "%s: Çok fazla dosya adına genişletilmiş"
145 "Yalnızca sıradan dosyalar ve adlandırılmış veri yolları okunabilir"
146 "%s: Okuma kilidi kullanılabilir değildi"
147 "Okunuyor..."
148 "%s: %lu satır, %lu karakter"
149 "Görüntülenecek arkaplan ekranı yok"
150 "'script' komutu yalnızca vi kipinde kullanılabilir"
151 "Çalıştırılacak komut yok"
152 "'shiftwidth' seçeneği 0 olarak ayarlanmış"
153 "Sayım taşımı"
154 "Sayım alttaşımı"
155 "Düzenli ifade belirtilmiş; r bayrağı anlamsız"
156 "#, l ve p bayrakları vi kipinde c bayrağı ile birlikte kullanılamaz"
157 "Eşleşme bulunamadı"
158 "Önceden bir etiket girilmemiş"
159 "Etiket yığınında %s sayısından az girdi; :display t[ags] kullanın"
160 "Etiket yığınında dönülecek bir %s dosyası yok; :display t[ags] kullanın"
161 "Sürdürmek için Enter'a basın:"
162 "%s: Etiket bulunamadı"
163 "%s: %s içinde hasar görmüş etiket"
164 "%s: Etiketin satır numarası dosya sonunu geçmiş"
165 "Etiket yığını boş"
166 "%s: Arama dizgisi bulunamadı"
167 "%d dosya daha düzenlenecek"
168 "%s arabelleği boş"
169 "Değişikliği onayla? [n]"
170 "Yarıda kesildi"
171 "Öncesinde çalıştırılacak arabellek yok"
172 "Öncesinde düzenli ifade yok"
173 "%s komutu bir dosyanın halihazırda okunmuş olmasını gerektirir"
174 "Kullanım: %s"
175 "'visual' komutu 'open' seçeneğinin ayarlanmış olmasını gerektirir"
177 "Boş dosya"
178 "Öncesinde F, f, T veya t araması yok"
179 "%s bulunamadı"
180 "Düzenlenecek dosya yok"
181 "İmleç bir sayıda değil"
182 "Ortaya çıkan sayı çok büyük"
183 "Ortaya çıkan sayı çok küçük"
184 "Bu satırda eşleşen karakter yok"
185 "Eşleşen karakter bulunamadı"
186 "Değiştirilecek karakter yok"
187 "Geçilecek başka ekran yok"
188 "Arama dizgisinden, satır ofsetinden ve/veya 'z' komutundan sonraki karakterler"
189 "Öncesinde arama dizgisi yok"
190 "Arama başlanan konumda tamamlandı"
191 "Kısaltma genişleme sınırını aştı: Karakterler çıkarıldı"
192 "İzin verilmeyen karakter; giriş için tırnak içine alın"
193 "Halihazırda eklemenin başında"
194 "Silinecek başka karakter yok"
195 "Hareket dosya sonunu geçti"
196 "Hareket satır sonunu geçti"
197 "İmleç hareket ettirilmedi"
198 "Halihazırda dosyanın başında"
199 "Hareket dosyanın başını geçti"
200 "Halihazırda ilk sütunda"
201 "Arabellekler komuttan önce belirtilmeli"
202 "Halihazırda dosya sonunda"
203 "Halihazırda satır sonunda"
204 "%s bir vi komutu değil"
205 "Kullanım: %s"
206 "Silinecek karakter yok"
207 "Q komutu ex uçbirim arabirimini gerektirir"
208 "Yinelenecek komut yok"
209 "Dosya boş"
210 "%s bir hareket komutu olarak kullanılamaz"
211 "Halihazırda komut kipi içinde"
212 "İmleç bir sözcükte değil"
214 "'windows' seçeneği değeri çok büyük, en çok %u olabilir"
215 "İliştir"
216 "Değişiklik yap"
217 "Komut"
218 "Ekle"
219 "Değiştir"
220 "Hareket ekran sonunu geçti"
221 "Hareket ekran başını geçti"
222 "Ekran bölünebilmesi için %d satırdan daha geniş olmalıdır"
223 "Arkaplan ekranı yok"
224 "Arkaplanda %s dosyasını düzenleyen bir ekran yok"
225 "Açık olan tek ekranınızı arkaplana alamazsınız"
226 "Ekran yalnızca %d satıra küçültülebilir"
227 "Ekran küçülemez"
228 "Ekran büyüyemez"
230 "Bu ekran askıya alınamaz"
231 "Yarıda kesildi: Eşlemlenen düğmeler çıkarıldı"
232 "vi: Geçici arabellek salıverilmedi"
233 "Bu uçbirimde %s düğmesi yok"
234 "Yalnızca bir arabellek belirtilebilir"
235 "Sayı şundan daha büyük: %lu"
236 "Yarıda kesildi"
237 "Geçici dosya oluşturulamıyor"
238 "Uyarı: %s sıradan bir dosya değil"
239 "%s halihazırda kilitlenmiş, oturum saltokunur"
240 "%s: Kaldır"
241 "%s: Kapat"
242 "%s: Kaldır"
243 "%s: Kaldır"
244 "Saltokunur dosya, yazılmadı; yok saymak için ! kullanın"
245 "Saltokunur dosya, yazılmadı"
246 "%s mevcut, yazılmadı; yok saymak için ! kullanın"
247 "%s mevcut, yazılmadı"
248 "Kısmi dosya, yazılmadı; yok saymak için ! kullanın"
249 "Kısmi dosya, yazılmadı"
250 "%s: Dosya bu kopyadan daha önce değiştirilmiş; yok saymak için ! kullanın"
251 "%s: Dosya bu kopyadan daha önce değiştirilmiş"
252 "%s: Yazım koruması kullanılabilir değildi"
253 "Yazılıyor..."
254 "%s: UYARI: DOSYA KIRPILMIŞ"
255 "Halihazırda bu grubun ilk etiketinde"
256 "%s: Yeni dosya: %lu satır, %lu karakter"
257 "%s: %lu satır, %lu karakter"
258 "%s çok fazla dosya adına genişletilmiş"
259 "%s: Sıradan bir dosya değil"
260 "%s: İyesi siz değilsiniz"
261 "%s: İyesi dışında başka bir kullanıcı tarafından da erişilebilir"
262 "Dosya son tam yazımdan bu yana değiştirilmiş; yazın veya yok saymak için ! kullanın"
263 "Dosya son tam yazımdan bu yana değiştirilmiş; yazın veya yok saymak için :edit! kullanın"
264 "Dosya son tam yazımdan bu yana değiştirilmiş; yazın veya yok saymak için ! kullanın"
265 "Dosya geçici; çıkarsanız değişiklikler atılacaktır"
266 "Dosya saltokunur, değişiklikler kendiliğinden yazılmaz"
267 "Günlük yeniden başlatıldı"
268 "Onayla? [ynq]"
269 "Sürdürmek için herhangi bir düğmeye basın: "
270 "Sürdürmek için herhangi bir düğmeye basın [ex komutu girmek için :]: "
271 "Sürdürmek için herhangi bir düğmeye basın [çıkış için q]: "
272 "Bu biçim %s ex uçbirim arabirimini gerektirir"
273 "ex girdisi kipine giriliyor"
274 "Komut başarısız, henüz bir dosya okunmadı."
275 " sürdür?"
276 "Beklenmedik karakter olayı"
277 "Beklenmedik dosya sonu olayı"
278 "Sorgu eşleşmesi bulunamadı"
279 "Beklenmedik yarıda kesme olayı"
281 "Beklenmedik yeniden boyama olayı"
282 "Halihazırda bu grubun son etiketinde"
283 "%s komutu ex uçbirim arabirimini gerektirir"
284 "Bu biçim %s 'secure edit' seçeneği ayarlandığında desteklenmez"
285 "Beklenmedik dizi olayı"
286 "Beklenmedik zaman aşımı olayı"
288 "Bölünebilmesi için ekran %d sütundan daha geniş olmalıdır"
289 "Kabuk genişletmeleri 'secure edit' seçeneği ayarlandığında desteklenmez"
290 "%s komutu 'secure edit' seçeneği ayarlandığında desteklenmez"
291 "set: %s seçeneği kapatılamaz"
292 "Ekran çok küçük."
293 "eklendi"
294 "değiştirildi"
295 "silindi"
296 "uç uca eklendi"
297 "taşındı"
298 "kaydırıldı"
299 "kopyalandı"
300 "satır"
301 "satır"
303 "Dosya son yazımdan bu yana değiştirilmiş."
304 "Kabuk genişletmesi başarısız"
305 "Bir '%s' düzenleme seçeneği belirtilmedi"
307 "Çalıştırılacak ex komutu yok"
308 "Bir komut çalıştırmak için <CR>, çıkmak için :q girin"
309 "Yardım için \"cscope help\" kullanın"
310 "Çalışan bir cscope bağlantısı yok"
311 "%s: Bilinmeyen arama türü: Şunlardan bir tanesini kullanın: %s"
312 "%d: Böyle bir cscope oturumu yok"
313 "set: %s seçeneği hiçbir zaman açılamaz"
314 "set: %s seçeneği hiçbir zaman 0 olarak ayarlanamaz"
315 "%s: İliştirildi: %lu satır, %lu karakter"
316 "Beklenmedik yeniden boyutlandırma olayı"
317 "Düzenlenecek %d dosya var"
319 "%d ekran arkaplana alındı; onları listelemek için :display kullanın"
320 "Bilinmeyen imleç konumu"
321 "Dosya kodlama dönüştürmesi desteklenmiyor"
322 "Girdi kodlama dönüştürmesi desteklenmiyor"
323 "Geçersiz girdi. Kırpıldı."
324 "%d numaralı satırda dönüştürme hatası"

View File

@ -0,0 +1 @@
Emir SARI <bitigchi@me.com>

View File

@ -1,5 +1,3 @@
# $Id: README.signal,v 10.1 1995/06/23 10:28:17 bostic Exp $
There are six (normally) asynchronous actions about which vi cares:
SIGHUP, SIGINT, SIGQUIT, SIGTERM, SIGTSTP and SIGWINCH.

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: cl.h,v 10.34 2011/08/15 20:07:32 zy Exp $
*/
#ifdef USE_WIDECHAR

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: cl_funcs.c,v 10.74 2012/10/11 10:30:16 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,14 +9,11 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: cl_main.c,v 10.56 2015/04/05 06:20:53 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <bitstring.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
@ -38,11 +35,10 @@ sigset_t __sigblockset; /* GLOBAL: Blocked signals. */
static void cl_func_std(GS *);
static CL_PRIVATE *cl_init(GS *);
static GS *gs_init(char *);
static void perr(char *, char *);
static GS *gs_init(void);
static int setsig(int, struct sigaction *, void (*)(int));
static void sig_end(GS *);
static void term_init(char *, char *);
static void term_init(char *);
/*
* main --
@ -63,7 +59,7 @@ main(int argc, char *argv[])
abort();
/* Create and initialize the global structure. */
__global_list = gp = gs_init(argv[0]);
__global_list = gp = gs_init();
/*
* Strip out any arguments that vi isn't going to understand. There's
@ -93,12 +89,12 @@ main(int argc, char *argv[])
*/
if ((ttype = getenv("TERM")) == NULL)
ttype = "ansi";
term_init(gp->progname, ttype);
term_init(ttype);
/* Add the terminal type to the global structure. */
if ((OG_D_STR(gp, GO_TERM) =
OG_STR(gp, GO_TERM) = strdup(ttype)) == NULL)
perr(gp->progname, NULL);
err(1, NULL);
/* Figure out how big the screen is. */
if (cl_ssize(NULL, 0, &rows, &cols, NULL))
@ -147,8 +143,7 @@ main(int argc, char *argv[])
/* Free the global and CL private areas. */
#if defined(DEBUG) || defined(PURIFY)
if (clp->oname != NULL)
free(clp->oname);
free(clp->oname);
free(clp);
free(OG_STR(gp, GO_TERM));
free(gp);
@ -162,21 +157,14 @@ main(int argc, char *argv[])
* Create and partially initialize the GS structure.
*/
static GS *
gs_init(char *name)
gs_init(void)
{
GS *gp;
char *p;
/* Figure out what our name is. */
if ((p = strrchr(name, '/')) != NULL)
name = p + 1;
/* Allocate the global structure. */
CALLOC_NOMSG(NULL, gp, GS *, 1, sizeof(GS));
gp = calloc(1, sizeof(GS));
if (gp == NULL)
perr(name, NULL);
err(1, NULL);
gp->progname = name;
return (gp);
}
@ -190,10 +178,9 @@ cl_init(GS *gp)
CL_PRIVATE *clp;
int fd;
/* Allocate the CL private structure. */
CALLOC_NOMSG(NULL, clp, CL_PRIVATE *, 1, sizeof(CL_PRIVATE));
clp = calloc(1, sizeof(CL_PRIVATE));
if (clp == NULL)
perr(gp->progname, NULL);
err(1, NULL);
gp->cl_private = clp;
/*
@ -216,7 +203,7 @@ cl_init(GS *gp)
goto tcfail;
} else if ((fd = open(_PATH_TTY, O_RDONLY, 0)) != -1) {
if (tcgetattr(fd, &clp->orig) == -1) {
tcfail: perr(gp->progname, "tcgetattr");
tcfail: err(1, "tcgetattr");
exit (1);
}
(void)close(fd);
@ -233,7 +220,7 @@ tcfail: perr(gp->progname, "tcgetattr");
* Initialize terminal information.
*/
static void
term_init(char *name, char *ttype)
term_init(char *ttype)
{
int err;
@ -241,13 +228,9 @@ term_init(char *name, char *ttype)
setupterm(ttype, STDOUT_FILENO, &err);
switch (err) {
case -1:
(void)fprintf(stderr,
"%s: No terminal database found\n", name);
exit (1);
errx(1, "No terminal database found");
case 0:
(void)fprintf(stderr,
"%s: %s: unknown terminal type\n", name, ttype);
exit (1);
errx(1, "%s: unknown terminal type", ttype);
}
}
@ -315,7 +298,7 @@ sig_init(GS *gp, SCR *sp)
setsig(SIGWINCH, &clp->oact[INDX_WINCH], h_winch)
#endif
) {
perr(gp->progname, NULL);
err(1, NULL);
return (1);
}
} else
@ -406,17 +389,3 @@ cl_func_std(GS *gp)
gp->scr_suspend = cl_suspend;
gp->scr_usage = cl_usage;
}
/*
* perr --
* Print system error.
*/
static void
perr(char *name, char *msg)
{
(void)fprintf(stderr, "%s:", name);
if (msg != NULL)
(void)fprintf(stderr, "%s:", msg);
(void)fprintf(stderr, "%s\n", strerror(errno));
exit(1);
}

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: cl_read.c,v 10.30 2012/07/12 18:28:58 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/select.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: cl_screen.c,v 10.58 2015/04/08 02:12:11 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -450,14 +446,11 @@ cl_ex_init(SCR *sp)
/* Enter_standout_mode and exit_standout_mode are paired. */
if (clp->smso == NULL || clp->rmso == NULL) {
if (clp->smso != NULL) {
free(clp->smso);
clp->smso = NULL;
}
if (clp->rmso != NULL) {
free(clp->rmso);
clp->rmso = NULL;
}
free(clp->smso);
clp->smso = NULL;
free(clp->rmso);
clp->rmso = NULL;
}
/*
@ -526,7 +519,7 @@ cl_getcap(SCR *sp, char *name, char **elementp)
if ((t = tigetstr(name)) != NULL &&
t != (char *)-1 && (len = strlen(t)) != 0) {
MALLOC_RET(sp, *elementp, char *, len + 1);
MALLOC_RET(sp, *elementp, len + 1);
memmove(*elementp, t, len + 1);
}
return (0);
@ -539,32 +532,25 @@ cl_getcap(SCR *sp, char *name, char **elementp)
static void
cl_freecap(CL_PRIVATE *clp)
{
if (clp->el != NULL) {
free(clp->el);
clp->el = NULL;
}
if (clp->cup != NULL) {
free(clp->cup);
clp->cup = NULL;
}
if (clp->cuu1 != NULL) {
free(clp->cuu1);
clp->cuu1 = NULL;
}
if (clp->rmso != NULL) {
free(clp->rmso);
clp->rmso = NULL;
}
if (clp->smso != NULL) {
free(clp->smso);
clp->smso = NULL;
}
free(clp->el);
clp->el = NULL;
free(clp->cup);
clp->cup = NULL;
free(clp->cuu1);
clp->cuu1 = NULL;
free(clp->rmso);
clp->rmso = NULL;
free(clp->smso);
clp->smso = NULL;
/* Required by libcursesw :) */
if (clp->cw.bp1.c != NULL) {
free(clp->cw.bp1.c);
clp->cw.bp1.c = NULL;
clp->cw.blen1 = 0;
}
free(clp->cw.bp1.c);
clp->cw.bp1.c = NULL;
clp->cw.blen1 = 0;
}
/*

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: cl_term.c,v 10.35 2015/04/08 02:12:11 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/queue.h>
@ -35,6 +31,7 @@ static const char sccsid[] = "$Id: cl_term.c,v 10.35 2015/04/08 02:12:11 zy Exp
#include "cl.h"
static int cl_pfmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
static size_t atoz_or(const char *, size_t);
/*
* XXX
@ -453,9 +450,9 @@ noterm: if (row == 0)
* dot-files.
*/
if ((p = getenv("LINES")) != NULL)
row = strtol(p, NULL, 10);
row = atoz_or(p, row);
if ((p = getenv("COLUMNS")) != NULL)
col = strtol(p, NULL, 10);
col = atoz_or(p, col);
if (rowp != NULL)
*rowp = row;
@ -464,6 +461,22 @@ noterm: if (row == 0)
return (0);
}
/*
* atoz_or --
* Parse non-zero positive decimal with a fallback.
*/
static size_t
atoz_or(const char *s, size_t y)
{
char *ep;
long x = strtol(s, &ep, 10);
if (*ep == '\0' && (0 < x && x < INT_MAX))
return (size_t)x;
else
return y;
}
/*
* cl_putchar --
* Function version of putchar, for tputs.

View File

@ -1,31 +0,0 @@
int cl_waddstr(SCR *, const CHAR_T *, size_t);
int cl_addstr(SCR *, const char *, size_t);
int cl_attr(SCR *, scr_attr_t, int);
int cl_baud(SCR *, u_long *);
int cl_bell(SCR *);
int cl_clrtoeol(SCR *);
int cl_cursor(SCR *, size_t *, size_t *);
int cl_deleteln(SCR *);
int cl_discard(SCR *, SCR **);
int cl_ex_adjust(SCR *, exadj_t);
int cl_insertln(SCR *);
int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *);
int cl_move(SCR *, size_t, size_t);
int cl_refresh(SCR *, int);
int cl_rename(SCR *, char *, int);
void cl_setname(GS *, char *);
int cl_split(SCR *, SCR *);
int cl_suspend(SCR *, int *);
void cl_usage(void);
int sig_init(GS *, SCR *);
int cl_event(SCR *, EVENT *, u_int32_t, int);
int cl_screen(SCR *, u_int32_t);
int cl_quit(GS *);
int cl_getcap(SCR *, char *, char **);
int cl_term_init(SCR *);
int cl_term_end(GS *);
int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
int cl_optchange(SCR *, int, char *, u_long *);
int cl_omesg(SCR *, CL_PRIVATE *, int);
int cl_ssize(SCR *, int, size_t *, size_t *, int *);
int cl_putchar(int);

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: args.h,v 10.2 1996/03/06 19:50:07 bostic Exp $
*/
/*

View File

@ -5,17 +5,10 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: common.h,v 10.22 2012/04/13 05:21:50 zy Exp $
*/
/*
* Pseudo-local includes. These are files that are unlikely to exist
* on most machines to which we're porting vi, and we want to include
* them in a very specific order, regardless.
*/
#include <db.h>
#include <regex.h>
#include "/usr/include/db.h" /* Only include db1. */
#include <regex.h> /* May refer to the bundled regex. */
/*
* Forward structure declarations. Not pretty, but the include files

View File

@ -11,10 +11,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: conv.c,v 2.40 2014/02/27 16:25:29 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -118,7 +114,7 @@ default_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
size_t left = len;
int error = 1;
BZERO(&mbs, 1);
memset(&mbs, 0, sizeof(mbs));
BINC_RETW(NULL, *tostr, *blen, nlen);
#ifdef USE_ICONV
@ -245,7 +241,7 @@ default_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
#endif
BZERO(&mbs, 1);
memset(&mbs, 0, sizeof(mbs));
BINC_RETC(NULL, *tostr, *blen, nlen);
dst = *tostr; buflen = *blen;
@ -323,7 +319,7 @@ conv_init(SCR *orig, SCR *sp)
if (orig == NULL)
setlocale(LC_ALL, "");
if (orig != NULL)
BCOPY(&orig->conv, &sp->conv, 1);
memmove(&sp->conv, &orig->conv, sizeof(CONV));
#ifdef USE_WIDECHAR
else {
char *ctype = setlocale(LC_CTYPE, NULL);
@ -464,7 +460,6 @@ conv_end(SCR *sp)
for (i = 0; i <= IC_IE_TO_UTF16; ++i)
if (sp->conv.id[i] != (iconv_t)-1)
iconv_close(sp->conv.id[i]);
if (sp->cw.bp1.c != NULL)
free(sp->cw.bp1.c);
free(sp->cw.bp1.c);
#endif
}

View File

@ -7,8 +7,6 @@
* Zhihao Yuan. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: conv.h,v 2.32 2013/03/11 01:20:53 zy Exp $
*/
#ifdef USE_ICONV

View File

@ -9,12 +9,9 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: cut.c,v 10.12 2012/02/11 15:52:33 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
#include <bitstring.h>
#include <ctype.h>
@ -64,12 +61,7 @@ static void cb_rotate(SCR *);
* PUBLIC: int cut(SCR *, CHAR_T *, MARK *, MARK *, int);
*/
int
cut(
SCR *sp,
CHAR_T *namep,
MARK *fm,
MARK *tm,
int flags)
cut(SCR *sp, CHAR_T *namep, MARK *fm, MARK *tm, int flags)
{
CB *cbp;
CHAR_T name = '\0';
@ -126,7 +118,7 @@ namecb: CBNAME(sp, cbp, name);
* Otherwise, if it's not an append, free its current contents.
*/
if (cbp == NULL) {
CALLOC_RET(sp, cbp, CB *, 1, sizeof(CB));
CALLOC_RET(sp, cbp, 1, sizeof(CB));
cbp->name = name;
TAILQ_INIT(cbp->textq);
SLIST_INSERT_HEAD(sp->gp->cutq, cbp, q);
@ -225,12 +217,7 @@ cb_rotate(SCR *sp)
* PUBLIC: int cut_line(SCR *, recno_t, size_t, size_t, CB *);
*/
int
cut_line(
SCR *sp,
recno_t lno,
size_t fcno,
size_t clen,
CB *cbp)
cut_line(SCR *sp, recno_t lno, size_t fcno, size_t clen, CB *cbp)
{
TEXT *tp;
size_t len;
@ -294,20 +281,16 @@ cut_close(GS *gp)
* PUBLIC: TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t);
*/
TEXT *
text_init(
SCR *sp,
const CHAR_T *p,
size_t len,
size_t total_len)
text_init(SCR *sp, const CHAR_T *p, size_t len, size_t total_len)
{
TEXT *tp;
CALLOC(sp, tp, TEXT *, 1, sizeof(TEXT));
CALLOC(sp, tp, 1, sizeof(TEXT));
if (tp == NULL)
return (NULL);
/* ANSI C doesn't define a call to malloc(3) for 0 bytes. */
if ((tp->lb_len = total_len * sizeof(CHAR_T)) != 0) {
MALLOC(sp, tp->lb, CHAR_T *, tp->lb_len);
MALLOC(sp, tp->lb, tp->lb_len);
if (tp->lb == NULL) {
free(tp);
return (NULL);
@ -345,7 +328,6 @@ text_lfree(TEXTH *headp)
void
text_free(TEXT *tp)
{
if (tp->lb != NULL)
free(tp->lb);
free(tp->lb);
free(tp);
}

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: cut.h,v 10.10 2012/02/11 15:52:33 zy Exp $
*/
typedef struct _texth TEXTH; /* TEXT list head structure. */

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: delete.c,v 10.18 2012/02/11 15:52:33 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -33,11 +29,7 @@ static const char sccsid[] = "$Id: delete.c,v 10.18 2012/02/11 15:52:33 zy Exp $
* PUBLIC: int del(SCR *, MARK *, MARK *, int);
*/
int
del(
SCR *sp,
MARK *fm,
MARK *tm,
int lmode)
del(SCR *sp, MARK *fm, MARK *tm, int lmode)
{
recno_t lno;
size_t blen, len, nlen, tlen;
@ -94,14 +86,16 @@ del(
if (tm->lno == fm->lno) {
if (db_get(sp, fm->lno, DBG_FATAL, &p, &len))
return (1);
GET_SPACE_RETW(sp, bp, blen, len);
if (fm->cno != 0)
MEMCPY(bp, p, fm->cno);
MEMCPY(bp + fm->cno, p + (tm->cno + 1),
len - (tm->cno + 1));
if (db_set(sp, fm->lno,
bp, len - ((tm->cno - fm->cno) + 1)))
goto err;
if (len != 0) {
GET_SPACE_RETW(sp, bp, blen, len);
if (fm->cno != 0)
MEMCPY(bp, p, fm->cno);
MEMCPY(bp + fm->cno, p + (tm->cno + 1),
len - (tm->cno + 1));
if (db_set(sp, fm->lno,
bp, len - ((tm->cno - fm->cno) + 1)))
goto err;
}
goto done;
}

View File

@ -5,10 +5,6 @@
* See the LICENSE file for redistribution information.
*/
#ifndef lint
static const char sccsid[] = "$Id: encoding.c,v 1.4 2011/12/13 19:40:52 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
int looks_utf8(const char *, size_t);
@ -96,7 +92,7 @@ looks_utf8(const char *ibuf, size_t nbytes)
if (i >= nbytes)
goto done;
if (buf[i] & 0x40) /* 10xxxxxx */
if ((buf[i] & 0xc0) != 0x80) /* 10xxxxxx */
return -1;
}

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: exf.c,v 10.64 2015/04/05 15:21:55 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -59,9 +55,7 @@ static int file_spath(SCR *, FREF *, struct stat *, int *);
* PUBLIC: FREF *file_add(SCR *, char *);
*/
FREF *
file_add(
SCR *sp,
char *name)
file_add(SCR *sp, char *name)
{
GS *gp;
FREF *frp, *tfrp;
@ -80,8 +74,7 @@ file_add(
TAILQ_FOREACH_SAFE(frp, gp->frefq, q, tfrp) {
if (frp->name == NULL) {
TAILQ_REMOVE(gp->frefq, frp, q);
if (frp->name != NULL)
free(frp->name);
free(frp->name);
free(frp);
continue;
}
@ -90,7 +83,7 @@ file_add(
}
/* Allocate and initialize the FREF structure. */
CALLOC(sp, frp, FREF *, 1, sizeof(FREF));
CALLOC(sp, frp, 1, sizeof(FREF));
if (frp == NULL)
return (NULL);
@ -121,11 +114,7 @@ file_add(
* PUBLIC: int file_init(SCR *, FREF *, char *, int);
*/
int
file_init(
SCR *sp,
FREF *frp,
char *rcv_name,
int flags)
file_init(SCR *sp, FREF *frp, char *rcv_name, int flags)
{
EXF *ep;
RECNOINFO oinfo = { 0 };
@ -160,7 +149,7 @@ file_init(
* Default recover mail file fd to -1.
* Set initial EXF flag bits.
*/
CALLOC_RET(sp, ep, EXF *, 1, sizeof(EXF));
CALLOC_RET(sp, ep, 1, sizeof(EXF));
ep->c_lno = ep->c_nlines = OOBLNO;
ep->rcv_fd = -1;
F_SET(ep, F_FIRSTMODIFY);
@ -356,9 +345,9 @@ file_init(
* vi, unless the -R command-line option was specified or the program
* was executed as "view". (Well, to be truthful, if the letter 'w'
* occurred anywhere in the program name, but let's not get into that.)
* So, the persistant readonly state has to be stored in the screen
* So, the persistent readonly state has to be stored in the screen
* structure, and the edit option value toggles with the contents of
* the edit buffer. If the persistant readonly flag is set, set the
* the edit buffer. If the persistent readonly flag is set, set the
* readonly edit option.
*
* Otherwise, try and figure out if a file is readonly. This is a
@ -418,10 +407,8 @@ file_init(
return (0);
err: if (frp->name != NULL) {
free(frp->name);
frp->name = NULL;
}
err: free(frp->name);
frp->name = NULL;
if (frp->tname != NULL) {
(void)unlink(frp->tname);
free(frp->tname);
@ -430,10 +417,9 @@ err: if (frp->name != NULL) {
oerr: if (F_ISSET(ep, F_RCV_ON))
(void)unlink(ep->rcv_path);
if (ep->rcv_path != NULL) {
free(ep->rcv_path);
ep->rcv_path = NULL;
}
free(ep->rcv_path);
ep->rcv_path = NULL;
if (ep->db != NULL)
(void)ep->db->close(ep->db);
free(ep);
@ -448,11 +434,7 @@ oerr: if (F_ISSET(ep, F_RCV_ON))
* try and open.
*/
static int
file_spath(
SCR *sp,
FREF *frp,
struct stat *sbp,
int *existsp)
file_spath(SCR *sp, FREF *frp, struct stat *sbp, int *existsp)
{
int savech;
size_t len;
@ -564,7 +546,7 @@ file_cinit(SCR *sp)
}
CHAR2INT(sp, gp->c_option, strlen(gp->c_option) + 1,
wp, wlen);
if (ex_run_str(sp, "-c option", wp, wlen - 1, 1, 1))
if (ex_run_str(sp, "-c option", wp, wlen - 1, 1, 0))
return;
gp->c_option = NULL;
} else if (F_ISSET(sp, SC_EX)) {
@ -632,10 +614,7 @@ file_cinit(SCR *sp)
* PUBLIC: int file_end(SCR *, EXF *, int);
*/
int
file_end(
SCR *sp,
EXF *ep,
int force)
file_end(SCR *sp, EXF *ep, int force)
{
FREF *frp;
@ -681,8 +660,7 @@ file_end(
frp->tname = NULL;
if (F_ISSET(frp, FR_TMPFILE)) {
TAILQ_REMOVE(sp->gp->frefq, frp, q);
if (frp->name != NULL)
free(frp->name);
free(frp->name);
free(frp);
}
sp->frp = NULL;
@ -724,10 +702,8 @@ file_end(
}
if (ep->rcv_fd != -1)
(void)close(ep->rcv_fd);
if (ep->rcv_path != NULL)
free(ep->rcv_path);
if (ep->rcv_mpath != NULL)
free(ep->rcv_mpath);
free(ep->rcv_path);
free(ep->rcv_mpath);
if (ep->c_blen > 0)
free(ep->c_lp);
@ -744,12 +720,7 @@ file_end(
* PUBLIC: int file_write(SCR *, MARK *, MARK *, char *, int);
*/
int
file_write(
SCR *sp,
MARK *fm,
MARK *tm,
char *name,
int flags)
file_write(SCR *sp, MARK *fm, MARK *tm, char *name, int flags)
{
enum { NEWFILE, OLDFILE } mtype;
struct stat sb;
@ -1016,10 +987,7 @@ file_write(
* recreate the file. So, let's not risk it.
*/
static int
file_backup(
SCR *sp,
char *name,
char *bname)
file_backup(SCR *sp, char *name, char *bname)
{
struct dirent *dp;
struct stat sb;
@ -1188,6 +1156,7 @@ file_backup(
estr = wfname;
goto err;
}
free(d);
if (bp != NULL)
FREE_SPACE(sp, bp, blen);
return (0);
@ -1201,8 +1170,7 @@ err: if (rfd != -1)
}
if (estr)
msgq_str(sp, M_SYSERR, estr, "%s");
if (d != NULL)
free(d);
free(d);
if (bp != NULL)
FREE_SPACE(sp, bp, blen);
return (1);
@ -1306,10 +1274,7 @@ file_comment(SCR *sp)
* PUBLIC: int file_m1(SCR *, int, int);
*/
int
file_m1(
SCR *sp,
int force,
int flags)
file_m1(SCR *sp, int force, int flags)
{
EXF *ep;
@ -1347,9 +1312,7 @@ file_m1(
* PUBLIC: int file_m2(SCR *, int);
*/
int
file_m2(
SCR *sp,
int force)
file_m2(SCR *sp, int force)
{
EXF *ep;
@ -1379,9 +1342,7 @@ file_m2(
* PUBLIC: int file_m3(SCR *, int);
*/
int
file_m3(
SCR *sp,
int force)
file_m3(SCR *sp, int force)
{
EXF *ep;
@ -1415,9 +1376,7 @@ file_m3(
* PUBLIC: int file_aw(SCR *, int);
*/
int
file_aw(
SCR *sp,
int flags)
file_aw(SCR *sp, int flags)
{
if (!F_ISSET(sp->ep, F_MODIFIED))
return (0);
@ -1476,12 +1435,9 @@ file_aw(
* PUBLIC: void set_alt_name(SCR *, char *);
*/
void
set_alt_name(
SCR *sp,
char *name)
set_alt_name(SCR *sp, char *name)
{
if (sp->alt_name != NULL)
free(sp->alt_name);
free(sp->alt_name);
if (name == NULL)
sp->alt_name = NULL;
else if ((sp->alt_name = strdup(name)) == NULL)
@ -1495,11 +1451,7 @@ set_alt_name(
* PUBLIC: lockr_t file_lock(SCR *, char *, int, int);
*/
lockr_t
file_lock(
SCR *sp,
char *name,
int fd,
int iswrite)
file_lock(SCR *sp, char *name, int fd, int iswrite)
{
if (!O_ISSET(sp, O_LOCKFILES))
return (LOCK_SUCCESS);

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: exf.h,v 10.10 2012/07/06 16:03:37 zy Exp $
*/
/* Undo direction. */
/*

View File

@ -1,132 +0,0 @@
char * codeset(void);
void conv_init(SCR *, SCR *);
int conv_enc(SCR *, int, char *);
void conv_end(SCR *);
int cut(SCR *, CHAR_T *, MARK *, MARK *, int);
int cut_line(SCR *, recno_t, size_t, size_t, CB *);
void cut_close(GS *);
TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t);
void text_lfree(TEXTH *);
void text_free(TEXT *);
int del(SCR *, MARK *, MARK *, int);
int looks_utf8(const char *, size_t);
int looks_utf16(const char *, size_t);
int decode_utf8(const char *);
int decode_utf16(const char *, int);
FREF *file_add(SCR *, char *);
int file_init(SCR *, FREF *, char *, int);
int file_end(SCR *, EXF *, int);
int file_write(SCR *, MARK *, MARK *, char *, int);
int file_m1(SCR *, int, int);
int file_m2(SCR *, int);
int file_m3(SCR *, int);
int file_aw(SCR *, int);
void set_alt_name(SCR *, char *);
lockr_t file_lock(SCR *, char *, int, int);
int v_key_init(SCR *);
void v_key_ilookup(SCR *);
size_t v_key_len(SCR *, ARG_CHAR_T);
char *v_key_name(SCR *, ARG_CHAR_T);
e_key_t v_key_val(SCR *, ARG_CHAR_T);
int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int);
int v_event_get(SCR *, EVENT *, int, u_int32_t);
void v_event_err(SCR *, EVENT *);
int v_event_flush(SCR *, u_int);
int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *);
int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *);
int db_delete(SCR *, recno_t);
int db_append(SCR *, int, recno_t, CHAR_T *, size_t);
int db_insert(SCR *, recno_t, CHAR_T *, size_t);
int db_set(SCR *, recno_t, CHAR_T *, size_t);
int db_exist(SCR *, recno_t);
int db_last(SCR *, recno_t *);
int db_rget(SCR *, recno_t, char **, size_t *);
int db_rset(SCR *, recno_t, char *, size_t);
void db_err(SCR *, recno_t);
int log_init(SCR *, EXF *);
int log_end(SCR *, EXF *);
int log_cursor(SCR *);
int log_line(SCR *, recno_t, u_int);
int log_mark(SCR *, LMARK *);
int log_backward(SCR *, MARK *);
int log_setline(SCR *);
int log_forward(SCR *, MARK *);
int editor(GS *, int, char *[]);
void v_end(GS *);
int mark_init(SCR *, EXF *);
int mark_end(SCR *, EXF *);
int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t);
int mark_set(SCR *, ARG_CHAR_T, MARK *, int);
int mark_insdel(SCR *, lnop_t, recno_t);
void msgq(SCR *, mtype_t, const char *, ...);
void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *);
void msgq_str(SCR *, mtype_t, const char *, const char *);
void mod_rpt(SCR *);
void msgq_status(SCR *, recno_t, u_int);
int msg_open(SCR *, char *);
void msg_close(GS *);
const char *msg_cmsg(SCR *, cmsg_t, size_t *);
const char *msg_cat(SCR *, const char *, size_t *);
char *msg_print(SCR *, const char *, int *);
int opts_init(SCR *, int *);
int opts_set(SCR *, ARGS *[], char *);
int o_set(SCR *, int, u_int, char *, u_long);
int opts_empty(SCR *, int, int);
void opts_dump(SCR *, enum optdisp);
int opts_save(SCR *, FILE *);
OPTLIST const *opts_search(CHAR_T *);
void opts_nomatch(SCR *, CHAR_T *);
int opts_copy(SCR *, SCR *);
void opts_free(SCR *);
int f_altwerase(SCR *, OPTION *, char *, u_long *);
int f_columns(SCR *, OPTION *, char *, u_long *);
int f_lines(SCR *, OPTION *, char *, u_long *);
int f_lisp(SCR *, OPTION *, char *, u_long *);
int f_msgcat(SCR *, OPTION *, char *, u_long *);
int f_print(SCR *, OPTION *, char *, u_long *);
int f_readonly(SCR *, OPTION *, char *, u_long *);
int f_recompile(SCR *, OPTION *, char *, u_long *);
int f_reformat(SCR *, OPTION *, char *, u_long *);
int f_ttywerase(SCR *, OPTION *, char *, u_long *);
int f_w300(SCR *, OPTION *, char *, u_long *);
int f_w1200(SCR *, OPTION *, char *, u_long *);
int f_w9600(SCR *, OPTION *, char *, u_long *);
int f_window(SCR *, OPTION *, char *, u_long *);
int f_encoding(SCR *, OPTION *, char *, u_long *);
int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int);
int rcv_tmp(SCR *, EXF *, char *);
int rcv_init(SCR *);
int rcv_sync(SCR *, u_int);
int rcv_list(SCR *);
int rcv_read(SCR *, FREF *);
int screen_init(GS *, SCR *, SCR **);
int screen_end(SCR *);
SCR *screen_next(SCR *);
int f_search(SCR *,
MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
int b_search(SCR *,
MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
void search_busy(SCR *, busy_t);
int seq_set(SCR *, CHAR_T *,
size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int);
int seq_delete(SCR *, CHAR_T *, size_t, seq_t);
int seq_free(SEQ *);
SEQ *seq_find
(SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *);
void seq_close(GS *);
int seq_dump(SCR *, seq_t, int);
int seq_save(SCR *, FILE *, char *, seq_t);
int e_memcmp(CHAR_T *, EVENT *, size_t);
void *binc(SCR *, void *, size_t *, size_t);
int nonblank(SCR *, recno_t, size_t *);
char *tail(char *);
char *join(char *, char *);
char *expanduser(char *);
char *quote(char *);
char *v_strdup(SCR *, const char *, size_t);
CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t);
enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int);
enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int);
void timepoint_steady(struct timespec *);
void timepoint_system(struct timespec *);
void TRACE(SCR *, const char *, ...);

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: gs.h,v 11.0 2012/10/17 06:34:37 zy Exp $
*/
#define TEMPORARY_FILE_STRING "/tmp" /* Default temporary file name. */
@ -55,8 +53,6 @@ typedef enum { KEY_VEOF, KEY_VERASE, KEY_VKILL, KEY_VWERASE } scr_keyval_t;
* Structure that describes global state of the running program.
*/
struct _gs {
char *progname; /* Programe name. */
int id; /* Last allocated screen id. */
TAILQ_HEAD(_dqh, _scr) dq[1]; /* Displayed screens. */
TAILQ_HEAD(_hqh, _scr) hq[1]; /* Hidden screens. */

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: key.c,v 10.54 2013/11/13 12:15:27 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -145,10 +141,7 @@ v_key_init(SCR *sp)
* in the table, so we check for that first.
*/
static void
v_keyval(
SCR *sp,
int val,
scr_keyval_t name)
v_keyval(SCR *sp, int val, scr_keyval_t name)
{
KEYLIST *kp;
CHAR_T ch;
@ -206,9 +199,7 @@ v_key_ilookup(SCR *sp)
* PUBLIC: size_t v_key_len(SCR *, ARG_CHAR_T);
*/
size_t
v_key_len(
SCR *sp,
ARG_CHAR_T ch)
v_key_len(SCR *sp, ARG_CHAR_T ch)
{
(void)v_key_name(sp, ch);
return (sp->clen);
@ -222,9 +213,7 @@ v_key_len(
* PUBLIC: char *v_key_name(SCR *, ARG_CHAR_T);
*/
char *
v_key_name(
SCR *sp,
ARG_CHAR_T ach)
v_key_name(SCR *sp, ARG_CHAR_T ach)
{
static const char hexdigit[] = "0123456789abcdef";
static const char octdigit[] = "01234567";
@ -330,9 +319,7 @@ done: sp->cname[sp->clen = len] = '\0';
* PUBLIC: e_key_t v_key_val(SCR *, ARG_CHAR_T);
*/
e_key_t
v_key_val(
SCR *sp,
ARG_CHAR_T ch)
v_key_val(SCR *sp, ARG_CHAR_T ch)
{
KEYLIST k, *kp;
@ -354,8 +341,7 @@ v_key_val(
* PUBLIC: int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int);
*/
int
v_event_push(
SCR *sp,
v_event_push(SCR *sp,
EVENT *p_evp, /* Push event. */
CHAR_T *p_s, /* Push characters. */
size_t nitems, /* Number of items to push. */
@ -384,8 +370,8 @@ v_event_push(
if (total >= gp->i_nelem && v_event_grow(sp, MAX(total, 64)))
return (1);
if (gp->i_cnt)
BCOPY(gp->i_event + gp->i_next,
gp->i_event + TERM_PUSH_SHIFT + nitems, gp->i_cnt);
memmove(gp->i_event + TERM_PUSH_SHIFT + nitems,
gp->i_event + gp->i_next, gp->i_cnt * sizeof(EVENT));
gp->i_next = TERM_PUSH_SHIFT;
/* Put the new items into the queue. */
@ -408,9 +394,7 @@ copy: gp->i_cnt += nitems;
* Append events onto the tail of the buffer.
*/
static int
v_event_append(
SCR *sp,
EVENT *argp)
v_event_append(SCR *sp, EVENT *argp)
{
CHAR_T *s; /* Characters. */
EVENT *evp;
@ -535,11 +519,7 @@ v_event_append(
* PUBLIC: int v_event_get(SCR *, EVENT *, int, u_int32_t);
*/
int
v_event_get(
SCR *sp,
EVENT *argp,
int timeout,
u_int32_t flags)
v_event_get(SCR *sp, EVENT *argp, int timeout, u_int32_t flags)
{
EVENT *evp, ev;
GS *gp;
@ -754,9 +734,7 @@ not_digit: argp->e_c = CH_NOT_DIGIT;
* Walk the screen lists, sync'ing files to their backup copies.
*/
static void
v_sync(
SCR *sp,
int flags)
v_sync(SCR *sp, int flags)
{
GS *gp;
@ -774,9 +752,7 @@ v_sync(
* PUBLIC: void v_event_err(SCR *, EVENT *);
*/
void
v_event_err(
SCR *sp,
EVENT *evp)
v_event_err(SCR *sp, EVENT *evp)
{
switch (evp->e_event) {
case E_CHARACTER:
@ -813,8 +789,7 @@ v_event_err(
}
/* Free any allocated memory. */
if (evp->e_asp != NULL)
free(evp->e_asp);
free(evp->e_asp);
}
/*
@ -824,9 +799,7 @@ v_event_err(
* PUBLIC: int v_event_flush(SCR *, u_int);
*/
int
v_event_flush(
SCR *sp,
u_int flags)
v_event_flush(SCR *sp, u_int flags)
{
GS *gp;
int rval;
@ -842,9 +815,7 @@ v_event_flush(
* Grow the terminal queue.
*/
static int
v_event_grow(
SCR *sp,
int add)
v_event_grow(SCR *sp, int add)
{
GS *gp;
size_t new_nelem, olen;
@ -862,9 +833,7 @@ v_event_grow(
* Compare two keys for sorting.
*/
static int
v_key_cmp(
const void *ap,
const void *bp)
v_key_cmp(const void *ap, const void *bp)
{
return (((KEYLIST *)ap)->ch - ((KEYLIST *)bp)->ch);
}

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: key.h,v 10.56 2013/11/13 12:15:27 zy Exp $
*/
#include "multibyte.h"
@ -159,11 +157,13 @@ extern KEYLIST keylist[];
* can't use the standard isspace(3) macro because it returns true for
* characters like ^K in the ASCII character set. The POSIX isblank(3)
* has the same problem for non-ASCII locale, so we need a standalone one.
*
* XXX
* Note side effect, ch is evaluated multiple times.
*/
#define cmdskip(ch) ((ch) == ' ' || (ch) == '\t')
static __inline int
cmdskip(CHAR_T ch)
{
return ch == ' ' || ch == '\t';
}
/* The "standard" tab width, for displaying things to users. */
#define STANDARD_TAB 6

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: line.c,v 10.27 2015/04/03 14:17:21 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -35,8 +31,7 @@ static int scr_update(SCR *, recno_t, lnop_t, int);
* PUBLIC: int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *);
*/
int
db_eget(
SCR *sp,
db_eget(SCR *sp,
recno_t lno, /* Line number. */
CHAR_T **pp, /* Pointer store. */
size_t *lenp, /* Length store. */
@ -79,8 +74,7 @@ db_eget(
* PUBLIC: int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *);
*/
int
db_get(
SCR *sp,
db_get(SCR *sp,
recno_t lno, /* Line number. */
u_int32_t flags,
CHAR_T **pp, /* Pointer store. */
@ -202,9 +196,7 @@ err3: if (lenp != NULL)
* PUBLIC: int db_delete(SCR *, recno_t);
*/
int
db_delete(
SCR *sp,
recno_t lno)
db_delete(SCR *sp, recno_t lno)
{
DBT key;
EXF *ep;
@ -258,12 +250,7 @@ db_delete(
* PUBLIC: int db_append(SCR *, int, recno_t, CHAR_T *, size_t);
*/
int
db_append(
SCR *sp,
int update,
recno_t lno,
CHAR_T *p,
size_t len)
db_append(SCR *sp, int update, recno_t lno, CHAR_T *p, size_t len)
{
DBT data, key;
EXF *ep;
@ -334,11 +321,7 @@ db_append(
* PUBLIC: int db_insert(SCR *, recno_t, CHAR_T *, size_t);
*/
int
db_insert(
SCR *sp,
recno_t lno,
CHAR_T *p,
size_t len)
db_insert(SCR *sp, recno_t lno, CHAR_T *p, size_t len)
{
DBT data, key;
EXF *ep;
@ -401,11 +384,7 @@ db_insert(
* PUBLIC: int db_set(SCR *, recno_t, CHAR_T *, size_t);
*/
int
db_set(
SCR *sp,
recno_t lno,
CHAR_T *p,
size_t len)
db_set(SCR *sp, recno_t lno, CHAR_T *p, size_t len)
{
DBT data, key;
EXF *ep;
@ -461,9 +440,7 @@ db_set(
* PUBLIC: int db_exist(SCR *, recno_t);
*/
int
db_exist(
SCR *sp,
recno_t lno)
db_exist(SCR *sp, recno_t lno)
{
EXF *ep;
@ -496,9 +473,7 @@ db_exist(
* PUBLIC: int db_last(SCR *, recno_t *);
*/
int
db_last(
SCR *sp,
recno_t *lnop)
db_last(SCR *sp, recno_t *lnop)
{
DBT data, key;
EXF *ep;
@ -568,8 +543,7 @@ db_last(
* PUBLIC: int db_rget(SCR *, recno_t, char **, size_t *);
*/
int
db_rget(
SCR *sp,
db_rget(SCR *sp,
recno_t lno, /* Line number. */
char **pp, /* Pointer store. */
size_t *lenp) /* Length store. */
@ -597,11 +571,7 @@ db_rget(
* PUBLIC: int db_rset(SCR *, recno_t, char *, size_t);
*/
int
db_rset(
SCR *sp,
recno_t lno,
char *p,
size_t len)
db_rset(SCR *sp, recno_t lno, char *p, size_t len)
{
DBT data, key;
EXF *ep = sp->ep;
@ -621,9 +591,7 @@ db_rset(
* PUBLIC: void db_err(SCR *, recno_t);
*/
void
db_err(
SCR *sp,
recno_t lno)
db_err(SCR *sp, recno_t lno)
{
msgq(sp, M_ERR,
"008|Error: unable to retrieve line %lu", (u_long)lno);
@ -635,11 +603,7 @@ db_err(
* just changed.
*/
static int
scr_update(
SCR *sp,
recno_t lno,
lnop_t op,
int current)
scr_update(SCR *sp, recno_t lno, lnop_t op, int current)
{
EXF *ep;
SCR *tsp;

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: log.c,v 10.27 2011/07/13 06:25:50 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -20,6 +16,7 @@ static const char sccsid[] = "$Id: log.c,v 10.27 2011/07/13 06:25:50 zy Exp $";
#include <bitstring.h>
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
@ -93,9 +90,7 @@ typedef struct {
* PUBLIC: int log_init(SCR *, EXF *);
*/
int
log_init(
SCR *sp,
EXF *ep)
log_init(SCR *sp, EXF *ep)
{
/*
* !!!
@ -129,9 +124,7 @@ log_init(
* PUBLIC: int log_end(SCR *, EXF *);
*/
int
log_end(
SCR *sp,
EXF *ep)
log_end(SCR *sp, EXF *ep)
{
/*
* !!!
@ -141,10 +134,8 @@ log_end(
(void)(ep->log->close)(ep->log);
ep->log = NULL;
}
if (ep->l_lp != NULL) {
free(ep->l_lp);
ep->l_lp = NULL;
}
free(ep->l_lp);
ep->l_lp = NULL;
ep->l_len = 0;
ep->l_cursor.lno = 1; /* XXX Any valid recno. */
ep->l_cursor.cno = 0;
@ -186,9 +177,7 @@ log_cursor(SCR *sp)
* Actually push a cursor record out.
*/
static int
log_cursor1(
SCR *sp,
int type)
log_cursor1(SCR *sp, int type)
{
DBT data, key;
EXF *ep;
@ -224,10 +213,7 @@ log_cursor1(
* PUBLIC: int log_line(SCR *, recno_t, u_int);
*/
int
log_line(
SCR *sp,
recno_t lno,
u_int action)
log_line(SCR *sp, recno_t lno, u_int action)
{
DBT data, key;
EXF *ep;
@ -327,9 +313,7 @@ log_line(
* PUBLIC: int log_mark(SCR *, LMARK *);
*/
int
log_mark(
SCR *sp,
LMARK *lmp)
log_mark(SCR *sp, LMARK *lmp)
{
DBT data, key;
EXF *ep;
@ -373,9 +357,7 @@ log_mark(
* PUBLIC: int log_backward(SCR *, MARK *);
*/
int
log_backward(
SCR *sp,
MARK *rp)
log_backward(SCR *sp, MARK *rp)
{
DBT key, data;
EXF *ep;
@ -561,9 +543,7 @@ err: F_CLR(ep, F_NOLOG);
* PUBLIC: int log_forward(SCR *, MARK *);
*/
int
log_forward(
SCR *sp,
MARK *rp)
log_forward(SCR *sp, MARK *rp)
{
DBT key, data;
EXF *ep;
@ -658,14 +638,11 @@ err: F_CLR(ep, F_NOLOG);
* Try and restart the log on failure, i.e. if we run out of memory.
*/
static void
log_err(
SCR *sp,
char *file,
int line)
log_err(SCR *sp, char *file, int line)
{
EXF *ep;
msgq(sp, M_SYSERR, "015|%s/%d: log put error", tail(file), line);
msgq(sp, M_SYSERR, "015|%s/%d: log put error", basename(file), line);
ep = sp->ep;
(void)ep->log->close(ep->log);
if (!log_init(sp, ep))
@ -674,11 +651,7 @@ log_err(
#if defined(DEBUG) && 0
static void
log_trace(
SCR *sp,
char *msg,
recno_t rno,
u_char *p)
log_trace(SCR *sp, char *msg, recno_t rno, u_char *p)
{
LMARK lm;
MARK m;
@ -729,12 +702,8 @@ log_trace(
* Apply a realigned line from the log db to the file db.
*/
static int
apply_with(
int (*db_func)(SCR *, recno_t, CHAR_T *, size_t),
SCR *sp,
recno_t lno,
u_char *p,
size_t len)
apply_with(int (*db_func)(SCR *, recno_t, CHAR_T *, size_t), SCR *sp,
recno_t lno, u_char *p, size_t len)
{
#ifdef USE_WIDECHAR
typedef unsigned long nword;

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* @(#)log.h 10.2 (Berkeley) 3/6/96
*/
#define LOG_NOTYPE 0

View File

@ -9,15 +9,12 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: main.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <bitstring.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
@ -31,8 +28,7 @@ static const char sccsid[] = "$Id: main.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
#include "pathnames.h"
static void attach(GS *);
static void v_estr(char *, int, char *);
static int v_obsolete(char *, char *[]);
static int v_obsolete(char *[]);
/*
* editor --
@ -41,10 +37,7 @@ static int v_obsolete(char *, char *[]);
* PUBLIC: int editor(GS *, int, char *[]);
*/
int
editor(
GS *gp,
int argc,
char *argv[])
editor(GS *gp, int argc, char *argv[])
{
extern int optind;
extern char *optarg;
@ -82,12 +75,12 @@ editor(
/* Set initial screen type and mode based on the program name. */
readonly = 0;
if (!strcmp(gp->progname, "ex") || !strcmp(gp->progname, "nex"))
if (!strcmp(getprogname(), "ex") || !strcmp(getprogname(), "nex"))
LF_INIT(SC_EX);
else {
/* Nview, view are readonly. */
if (!strcmp(gp->progname, "nview") ||
!strcmp(gp->progname, "view"))
if (!strcmp(getprogname(), "nview") ||
!strcmp(getprogname(), "view"))
readonly = 1;
/* Vi is the default. */
@ -95,7 +88,7 @@ editor(
}
/* Convert old-style arguments into new-style ones. */
if (v_obsolete(gp->progname, argv))
if (v_obsolete(argv))
return (1);
/* Parse the arguments. */
@ -119,8 +112,7 @@ editor(
* We should support multiple -c options.
*/
if (gp->c_option != NULL) {
v_estr(gp->progname, 0,
"only one -c command may be specified.");
warnx("only one -c command may be specified.");
return (1);
}
gp->c_option = optarg;
@ -135,8 +127,7 @@ editor(
attach(gp);
break;
default:
v_estr(gp->progname, 0,
"usage: -D requires s or w argument.");
warnx("usage: -D requires s or w argument.");
return (1);
}
break;
@ -156,8 +147,7 @@ editor(
break;
case 'r': /* Recover. */
if (flagchk == 't') {
v_estr(gp->progname, 0,
"only one of -r and -t may be specified.");
warnx("only one of -r and -t may be specified.");
return (1);
}
flagchk = 'r';
@ -171,7 +161,7 @@ editor(
#ifdef DEBUG
case 'T': /* Trace. */
if ((gp->tracefp = fopen(optarg, "w")) == NULL) {
v_estr(gp->progname, errno, optarg);
warn("%s", optarg);
goto err;
}
(void)fprintf(gp->tracefp,
@ -180,13 +170,11 @@ editor(
#endif
case 't': /* Tag. */
if (flagchk == 'r') {
v_estr(gp->progname, 0,
"only one of -r and -t may be specified.");
warnx("only one of -r and -t may be specified.");
return (1);
}
if (flagchk == 't') {
v_estr(gp->progname, 0,
"only one tag file may be specified.");
warnx("only one tag file may be specified.");
return (1);
}
flagchk = 't';
@ -213,7 +201,7 @@ editor(
* If not reading from a terminal, it's like -s was specified.
*/
if (silent && !LF_ISSET(SC_EX)) {
v_estr(gp->progname, 0, "-s option is only applicable to ex.");
warnx("-s option is only applicable to ex.");
goto err;
}
if (LF_ISSET(SC_EX) && F_ISSET(gp, G_SCRIPTED))
@ -341,7 +329,7 @@ editor(
/* Cheat -- we know we have an extra argv slot. */
*--argv = strdup(sp->frp->name);
if (*argv == NULL) {
v_estr(gp->progname, errno, NULL);
warn(NULL);
goto err;
}
}
@ -452,17 +440,14 @@ v_end(gp)
/* Free FREF's. */
while ((frp = TAILQ_FIRST(gp->frefq)) != NULL) {
TAILQ_REMOVE(gp->frefq, frp, q);
if (frp->name != NULL)
free(frp->name);
if (frp->tname != NULL)
free(frp->tname);
free(frp->name);
free(frp->tname);
free(frp);
}
}
/* Free key input queue. */
if (gp->i_event != NULL)
free(gp->i_event);
free(gp->i_event);
/* Free cut buffers. */
cut_close(gp);
@ -499,8 +484,7 @@ v_end(gp)
#if defined(DEBUG) || defined(PURIFY)
/* Free any temporary space. */
if (gp->tmp_bp != NULL)
free(gp->tmp_bp);
free(gp->tmp_bp);
#if defined(DEBUG)
/* Close debugging file descriptor. */
@ -515,9 +499,7 @@ v_end(gp)
* Convert historic arguments into something getopt(3) will like.
*/
static int
v_obsolete(
char *name,
char *argv[])
v_obsolete(char *argv[])
{
size_t len;
char *p;
@ -555,7 +537,7 @@ v_obsolete(
if (argv[0][1] == '\0') {
argv[0] = strdup("-s");
if (argv[0] == NULL) {
nomem: v_estr(name, errno, NULL);
nomem: warn(NULL);
return (1);
}
} else
@ -574,7 +556,7 @@ attach(GS *gp)
char ch;
if ((fd = open(_PATH_TTY, O_RDONLY, 0)) < 0) {
v_estr(gp->progname, errno, _PATH_TTY);
warn("%s", _PATH_TTY);
return;
}
@ -591,17 +573,3 @@ attach(GS *gp)
(void)close(fd);
}
#endif
static void
v_estr(
char *name,
int eno,
char *msg)
{
(void)fprintf(stderr, "%s", name);
if (msg != NULL)
(void)fprintf(stderr, ": %s", msg);
if (eno)
(void)fprintf(stderr, ": %s", strerror(errno));
(void)fprintf(stderr, "\n");
}

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: mark.c,v 10.14 2011/07/04 14:42:58 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -66,9 +62,7 @@ static LMARK *mark_find(SCR *, ARG_CHAR_T);
* PUBLIC: int mark_init(SCR *, EXF *);
*/
int
mark_init(
SCR *sp,
EXF *ep)
mark_init(SCR *sp, EXF *ep)
{
/*
* !!!
@ -87,9 +81,7 @@ mark_init(
* PUBLIC: int mark_end(SCR *, EXF *);
*/
int
mark_end(
SCR *sp,
EXF *ep)
mark_end(SCR *sp, EXF *ep)
{
LMARK *lmp;
@ -111,11 +103,7 @@ mark_end(
* PUBLIC: int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t);
*/
int
mark_get(
SCR *sp,
ARG_CHAR_T key,
MARK *mp,
mtype_t mtype)
mark_get(SCR *sp, ARG_CHAR_T key, MARK *mp, mtype_t mtype)
{
LMARK *lmp;
@ -156,11 +144,7 @@ mark_get(
* PUBLIC: int mark_set(SCR *, ARG_CHAR_T, MARK *, int);
*/
int
mark_set(
SCR *sp,
ARG_CHAR_T key,
MARK *value,
int userset)
mark_set(SCR *sp, ARG_CHAR_T key, MARK *value, int userset)
{
LMARK *lmp, *lmt;
@ -175,7 +159,7 @@ mark_set(
*/
lmp = mark_find(sp, key);
if (lmp == NULL || lmp->name != key) {
MALLOC_RET(sp, lmt, LMARK *, sizeof(LMARK));
MALLOC_RET(sp, lmt, sizeof(LMARK));
if (lmp == NULL) {
SLIST_INSERT_HEAD(sp->ep->marks, lmt, q);
} else
@ -198,9 +182,7 @@ mark_set(
* where it would go.
*/
static LMARK *
mark_find(
SCR *sp,
ARG_CHAR_T key)
mark_find(SCR *sp, ARG_CHAR_T key)
{
LMARK *lmp, *lastlmp = NULL;
@ -223,10 +205,7 @@ mark_find(
* PUBLIC: int mark_insdel(SCR *, lnop_t, recno_t);
*/
int
mark_insdel(
SCR *sp,
lnop_t op,
recno_t lno)
mark_insdel(SCR *sp, lnop_t op, recno_t lno)
{
LMARK *lmp;
recno_t lline;

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: mark.h,v 10.6 2011/07/04 14:41:51 zy Exp $
*/
/*

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: mem.h,v 10.17 2012/10/07 00:40:29 zy Exp $
*/
#ifdef DEBUG
@ -148,45 +146,32 @@
/*
* Malloc a buffer, casting the return pointer. Various versions.
*
* !!!
* The cast should be unnecessary, malloc(3) and friends return void *'s,
* which is all we need. However, some systems that nvi needs to run on
* don't do it right yet, resulting in the compiler printing out roughly
* a million warnings. After awhile, it seemed easier to put the casts
* in instead of explaining it all the time.
*/
#define CALLOC(sp, p, cast, nmemb, size) { \
if ((p = (cast)calloc(nmemb, size)) == NULL) \
#define CALLOC(sp, p, nmemb, size) { \
if ((p = calloc(nmemb, size)) == NULL) \
msgq(sp, M_SYSERR, NULL); \
}
#define CALLOC_GOTO(sp, p, cast, nmemb, size) { \
if ((p = (cast)calloc(nmemb, size)) == NULL) \
#define CALLOC_GOTO(sp, p, nmemb, size) { \
if ((p = calloc(nmemb, size)) == NULL) \
goto alloc_err; \
}
#define CALLOC_NOMSG(sp, p, cast, nmemb, size) { \
p = (cast)calloc(nmemb, size); \
}
#define CALLOC_RET(sp, p, cast, nmemb, size) { \
if ((p = (cast)calloc(nmemb, size)) == NULL) { \
#define CALLOC_RET(sp, p, nmemb, size) { \
if ((p = calloc(nmemb, size)) == NULL) { \
msgq(sp, M_SYSERR, NULL); \
return (1); \
} \
}
#define MALLOC(sp, p, cast, size) { \
if ((p = (cast)malloc(size)) == NULL) \
#define MALLOC(sp, p, size) { \
if ((p = malloc(size)) == NULL) \
msgq(sp, M_SYSERR, NULL); \
}
#define MALLOC_GOTO(sp, p, cast, size) { \
if ((p = (cast)malloc(size)) == NULL) \
#define MALLOC_GOTO(sp, p, size) { \
if ((p = malloc(size)) == NULL) \
goto alloc_err; \
}
#define MALLOC_NOMSG(sp, p, cast, size) { \
p = (cast)malloc(size); \
}
#define MALLOC_RET(sp, p, cast, size) { \
if ((p = (cast)malloc(size)) == NULL) { \
#define MALLOC_RET(sp, p, size) { \
if ((p = malloc(size)) == NULL) { \
msgq(sp, M_SYSERR, NULL); \
return (1); \
} \
@ -198,21 +183,13 @@
*/
#define REALLOC(sp, p, cast, size) { \
cast newp; \
if ((newp = (cast)realloc(p, size)) == NULL) { \
if (p != NULL) \
free(p); \
if ((newp = realloc(p, size)) == NULL) { \
free(p); \
msgq(sp, M_SYSERR, NULL); \
} \
p = newp; \
}
/*
* Versions of bcopy(3) and bzero(3) that use the size of the
* initial pointer to figure out how much memory to manipulate.
*/
#define BCOPY(p, t, len) bcopy(p, t, (len) * sizeof(*(p)))
#define BZERO(p, len) bzero(p, (len) * sizeof(*(p)))
/*
* p2roundup --
* Get next power of 2; convenient for realloc.

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: msg.c,v 11.1 2015/02/09 11:12:44 marc Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -39,11 +35,7 @@ static const char sccsid[] = "$Id: msg.c,v 11.1 2015/02/09 11:12:44 marc Exp $";
* PUBLIC: void msgq(SCR *, mtype_t, const char *, ...);
*/
void
msgq(
SCR *sp,
mtype_t mt,
const char *fmt,
...)
msgq(SCR *sp, mtype_t mt, const char *fmt, ...)
{
#ifndef NL_ARGMAX
#define __NL_ARGMAX 20 /* Set to 9 by System V. */
@ -202,12 +194,12 @@ retry: FREE_SPACE(sp, bp, blen);
if (*p == '\0')
break;
++p;
if (!isdigit(*p)) {
if (!isdigit((u_char)*p)) {
if (*p == '%')
++p;
continue;
}
for (u = p; *++p != '\0' && isdigit(*p););
for (u = p; *++p != '\0' && isdigit((u_char)*p););
if (*p != '$')
continue;
@ -359,11 +351,7 @@ nofmt: mp += len;
* PUBLIC: void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *);
*/
void
msgq_wstr(
SCR *sp,
mtype_t mtype,
const CHAR_T *str,
const char *fmt)
msgq_wstr(SCR *sp, mtype_t mtype, const CHAR_T *str, const char *fmt)
{
size_t nlen;
CONST char *nstr;
@ -383,11 +371,7 @@ msgq_wstr(
* PUBLIC: void msgq_str(SCR *, mtype_t, const char *, const char *);
*/
void
msgq_str(
SCR *sp,
mtype_t mtype,
const char *str,
const char *fmt)
msgq_str(SCR *sp, mtype_t mtype, const char *str, const char *fmt)
{
int nf, sv_errno;
char *p;
@ -536,10 +520,7 @@ mod_rpt(SCR *sp)
* PUBLIC: void msgq_status(SCR *, recno_t, u_int);
*/
void
msgq_status(
SCR *sp,
recno_t lno,
u_int flags)
msgq_status(SCR *sp, recno_t lno, u_int flags)
{
recno_t last;
size_t blen, len;
@ -708,9 +689,7 @@ msgq_status(
* PUBLIC: int msg_open(SCR *, char *);
*/
int
msg_open(
SCR *sp,
char *file)
msg_open(SCR *sp, char *file)
{
/*
* !!!
@ -788,10 +767,7 @@ msg_close(GS *gp)
* PUBLIC: const char *msg_cmsg(SCR *, cmsg_t, size_t *);
*/
const char *
msg_cmsg(
SCR *sp,
cmsg_t which,
size_t *lenp)
msg_cmsg(SCR *sp, cmsg_t which, size_t *lenp)
{
switch (which) {
case CMSG_CONF:
@ -826,10 +802,7 @@ msg_cmsg(
* PUBLIC: const char *msg_cat(SCR *, const char *, size_t *);
*/
const char *
msg_cat(
SCR *sp,
const char *str,
size_t *lenp)
msg_cat(SCR *sp, const char *str, size_t *lenp)
{
GS *gp;
char *p;
@ -839,8 +812,9 @@ msg_cat(
* If it's not a catalog message, i.e. has doesn't have a leading
* number and '|' symbol, we're done.
*/
if (isdigit(str[0]) &&
isdigit(str[1]) && isdigit(str[2]) && str[3] == '|') {
if (isdigit((u_char)str[0]) &&
isdigit((u_char)str[1]) &&
isdigit((u_char)str[2]) && str[3] == '|') {
msgno = atoi(str);
str = &str[4];
@ -864,10 +838,7 @@ msg_cat(
* PUBLIC: char *msg_print(SCR *, const char *, int *);
*/
char *
msg_print(
SCR *sp,
const char *s,
int *needfree)
msg_print(SCR *sp, const char *s, int *needfree)
{
size_t blen, nlen;
char *bp, *ep, *p, *t;

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* @(#)msg.h 10.10 (Berkeley) 5/10/96
*/
/*

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: multibyte.h,v 1.32 2012/10/07 01:35:58 zy Exp $
*/
#ifndef MULTIBYTE_H
@ -112,4 +110,38 @@ typedef char RCHAR_T;
#define SIZE(w) (sizeof(w) / sizeof(*w))
/*
* Locale insensitive character category detection.
*/
static __inline int
isatoz(CHAR_T c)
{
return 'a' <= c && c <= 'z';
}
static __inline int
isAtoZ(CHAR_T c)
{
return 'A' <= c && c <= 'Z';
}
static __inline int
is0to9(CHAR_T c)
{
return '0' <= c && c <= '9';
}
static __inline int
isazAZ(CHAR_T c)
{
return isatoz(c) || isAtoZ(c);
}
static __inline int
is09azAZ(CHAR_T c)
{
return is0to9(c) || isazAZ(c);
}
#endif

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: options.c,v 10.73 2012/10/09 06:14:07 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -79,6 +75,8 @@ OPTLIST const optlist[] = {
{L("errorbells"), NULL, OPT_0BOOL, 0},
/* O_ESCAPETIME 4.4BSD */
{L("escapetime"), NULL, OPT_NUM, 0},
/* O_EXPANDTAB NetBSD 5.0 */
{L("expandtab"), NULL, OPT_0BOOL, 0},
/* O_EXRC System V (undocumented) */
{L("exrc"), NULL, OPT_0BOOL, 0},
/* O_EXTENDED 4.4BSD */
@ -256,6 +254,7 @@ static OABBREV const abbrev[] = {
{L("dir"), O_TMPDIR}, /* 4BSD */
{L("eb"), O_ERRORBELLS}, /* 4BSD */
{L("ed"), O_EDCOMPATIBLE}, /* 4BSD */
{L("et"), O_EXPANDTAB}, /* NetBSD 5.0 */
{L("ex"), O_EXRC}, /* System V (undocumented) */
{L("fe"), O_FILEENCODING},
{L("ht"), O_HARDTABS}, /* 4BSD */
@ -297,9 +296,7 @@ static OABBREV const abbrev[] = {
* PUBLIC: int opts_init(SCR *, int *);
*/
int
opts_init(
SCR *sp,
int *oargs)
opts_init(SCR *sp, int *oargs)
{
ARGS *argv[2], a, b;
OPTLIST const *op;
@ -463,10 +460,7 @@ err: msgq_wstr(sp, M_ERR, optlist[optindx].name,
* PUBLIC: int opts_set(SCR *, ARGS *[], char *);
*/
int
opts_set(
SCR *sp,
ARGS *argv[],
char *usage)
opts_set(SCR *sp, ARGS *argv[], char *usage)
{
enum optdisp disp;
enum nresult nret;
@ -757,12 +751,7 @@ badnum: INT2CHAR(sp, name, STRLEN(name) + 1,
* PUBLIC: int o_set(SCR *, int, u_int, char *, u_long);
*/
int
o_set(
SCR *sp,
int opt,
u_int flags,
char *str,
u_long val)
o_set(SCR *sp, int opt, u_int flags, char *str, u_long val)
{
OPTION *op;
@ -779,14 +768,14 @@ o_set(
/* Free the previous string, if requested, and set the value. */
if LF_ISSET(OS_DEF)
if (LF_ISSET(OS_STR | OS_STRDUP)) {
if (!LF_ISSET(OS_NOFREE) && op->o_def.str != NULL)
if (!LF_ISSET(OS_NOFREE))
free(op->o_def.str);
op->o_def.str = str;
} else
op->o_def.val = val;
else
if (LF_ISSET(OS_STR | OS_STRDUP)) {
if (!LF_ISSET(OS_NOFREE) && op->o_cur.str != NULL)
if (!LF_ISSET(OS_NOFREE))
free(op->o_cur.str);
op->o_cur.str = str;
} else
@ -801,10 +790,7 @@ o_set(
* PUBLIC: int opts_empty(SCR *, int, int);
*/
int
opts_empty(
SCR *sp,
int off,
int silent)
opts_empty(SCR *sp, int off, int silent)
{
char *p;
@ -824,9 +810,7 @@ opts_empty(
* PUBLIC: void opts_dump(SCR *, enum optdisp);
*/
void
opts_dump(
SCR *sp,
enum optdisp type)
opts_dump(SCR *sp, enum optdisp type)
{
OPTLIST const *op;
int base, b_num, cnt, col, colwidth, curlen, s_num;
@ -958,9 +942,7 @@ opts_dump(
* Print out an option.
*/
static int
opts_print(
SCR *sp,
OPTLIST const *op)
opts_print(SCR *sp, OPTLIST const *op)
{
int curlen, offset;
@ -990,9 +972,7 @@ opts_print(
* PUBLIC: int opts_save(SCR *, FILE *);
*/
int
opts_save(
SCR *sp,
FILE *fp)
opts_save(SCR *sp, FILE *fp)
{
OPTLIST const *op;
CHAR_T ch, *p;
@ -1093,26 +1073,20 @@ opts_search(CHAR_T *name)
* PUBLIC: void opts_nomatch(SCR *, CHAR_T *);
*/
void
opts_nomatch(
SCR *sp,
CHAR_T *name)
opts_nomatch(SCR *sp, CHAR_T *name)
{
msgq_wstr(sp, M_ERR, name,
"033|set: no %s option: 'set all' gives all option values");
}
static int
opts_abbcmp(
const void *a,
const void *b)
opts_abbcmp(const void *a, const void *b)
{
return(STRCMP(((OABBREV *)a)->name, ((OABBREV *)b)->name));
}
static int
opts_cmp(
const void *a,
const void *b)
opts_cmp(const void *a, const void *b)
{
return(STRCMP(((OPTLIST *)a)->name, ((OPTLIST *)b)->name));
}
@ -1124,9 +1098,7 @@ opts_cmp(
* PUBLIC: int opts_copy(SCR *, SCR *);
*/
int
opts_copy(
SCR *orig,
SCR *sp)
opts_copy(SCR *orig, SCR *sp)
{
int cnt, rval;
@ -1180,9 +1152,7 @@ opts_free(SCR *sp)
if (optlist[cnt].type != OPT_STR ||
F_ISSET(&sp->opts[cnt], OPT_GLOBAL))
continue;
if (O_STR(sp, cnt) != NULL)
free(O_STR(sp, cnt));
if (O_D_STR(sp, cnt) != NULL)
free(O_D_STR(sp, cnt));
free(O_STR(sp, cnt));
free(O_D_STR(sp, cnt));
}
}

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: options.h,v 10.21 2012/02/10 20:24:58 zy Exp $
*/
/*

View File

@ -1,83 +0,0 @@
#define O_ALTWERASE 0
#define O_AUTOINDENT 1
#define O_AUTOPRINT 2
#define O_AUTOWRITE 3
#define O_BACKUP 4
#define O_BEAUTIFY 5
#define O_CDPATH 6
#define O_CEDIT 7
#define O_COLUMNS 8
#define O_COMBINED 9
#define O_COMMENT 10
#define O_TMPDIR 11
#define O_EDCOMPATIBLE 12
#define O_ERRORBELLS 13
#define O_ESCAPETIME 14
#define O_EXRC 15
#define O_EXTENDED 16
#define O_FILEC 17
#define O_FILEENCODING 18
#define O_FLASH 19
#define O_HARDTABS 20
#define O_ICLOWER 21
#define O_IGNORECASE 22
#define O_INPUTENCODING 23
#define O_KEYTIME 24
#define O_LEFTRIGHT 25
#define O_LINES 26
#define O_LISP 27
#define O_LIST 28
#define O_LOCKFILES 29
#define O_MAGIC 30
#define O_MATCHCHARS 31
#define O_MATCHTIME 32
#define O_MESG 33
#define O_MODELINE 34
#define O_MSGCAT 35
#define O_NOPRINT 36
#define O_NUMBER 37
#define O_OCTAL 38
#define O_OPEN 39
#define O_OPTIMIZE 40
#define O_PARAGRAPHS 41
#define O_PATH 42
#define O_PRINT 43
#define O_PROMPT 44
#define O_READONLY 45
#define O_RECDIR 46
#define O_REDRAW 47
#define O_REMAP 48
#define O_REPORT 49
#define O_RULER 50
#define O_SCROLL 51
#define O_SEARCHINCR 52
#define O_SECTIONS 53
#define O_SECURE 54
#define O_SHELL 55
#define O_SHELLMETA 56
#define O_SHIFTWIDTH 57
#define O_SHOWMATCH 58
#define O_SHOWMODE 59
#define O_SIDESCROLL 60
#define O_SLOWOPEN 61
#define O_SOURCEANY 62
#define O_TABSTOP 63
#define O_TAGLENGTH 64
#define O_TAGS 65
#define O_TERM 66
#define O_TERSE 67
#define O_TILDEOP 68
#define O_TIMEOUT 69
#define O_TTYWERASE 70
#define O_VERBOSE 71
#define O_W1200 72
#define O_W300 73
#define O_W9600 74
#define O_WARN 75
#define O_WINDOW 76
#define O_WINDOWNAME 77
#define O_WRAPLEN 78
#define O_WRAPMARGIN 79
#define O_WRAPSCAN 80
#define O_WRITEANY 81
#define O_OPTIONCOUNT 82

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: options_f.c,v 10.34 04/07/11 16:06:29 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -32,11 +28,7 @@ static const char sccsid[] = "$Id: options_f.c,v 10.34 04/07/11 16:06:29 zy Exp
* PUBLIC: int f_altwerase(SCR *, OPTION *, char *, u_long *);
*/
int
f_altwerase(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_altwerase(SCR *sp, OPTION *op, char *str, u_long *valp)
{
if (*valp)
O_CLR(sp, O_TTYWERASE);
@ -47,11 +39,7 @@ f_altwerase(
* PUBLIC: int f_columns(SCR *, OPTION *, char *, u_long *);
*/
int
f_columns(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_columns(SCR *sp, OPTION *op, char *str, u_long *valp)
{
/* Validate the number. */
if (*valp < MINIMUM_SCREEN_COLS) {
@ -81,11 +69,7 @@ f_columns(
* PUBLIC: int f_lines(SCR *, OPTION *, char *, u_long *);
*/
int
f_lines(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_lines(SCR *sp, OPTION *op, char *str, u_long *valp)
{
/* Validate the number. */
if (*valp < MINIMUM_SCREEN_ROWS) {
@ -138,11 +122,7 @@ f_lines(
* PUBLIC: int f_lisp(SCR *, OPTION *, char *, u_long *);
*/
int
f_lisp(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_lisp(SCR *sp, OPTION *op, char *str, u_long *valp)
{
msgq(sp, M_ERR, "044|The lisp option is not implemented");
return (0);
@ -152,11 +132,7 @@ f_lisp(
* PUBLIC: int f_msgcat(SCR *, OPTION *, char *, u_long *);
*/
int
f_msgcat(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_msgcat(SCR *sp, OPTION *op, char *str, u_long *valp)
{
(void)msg_open(sp, str);
return (0);
@ -166,11 +142,7 @@ f_msgcat(
* PUBLIC: int f_print(SCR *, OPTION *, char *, u_long *);
*/
int
f_print(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_print(SCR *sp, OPTION *op, char *str, u_long *valp)
{
int offset = op - sp->opts;
@ -195,11 +167,7 @@ f_print(
* PUBLIC: int f_readonly(SCR *, OPTION *, char *, u_long *);
*/
int
f_readonly(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_readonly(SCR *sp, OPTION *op, char *str, u_long *valp)
{
/*
* !!!
@ -216,11 +184,7 @@ f_readonly(
* PUBLIC: int f_recompile(SCR *, OPTION *, char *, u_long *);
*/
int
f_recompile(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_recompile(SCR *sp, OPTION *op, char *str, u_long *valp)
{
if (F_ISSET(sp, SC_RE_SEARCH)) {
regfree(&sp->re_c);
@ -237,11 +201,7 @@ f_recompile(
* PUBLIC: int f_reformat(SCR *, OPTION *, char *, u_long *);
*/
int
f_reformat(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_reformat(SCR *sp, OPTION *op, char *str, u_long *valp)
{
F_SET(sp, SC_SCR_REFORMAT);
return (0);
@ -251,11 +211,7 @@ f_reformat(
* PUBLIC: int f_ttywerase(SCR *, OPTION *, char *, u_long *);
*/
int
f_ttywerase(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_ttywerase(SCR *sp, OPTION *op, char *str, u_long *valp)
{
if (*valp)
O_CLR(sp, O_ALTWERASE);
@ -266,11 +222,7 @@ f_ttywerase(
* PUBLIC: int f_w300(SCR *, OPTION *, char *, u_long *);
*/
int
f_w300(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_w300(SCR *sp, OPTION *op, char *str, u_long *valp)
{
u_long v;
@ -287,11 +239,7 @@ f_w300(
* PUBLIC: int f_w1200(SCR *, OPTION *, char *, u_long *);
*/
int
f_w1200(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_w1200(SCR *sp, OPTION *op, char *str, u_long *valp)
{
u_long v;
@ -308,11 +256,7 @@ f_w1200(
* PUBLIC: int f_w9600(SCR *, OPTION *, char *, u_long *);
*/
int
f_w9600(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_w9600(SCR *sp, OPTION *op, char *str, u_long *valp)
{
u_long v;
@ -329,11 +273,7 @@ f_w9600(
* PUBLIC: int f_window(SCR *, OPTION *, char *, u_long *);
*/
int
f_window(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_window(SCR *sp, OPTION *op, char *str, u_long *valp)
{
if (*valp >= O_VAL(sp, O_LINES) - 1 &&
(*valp = O_VAL(sp, O_LINES) - 1) == 0)
@ -345,11 +285,7 @@ f_window(
* PUBLIC: int f_encoding(SCR *, OPTION *, char *, u_long *);
*/
int
f_encoding(
SCR *sp,
OPTION *op,
char *str,
u_long *valp)
f_encoding(SCR *sp, OPTION *op, char *str, u_long *valp)
{
int offset = op - sp->opts;

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: put.c,v 10.19 04/07/11 17:00:24 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -33,13 +29,7 @@ static const char sccsid[] = "$Id: put.c,v 10.19 04/07/11 17:00:24 zy Exp $";
* PUBLIC: int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int);
*/
int
put(
SCR *sp,
CB *cbp,
CHAR_T *namep,
MARK *cp,
MARK *rp,
int append)
put(SCR *sp, CB *cbp, CHAR_T *namep, MARK *cp, MARK *rp, int append)
{
CHAR_T name;
TEXT *ltp, *tp;

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: recover.c,v 11.3 2015/04/04 03:50:42 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -116,10 +112,7 @@ static int rcv_dlnread(SCR *, char **, char **, FILE *);
* PUBLIC: int rcv_tmp(SCR *, EXF *, char *);
*/
int
rcv_tmp(
SCR *sp,
EXF *ep,
char *name)
rcv_tmp(SCR *sp, EXF *ep, char *name)
{
struct stat sb;
int fd;
@ -237,9 +230,7 @@ err: msgq(sp, M_ERR,
* PUBLIC: int rcv_sync(SCR *, u_int);
*/
int
rcv_sync(
SCR *sp,
u_int flags)
rcv_sync(SCR *sp, u_int flags)
{
EXF *ep;
int fd, rval;
@ -318,10 +309,7 @@ err: rval = 1;
* Build the file to mail to the user.
*/
static int
rcv_mailfile(
SCR *sp,
int issync,
char *cp_path)
rcv_mailfile(SCR *sp, int issync, char *cp_path)
{
EXF *ep;
GS *gp;
@ -404,7 +392,7 @@ rcv_mailfile(
goto err;
}
MALLOC(sp, host, char *, hostmax + 1);
MALLOC(sp, host, hostmax + 1);
if (host == NULL)
goto err;
(void)gethostname(host, hostmax + 1);
@ -429,8 +417,8 @@ rcv_mailfile(
" was editing a file named ", t, " on the machine ",
host, ", when it was saved for recovery. ",
"You can recover most, if not all, of the changes ",
"to this file using the -r option to ", gp->progname, ":\n\n\t",
gp->progname, " -r ", qt);
"to this file using the -r option to ", getprogname(), ":\n\n\t",
getprogname(), " -r ", qt);
free(qt);
free(host);
if (buf == NULL) {
@ -594,13 +582,11 @@ rcv_list(SCR *sp)
/* Close, discarding lock. */
next: (void)fclose(fp);
if (file != NULL)
free(file);
if (path != NULL)
free(path);
free(file);
free(path);
}
if (found == 0)
(void)printf("%s: No files to recover\n", sp->gp->progname);
(void)printf("%s: No files to recover\n", getprogname());
(void)closedir(dirp);
return (0);
}
@ -612,9 +598,7 @@ next: (void)fclose(fp);
* PUBLIC: int rcv_read(SCR *, FREF *);
*/
int
rcv_read(
SCR *sp,
FREF *frp)
rcv_read(SCR *sp, FREF *frp)
{
struct dirent *dp;
struct stat sb;
@ -732,12 +716,10 @@ rcv_read(
sv_fd = dup(fileno(fp));
} else {
next: free(recpath);
if (path != NULL)
free(path);
free(path);
}
(void)fclose(fp);
if (file != NULL)
free(file);
free(file);
}
(void)closedir(dirp);
@ -790,10 +772,7 @@ next: free(recpath);
* Copy a recovery file.
*/
static int
rcv_copy(
SCR *sp,
int wfd,
char *fname)
rcv_copy(SCR *sp, int wfd, char *fname)
{
int nr, nw, off, rfd;
char buf[8 * 1024];
@ -816,10 +795,7 @@ err: msgq_str(sp, M_SYSERR, fname, "%s");
* Paranoid make temporary file routine.
*/
static int
rcv_mktemp(
SCR *sp,
char *path,
char *dname)
rcv_mktemp(SCR *sp, char *path, char *dname)
{
int fd;
@ -833,9 +809,7 @@ rcv_mktemp(
* Send email.
*/
static void
rcv_email(
SCR *sp,
char *fname)
rcv_email(SCR *sp, char *fname)
{
char *buf;
@ -854,11 +828,7 @@ rcv_email(
* Encode a string into an X-vi-data line and write it.
*/
static int
rcv_dlnwrite(
SCR *sp,
const char *dtype,
const char *src,
FILE *fp)
rcv_dlnwrite(SCR *sp, const char *dtype, const char *src, FILE *fp)
{
char *bp = NULL, *p;
size_t blen = 0;
@ -901,9 +871,7 @@ err: FREE_SPACE(sp, bp, blen);
* Read an X-vi-data line and decode it.
*/
static int
rcv_dlnread(
SCR *sp,
char **dtypep,
rcv_dlnread(SCR *sp, char **dtypep,
char **datap, /* free *datap if != NULL after use. */
FILE *fp)
{
@ -948,7 +916,7 @@ rcv_dlnread(
len -= src - bp;
/* Memory looks like: "<data>\0<dtype>\0". */
MALLOC(sp, data, char *, dlen + len / 4 * 3 + 2);
MALLOC(sp, data, dlen + len / 4 * 3 + 2);
if (data == NULL)
goto err;
if ((xlen = (b64_pton(p + dlen + 1,

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: screen.c,v 10.25 2011/12/04 04:06:45 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -35,16 +31,13 @@ static const char sccsid[] = "$Id: screen.c,v 10.25 2011/12/04 04:06:45 zy Exp $
* PUBLIC: int screen_init(GS *, SCR *, SCR **);
*/
int
screen_init(
GS *gp,
SCR *orig,
SCR **spp)
screen_init(GS *gp, SCR *orig, SCR **spp)
{
SCR *sp;
size_t len;
*spp = NULL;
CALLOC_RET(orig, sp, SCR *, 1, sizeof(SCR));
CALLOC_RET(orig, sp, 1, sizeof(SCR));
*spp = sp;
/* INITIALIZED AT SCREEN CREATE. */
@ -94,7 +87,7 @@ screen_init(
sp->repl_len = orig->repl_len;
if (orig->newl_len) {
len = orig->newl_len * sizeof(size_t);
MALLOC(sp, sp->newl, size_t *, len);
MALLOC(sp, sp->newl, len);
if (sp->newl == NULL) {
mem: msgq(orig, M_SYSERR, NULL);
goto err;
@ -172,22 +165,17 @@ screen_end(SCR *sp)
text_lfree(sp->tiq);
/* Free alternate file name. */
if (sp->alt_name != NULL)
free(sp->alt_name);
free(sp->alt_name);
/* Free up search information. */
if (sp->re != NULL)
free(sp->re);
free(sp->re);
if (F_ISSET(sp, SC_RE_SEARCH))
regfree(&sp->re_c);
if (sp->subre != NULL)
free(sp->subre);
free(sp->subre);
if (F_ISSET(sp, SC_RE_SUBST))
regfree(&sp->subre_c);
if (sp->repl != NULL)
free(sp->repl);
if (sp->newl != NULL)
free(sp->newl);
free(sp->repl);
free(sp->newl);
/* Free the iconv environment */
conv_end(sp);

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: screen.h,v 10.26 2011/12/12 22:31:36 zy Exp $
*/
/*

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: search.c,v 10.27 2015/03/13 18:41:35 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -38,13 +34,8 @@ static int search_init(SCR *, dir_t, CHAR_T *, size_t, CHAR_T **, u_int);
* Set up a search.
*/
static int
search_init(
SCR *sp,
dir_t dir,
CHAR_T *ptrn,
size_t plen,
CHAR_T **epp,
u_int flags)
search_init(SCR *sp, dir_t dir, CHAR_T *ptrn, size_t plen, CHAR_T **epp,
u_int flags)
{
recno_t lno;
int delim;
@ -146,14 +137,8 @@ prev: if (sp->re == NULL) {
* PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
*/
int
f_search(
SCR *sp,
MARK *fm,
MARK *rm,
CHAR_T *ptrn,
size_t plen,
CHAR_T **eptrn,
u_int flags)
f_search(SCR *sp, MARK *fm, MARK *rm, CHAR_T *ptrn, size_t plen,
CHAR_T **eptrn, u_int flags)
{
busy_t btype;
recno_t lno;
@ -293,14 +278,8 @@ f_search(
* PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
*/
int
b_search(
SCR *sp,
MARK *fm,
MARK *rm,
CHAR_T *ptrn,
size_t plen,
CHAR_T **eptrn,
u_int flags)
b_search(SCR *sp, MARK *fm, MARK *rm, CHAR_T *ptrn, size_t plen,
CHAR_T **eptrn, u_int flags)
{
busy_t btype;
recno_t lno;
@ -454,9 +433,7 @@ err: if (LF_ISSET(SEARCH_MSG))
* Display one of the search messages.
*/
static void
search_msg(
SCR *sp,
smsg_t msg)
search_msg(SCR *sp, smsg_t msg)
{
switch (msg) {
case S_EMPTY:
@ -491,9 +468,7 @@ search_msg(
* PUBLIC: void search_busy(SCR *, busy_t);
*/
void
search_busy(
SCR *sp,
busy_t btype)
search_busy(SCR *sp, busy_t btype)
{
sp->gp->scr_busy(sp, "078|Searching...", btype);
}

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: seq.c,v 10.18 2011/12/11 23:13:00 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -35,16 +31,8 @@ static const char sccsid[] = "$Id: seq.c,v 10.18 2011/12/11 23:13:00 zy Exp $";
* PUBLIC: size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int);
*/
int
seq_set(
SCR *sp,
CHAR_T *name,
size_t nlen,
CHAR_T *input,
size_t ilen,
CHAR_T *output,
size_t olen,
seq_t stype,
int flags)
seq_set(SCR *sp, CHAR_T *name, size_t nlen, CHAR_T *input, size_t ilen,
CHAR_T *output, size_t olen, seq_t stype, int flags)
{
CHAR_T *p;
SEQ *lastqp, *qp;
@ -68,15 +56,14 @@ seq_set(
sv_errno = errno;
goto mem1;
}
if (qp->output != NULL)
free(qp->output);
free(qp->output);
qp->olen = olen;
qp->output = p;
return (0);
}
/* Allocate and initialize SEQ structure. */
CALLOC(sp, qp, SEQ *, 1, sizeof(SEQ));
CALLOC(sp, qp, 1, sizeof(SEQ));
if (qp == NULL) {
sv_errno = errno;
goto mem1;
@ -105,8 +92,7 @@ seq_set(
} else if ((qp->output = v_wstrdup(sp, output, olen)) == NULL) {
sv_errno = errno;
free(qp->input);
mem3: if (qp->name != NULL)
free(qp->name);
mem3: free(qp->name);
mem2: free(qp);
mem1: errno = sv_errno;
msgq(sp, M_SYSERR, NULL);
@ -139,11 +125,7 @@ mem1: errno = sv_errno;
* PUBLIC: int seq_delete(SCR *, CHAR_T *, size_t, seq_t);
*/
int
seq_delete(
SCR *sp,
CHAR_T *input,
size_t ilen,
seq_t stype)
seq_delete(SCR *sp, CHAR_T *input, size_t ilen, seq_t stype)
{
SEQ *qp, *pre_qp = NULL;
int diff;
@ -177,12 +159,9 @@ seq_delete(
int
seq_free(SEQ *qp)
{
if (qp->name != NULL)
free(qp->name);
if (qp->input != NULL)
free(qp->input);
if (qp->output != NULL)
free(qp->output);
free(qp->name);
free(qp->input);
free(qp->output);
free(qp);
return (0);
}
@ -196,14 +175,8 @@ seq_free(SEQ *qp)
* PUBLIC: (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *);
*/
SEQ *
seq_find(
SCR *sp,
SEQ **lastqp,
EVENT *e_input,
CHAR_T *c_input,
size_t ilen,
seq_t stype,
int *ispartialp)
seq_find(SCR *sp, SEQ **lastqp, EVENT *e_input, CHAR_T *c_input, size_t ilen,
seq_t stype, int *ispartialp)
{
SEQ *lqp = NULL, *qp;
int diff;
@ -298,10 +271,7 @@ seq_close(GS *gp)
* PUBLIC: int seq_dump(SCR *, seq_t, int);
*/
int
seq_dump(
SCR *sp,
seq_t stype,
int isname)
seq_dump(SCR *sp, seq_t stype, int isname)
{
CHAR_T *p;
GS *gp;
@ -346,11 +316,7 @@ seq_dump(
* PUBLIC: int seq_save(SCR *, FILE *, char *, seq_t);
*/
int
seq_save(
SCR *sp,
FILE *fp,
char *prefix,
seq_t stype)
seq_save(SCR *sp, FILE *fp, char *prefix, seq_t stype)
{
CHAR_T *p;
SEQ *qp;
@ -392,10 +358,7 @@ seq_save(
* PUBLIC: int e_memcmp(CHAR_T *, EVENT *, size_t);
*/
int
e_memcmp(
CHAR_T *p1,
EVENT *ep,
size_t n)
e_memcmp(CHAR_T *p1, EVENT *ep, size_t n)
{
if (n != 0) {
do {

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: seq.h,v 10.4 2011/12/11 21:43:39 zy Exp $
*/
/*

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: util.c,v 10.30 2013/03/19 10:00:27 yamt Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
@ -42,11 +38,8 @@ static const char sccsid[] = "$Id: util.c,v 10.30 2013/03/19 10:00:27 yamt Exp $
* PUBLIC: void *binc(SCR *, void *, size_t *, size_t);
*/
void *
binc(
SCR *sp, /* sp MAY BE NULL!!! */
void *bp,
size_t *bsizep,
size_t min)
binc(SCR *sp, /* sp MAY BE NULL!!! */
void *bp, size_t *bsizep, size_t min)
{
size_t csize;
@ -79,10 +72,7 @@ binc(
* PUBLIC: int nonblank(SCR *, recno_t, size_t *);
*/
int
nonblank(
SCR *sp,
recno_t lno,
size_t *cnop)
nonblank(SCR *sp, recno_t lno, size_t *cnop)
{
CHAR_T *p;
size_t cnt, len, off;
@ -108,22 +98,6 @@ nonblank(
return (0);
}
/*
* tail --
* Return tail of a path.
*
* PUBLIC: char *tail(char *);
*/
char *
tail(char *path)
{
char *p;
if ((p = strrchr(path, '/')) == NULL)
return (path);
return (p + 1);
}
/*
* join --
* Join two paths; need free.
@ -131,9 +105,7 @@ tail(char *path)
* PUBLIC: char *join(char *, char *);
*/
char *
join(
char *path1,
char *path2)
join(char *path1, char *path2)
{
char *p;
@ -212,8 +184,8 @@ quote(char *str)
n++;
if (unsafe)
continue;
if (isascii(*p)) {
if (isalnum(*p))
if (isascii((u_char)*p)) {
if (isalnum((u_char)*p))
continue;
switch (*p) {
case '%': case '+': case ',': case '-': case '.':
@ -248,14 +220,11 @@ quote(char *str)
* PUBLIC: char *v_strdup(SCR *, const char *, size_t);
*/
char *
v_strdup(
SCR *sp,
const char *str,
size_t len)
v_strdup(SCR *sp, const char *str, size_t len)
{
char *copy;
MALLOC(sp, copy, char *, len + 1);
MALLOC(sp, copy, len + 1);
if (copy == NULL)
return (NULL);
memcpy(copy, str, len);
@ -270,13 +239,11 @@ v_strdup(
* PUBLIC: CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t);
*/
CHAR_T *
v_wstrdup(SCR *sp,
const CHAR_T *str,
size_t len)
v_wstrdup(SCR *sp, const CHAR_T *str, size_t len)
{
CHAR_T *copy;
MALLOC(sp, copy, CHAR_T *, (len + 1) * sizeof(CHAR_T));
MALLOC(sp, copy, (len + 1) * sizeof(CHAR_T));
if (copy == NULL)
return (NULL);
MEMCPY(copy, str, len);
@ -291,11 +258,7 @@ v_wstrdup(SCR *sp,
* PUBLIC: enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int);
*/
enum nresult
nget_uslong(
u_long *valp,
const CHAR_T *p,
CHAR_T **endp,
int base)
nget_uslong(u_long *valp, const CHAR_T *p, CHAR_T **endp, int base)
{
errno = 0;
*valp = STRTOUL(p, endp, base);
@ -313,11 +276,7 @@ nget_uslong(
* PUBLIC: enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int);
*/
enum nresult
nget_slong(
long *valp,
const CHAR_T *p,
CHAR_T **endp,
int base)
nget_slong(long *valp, const CHAR_T *p, CHAR_T **endp, int base)
{
errno = 0;
*valp = STRTOL(p, endp, base);
@ -339,8 +298,7 @@ nget_slong(
* PUBLIC: void timepoint_steady(struct timespec *);
*/
void
timepoint_steady(
struct timespec *ts)
timepoint_steady(struct timespec *ts)
{
#ifdef __APPLE__
static mach_timebase_info_data_t base = { 0 };
@ -370,8 +328,7 @@ timepoint_steady(
* PUBLIC: void timepoint_system(struct timespec *);
*/
void
timepoint_system(
struct timespec *ts)
timepoint_system(struct timespec *ts)
{
#ifdef __APPLE__
clock_serv_t clk;
@ -404,10 +361,7 @@ timepoint_system(
* PUBLIC: void TRACE(SCR *, const char *, ...);
*/
void
TRACE(
SCR *sp,
const char *fmt,
...)
TRACE(SCR *sp, const char *fmt, ...)
{
FILE *tfp;
va_list ap;

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: util.h,v 10.7 2013/02/24 21:00:10 zy Exp $
*/
/* Macros to init/set/clear/test flags. */

View File

@ -1,16 +0,0 @@
# @(#)Makefile 8.7 (Berkeley) 8/18/96
ROFF= groff
all: vi.0 vi.0.ps
vi.0: vi.1
${ROFF} -man -Tascii < vi.1 > $@
chmod 444 $@
vi.0.ps: vi.1
${ROFF} -man < vi.1 > $@
chmod 444 $@
clean:
rm -f vi.0 vi.0.ps

11
ex/ex.c
View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex.c,v 10.80 2012/10/03 16:24:40 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -388,7 +384,7 @@ loop: ecp = SLIST_FIRST(gp->ecq);
} else {
for (p = ecp->cp;
ecp->clen > 0; --ecp->clen, ++ecp->cp)
if (!isascii(*ecp->cp) || !isalpha(*ecp->cp))
if (!isazAZ(*ecp->cp))
break;
if ((namelen = ecp->cp - p) == 0) {
msgq(sp, M_ERR, "080|Unknown command name");
@ -732,8 +728,7 @@ skip_srch: if (ecp->cmd == &cmds[C_VISUAL_EX] && F_ISSET(sp, SC_VI))
if (!cmdskip(ecp->cp[0]))
break;
if (!isascii(ecp->cp[0]) ||
isalnum(ecp->cp[0]) || ecp->cp[0] == '|') {
if (is09azAZ(ecp->cp[0]) || ecp->cp[0] == '|') {
ecp->rcmd = cmds[C_SUBSTITUTE];
ecp->rcmd.fn = ex_subagain;
ecp->cmd = &ecp->rcmd;
@ -1504,7 +1499,7 @@ usage: msgq(sp, M_ERR, "086|Usage: %s", ecp->cmd->usage);
ecp->save_cmd -= arg1_len;
ecp->save_cmdlen += arg1_len;
MEMCPY(ecp->save_cmd, arg1, arg1_len);
MEMMOVE(ecp->save_cmd, arg1, arg1_len);
/*
* Any commands executed from a +cmd are executed starting at

View File

@ -5,8 +5,6 @@
* Keith Bostic. All rights reserved.
*
* See the LICENSE file for redistribution information.
*
* $Id: ex.h,v 10.31 2012/10/03 02:33:24 zy Exp $
*/
#define PROMPTCHAR ':' /* Prompt using a colon. */

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_abbrev.c,v 10.10 2001/12/16 18:18:54 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_append.c,v 10.34 2001/06/25 15:19:14 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_args.c,v 10.19 2011/12/16 16:18:10 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -88,8 +84,7 @@ ex_next(SCR *sp, EXCMD *cmdp)
sp->cargv = NULL;
/* Create a new list. */
CALLOC_RET(sp,
sp->argv, char **, cmdp->argc + 1, sizeof(char *));
CALLOC_RET(sp, sp->argv, cmdp->argc + 1, sizeof(char *));
for (ap = sp->argv,
argv = cmdp->argv; argv[0]->len != 0; ++ap, ++argv) {
INT2CHAR(sp, argv[0]->bp, argv[0]->len, np, nlen);
@ -311,7 +306,7 @@ ex_buildargv(SCR *sp, EXCMD *cmdp, char *name)
size_t nlen;
argc = cmdp == NULL ? 1 : cmdp->argc;
CALLOC(sp, s_argv, char **, argc + 1, sizeof(char *));
CALLOC(sp, s_argv, argc + 1, sizeof(char *));
if ((ap = s_argv) == NULL)
return (NULL);

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_argv.c,v 11.2 2012/10/09 23:00:29 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -484,7 +480,7 @@ argv_alloc(SCR *sp, size_t len)
/* First argument. */
if (exp->args[off] == NULL) {
CALLOC(sp, exp->args[off], ARGS *, 1, sizeof(ARGS));
CALLOC(sp, exp->args[off], 1, sizeof(ARGS));
if (exp->args[off] == NULL)
goto mem;
}
@ -507,7 +503,7 @@ mem: msgq(sp, M_SYSERR, NULL);
/* Second argument. */
if (exp->args[++off] == NULL) {
CALLOC(sp, exp->args[off], ARGS *, 1, sizeof(ARGS));
CALLOC(sp, exp->args[off], 1, sizeof(ARGS));
if (exp->args[off] == NULL)
goto mem;
}

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_at.c,v 10.16 2001/06/25 15:19:14 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -82,9 +78,9 @@ ex_at(SCR *sp, EXCMD *cmdp)
* the range, continue to execute after a file/screen switch, which
* means @ buffers are still useful in a multi-screen environment.
*/
CALLOC_RET(sp, ecp, EXCMD *, 1, sizeof(EXCMD));
CALLOC_RET(sp, ecp, 1, sizeof(EXCMD));
TAILQ_INIT(ecp->rq);
CALLOC_RET(sp, rp, RANGE *, 1, sizeof(RANGE));
CALLOC_RET(sp, rp, 1, sizeof(RANGE));
rp->start = cmdp->addr1.lno;
if (F_ISSET(cmdp, E_ADDR_DEF)) {
rp->stop = rp->start;
@ -106,7 +102,7 @@ ex_at(SCR *sp, EXCMD *cmdp)
TAILQ_FOREACH_REVERSE(tp, cbp->textq, _texth, q)
len += tp->len + 1;
MALLOC_RET(sp, ecp->cp, CHAR_T *, len * 2 * sizeof(CHAR_T));
MALLOC_RET(sp, ecp->cp, len * 2 * sizeof(CHAR_T));
ecp->o_cp = ecp->cp;
ecp->o_clen = len;
ecp->cp[len] = '\0';

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_bang.c,v 10.36 2001/06/25 15:19:14 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -67,8 +63,7 @@ ex_bang(SCR *sp, EXCMD *cmdp)
/* Set the "last bang command" remembered value. */
exp = EXP(sp);
if (exp->lastbcomm != NULL)
free(exp->lastbcomm);
free(exp->lastbcomm);
if ((exp->lastbcomm = v_wstrdup(sp, ap->bp, ap->len)) == NULL) {
msgq(sp, M_SYSERR, NULL);
return (1);
@ -178,6 +173,10 @@ ex_bang(SCR *sp, EXCMD *cmdp)
if (!F_ISSET(sp, SC_VI) && !F_ISSET(sp, SC_EX_SILENT))
(void)ex_puts(sp, "!\n");
/* Apply expandtab to the new text */
if (O_ISSET(sp, O_EXPANDTAB))
ex_retab(sp, cmdp);
/*
* XXX
* The ! commands never return an error, so that autoprint always

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_cd.c,v 10.13 2012/04/12 06:28:27 zy Exp $";
#endif /* not lint */
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_cmd.c,v 10.26 2011/07/14 15:11:16 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_cscope.c,v 10.25 2012/10/04 09:23:03 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -261,7 +257,7 @@ cscope_add(SCR *sp, EXCMD *cmdp, CHAR_T *dname)
/* Allocate a cscope connection structure and initialize its fields. */
len = strlen(np);
CALLOC_RET(sp, csc, CSC *, 1, sizeof(CSC) + len);
CALLOC_RET(sp, csc, 1, sizeof(CSC) + len);
csc->dname = csc->buf;
csc->dlen = len;
memcpy(csc->dname, np, len);
@ -321,7 +317,7 @@ get_paths(SCR *sp, CSC *csc)
if (stat(buf, &sb) == 0) {
/* Read in the CSCOPE_PATHS file. */
len = sb.st_size;
MALLOC_RET(sp, csc->pbuf, char *, len + 1);
MALLOC_RET(sp, csc->pbuf, len + 1);
if ((fd = open(buf, O_RDONLY, 0)) < 0 ||
read(fd, csc->pbuf, len) != len) {
msgq_str(sp, M_SYSERR, buf, "%s");
@ -340,8 +336,7 @@ get_paths(SCR *sp, CSC *csc)
++nentries;
/* Build an array of pointers to the paths. */
CALLOC_GOTO(sp,
csc->paths, char **, nentries + 1, sizeof(char **));
CALLOC_GOTO(sp, csc->paths, nentries + 1, sizeof(char **));
for (pathp = csc->paths, p = strtok(csc->pbuf, ":");
p != NULL; p = strtok(NULL, ":"))
*pathp++ = p;
@ -357,15 +352,13 @@ get_paths(SCR *sp, CSC *csc)
msgq(sp, M_SYSERR, NULL);
return (1);
}
CALLOC_GOTO(sp, csc->paths, char **, 2, sizeof(char *));
CALLOC_GOTO(sp, csc->paths, 2, sizeof(char *));
csc->paths[0] = csc->pbuf;
return (0);
alloc_err:
if (csc->pbuf != NULL) {
free(csc->pbuf);
csc->pbuf = NULL;
}
free(csc->pbuf);
csc->pbuf = NULL;
return (1);
}
@ -483,11 +476,11 @@ cscope_find(SCR *sp, EXCMD *cmdp, CHAR_T *pattern)
rtqp = NULL;
if (TAILQ_EMPTY(exp->tq)) {
/* Initialize the `local context' tag queue structure. */
CALLOC_GOTO(sp, rtqp, TAGQ *, 1, sizeof(TAGQ));
CALLOC_GOTO(sp, rtqp, 1, sizeof(TAGQ));
TAILQ_INIT(rtqp->tagq);
/* Initialize and link in its tag structure. */
CALLOC_GOTO(sp, rtp, TAG *, 1, sizeof(TAG));
CALLOC_GOTO(sp, rtp, 1, sizeof(TAG));
TAILQ_INSERT_HEAD(rtqp->tagq, rtp, q);
rtqp->current = rtp;
}
@ -497,8 +490,8 @@ cscope_find(SCR *sp, EXCMD *cmdp, CHAR_T *pattern)
np = strdup(np);
if ((tqp = create_cs_cmd(sp, np, &search)) == NULL)
goto err;
if (np != NULL)
free(np);
free(np);
np = NULL;
/*
* Stick the current context in a convenient place, we'll lose it
@ -529,10 +522,8 @@ cscope_find(SCR *sp, EXCMD *cmdp, CHAR_T *pattern)
if (matches == 0) {
msgq(sp, M_INFO, "278|No matches for query");
nomatch: if (rtp != NULL)
free(rtp);
if (rtqp != NULL)
free(rtqp);
nomatch: free(rtp);
free(rtqp);
tagq_free(sp, tqp);
return (1);
}
@ -588,12 +579,9 @@ nomatch: if (rtp != NULL)
err:
alloc_err:
if (rtqp != NULL)
free(rtqp);
if (rtp != NULL)
free(rtp);
if (np != NULL)
free(np);
free(rtqp);
free(rtp);
free(np);
return (1);
}
@ -652,7 +640,7 @@ usage: (void)csc_help(sp, "find");
tlen = strlen(p);
/* Allocate and initialize the TAGQ structure. */
CALLOC(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + tlen + 3);
CALLOC(sp, tqp, 1, sizeof(TAGQ) + tlen + 3);
if (tqp == NULL)
return (NULL);
TAILQ_INIT(tqp->tagq);
@ -756,9 +744,8 @@ parse(SCR *sp, CSC *csc, TAGQ *tqp, int *matchesp)
* Allocate and initialize a tag structure plus the variable
* length cscope information that follows it.
*/
CALLOC_RET(sp, tp,
TAG *, 1, sizeof(TAG) + dlen + 2 + nlen + 1 +
(slen + 1) * sizeof(CHAR_T));
CALLOC_RET(sp, tp, 1,
sizeof(TAG) + dlen + 2 + nlen + 1 + (slen + 1) * sizeof(CHAR_T));
tp->fname = (char *)tp->buf;
if (dlen == 1 && *dname == '.')
--dlen;
@ -770,9 +757,11 @@ parse(SCR *sp, CSC *csc, TAGQ *tqp, int *matchesp)
memcpy(tp->fname + dlen, name, nlen + 1);
tp->fnlen = dlen + nlen;
tp->slno = slno;
tp->search = (CHAR_T*)(tp->fname + tp->fnlen + 1);
CHAR2INT(sp, search, slen + 1, wp, wlen);
MEMCPY(tp->search, wp, (tp->slen = slen) + 1);
if (slen != 0) {
tp->search = (CHAR_T*)(tp->fname + tp->fnlen + 1);
CHAR2INT(sp, search, slen + 1, wp, wlen);
MEMCPY(tp->search, wp, (tp->slen = slen) + 1);
}
TAILQ_INSERT_TAIL(tqp->tagq, tp, q);
/* Try to preset the tag within the current file. */
@ -943,10 +932,8 @@ badno: msgq(sp, M_ERR, "312|%d: no such cscope session", n);
(void)waitpid(csc->pid, &pstat, 0);
/* Discard cscope connection information. */
if (csc->pbuf != NULL)
free(csc->pbuf);
if (csc->paths != NULL)
free(csc->paths);
free(csc->pbuf);
free(csc->paths);
free(csc);
return (0);
}

View File

@ -1,76 +0,0 @@
#define C_SCROLL 0
#define C_BANG 1
#define C_HASH 2
#define C_SUBAGAIN 3
#define C_STAR 4
#define C_SHIFTL 5
#define C_EQUAL 6
#define C_SHIFTR 7
#define C_AT 8
#define C_APPEND 9
#define C_ABBR 10
#define C_ARGS 11
#define C_BG 12
#define C_CHANGE 13
#define C_CD 14
#define C_CHDIR 15
#define C_COPY 16
#define C_CSCOPE 17
#define C_DELETE 18
#define C_DISPLAY 19
#define C_EDIT 20
#define C_EX 21
#define C_EXUSAGE 22
#define C_FILE 23
#define C_FG 24
#define C_GLOBAL 25
#define C_HELP 26
#define C_INSERT 27
#define C_JOIN 28
#define C_K 29
#define C_LIST 30
#define C_MOVE 31
#define C_MARK 32
#define C_MAP 33
#define C_MKEXRC 34
#define C_NEXT 35
#define C_NUMBER 36
#define C_OPEN 37
#define C_PRINT 38
#define C_PRESERVE 39
#define C_PREVIOUS 40
#define C_PUT 41
#define C_QUIT 42
#define C_READ 43
#define C_RECOVER 44
#define C_RESIZE 45
#define C_REWIND 46
#define C_SUBSTITUTE 47
#define C_SCRIPT 48
#define C_SET 49
#define C_SHELL 50
#define C_SOURCE 51
#define C_STOP 52
#define C_SUSPEND 53
#define C_T 54
#define C_TAG 55
#define C_TAGNEXT 56
#define C_TAGPOP 57
#define C_TAGPREV 58
#define C_TAGTOP 59
#define C_UNDO 60
#define C_UNABBREVIATE 61
#define C_UNMAP 62
#define C_V 63
#define C_VERSION 64
#define C_VISUAL_EX 65
#define C_VISUAL_VI 66
#define C_VIUSAGE 67
#define C_VSPLIT 68
#define C_WRITE 69
#define C_WN 70
#define C_WQ 71
#define C_XIT 72
#define C_YANK 73
#define C_Z 74
#define C_SUBTILDE 75

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_delete.c,v 10.11 2001/06/25 15:19:15 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_display.c,v 10.15 2001/06/25 15:19:15 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_edit.c,v 10.15 2011/12/22 23:26:50 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_equal.c,v 10.12 2001/06/25 15:19:15 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_file.c,v 10.14 2001/06/25 15:19:16 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,12 +9,9 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_filter.c,v 10.44 2003/11/05 17:11:54 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
#include <bitstring.h>
#include <errno.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_global.c,v 10.32 2011/12/26 23:37:01 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -91,7 +87,7 @@ ex_g_setup(SCR *sp, EXCMD *cmdp, enum which cmd)
if (cmdp->argc == 0)
goto usage;
for (p = cmdp->argv[0]->bp; cmdskip(*p); ++p);
if (!isascii(*p) || *p == '\0' || isalnum(*p) ||
if (*p == '\0' || is09azAZ(*p) ||
*p == '\\' || *p == '|' || *p == '\n') {
usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
return (1);
@ -157,7 +153,7 @@ usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
return (1);
/* Get an EXCMD structure. */
CALLOC_RET(sp, ecp, EXCMD *, 1, sizeof(EXCMD));
CALLOC_RET(sp, ecp, 1, sizeof(EXCMD));
TAILQ_INIT(ecp->rq);
/*
@ -172,7 +168,7 @@ usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
len = 1;
}
MALLOC_RET(sp, ecp->cp, CHAR_T *, (len * 2) * sizeof(CHAR_T));
MALLOC_RET(sp, ecp->cp, (len * 2) * sizeof(CHAR_T));
ecp->o_cp = ecp->cp;
ecp->o_clen = len;
MEMCPY(ecp->cp + len, p, len);
@ -234,7 +230,7 @@ usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
}
/* Allocate a new range, and append it to the list. */
CALLOC(sp, rp, RANGE *, 1, sizeof(RANGE));
CALLOC(sp, rp, 1, sizeof(RANGE));
if (rp == NULL)
return (1);
rp->start = rp->stop = start;
@ -298,7 +294,7 @@ ex_g_insdel(SCR *sp, lnop_t op, recno_t lno)
free(rp);
}
} else {
CALLOC_RET(sp, nrp, RANGE *, 1, sizeof(RANGE));
CALLOC_RET(sp, nrp, 1, sizeof(RANGE));
nrp->start = lno + 1;
nrp->stop = rp->stop + 1;
rp->stop = lno - 1;

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_init.c,v 10.33 2012/04/11 19:12:34 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -46,7 +42,7 @@ ex_screen_copy(SCR *orig, SCR *sp)
EX_PRIVATE *oexp, *nexp;
/* Create the private ex structure. */
CALLOC_RET(orig, nexp, EX_PRIVATE *, 1, sizeof(EX_PRIVATE));
CALLOC_RET(orig, nexp, 1, sizeof(EX_PRIVATE));
sp->ex_private = nexp;
/* Initialize queues. */
@ -94,14 +90,11 @@ ex_screen_end(SCR *sp)
if (argv_free(sp))
rval = 1;
if (exp->ibp != NULL)
free(exp->ibp);
free(exp->ibp);
if (exp->lastbcomm != NULL)
free(exp->lastbcomm);
free(exp->lastbcomm);
if (exp->ibcw.bp1.c != NULL)
free(exp->ibcw.bp1.c);
free(exp->ibcw.bp1.c);
if (ex_tag_free(sp))
rval = 1;
@ -291,7 +284,7 @@ ex_run_str(SCR *sp, char *name, CHAR_T *str, size_t len, int ex_flags, int nocop
gp = sp->gp;
if (EXCMD_RUNNING(gp)) {
CALLOC_RET(sp, ecp, EXCMD *, 1, sizeof(EXCMD));
CALLOC_RET(sp, ecp, 1, sizeof(EXCMD));
SLIST_INSERT_HEAD(gp->ecq, ecp, q);
} else
ecp = &gp->excmd;

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_join.c,v 10.17 2004/03/16 14:14:04 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_map.c,v 10.11 2001/06/25 15:19:17 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_mark.c,v 10.9 2001/06/25 15:19:17 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_mkexrc.c,v 10.13 2001/06/25 15:19:17 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_move.c,v 10.16 2012/02/11 15:52:33 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_open.c,v 10.8 2001/06/25 15:19:17 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_preserve.c,v 10.15 2001/06/25 15:19:18 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_print.c,v 10.26 2013/11/02 02:11:07 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -213,7 +209,7 @@ ex_prchars(SCR *sp, const CHAR_T *p, size_t *colp, size_t len,
gp = sp->gp;
ts = O_VAL(sp, O_TABSTOP);
for (col = *colp; len--;)
if ((ch = *p++) == L('\t') && !LF_ISSET(E_C_LIST))
if ((ch = *p++) == '\t' && !LF_ISSET(E_C_LIST))
for (tlen = ts - col % ts;
col < sp->cols && tlen--; ++col) {
(void)ex_printf(sp,

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_put.c,v 10.8 2001/06/25 15:19:18 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_quit.c,v 10.8 2001/06/25 15:19:18 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_read.c,v 10.44 2001/06/25 15:19:19 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -112,8 +108,7 @@ ex_read(SCR *sp, EXCMD *cmdp)
/* Set the last bang command. */
exp = EXP(sp);
if (exp->lastbcomm != NULL)
free(exp->lastbcomm);
free(exp->lastbcomm);
if ((exp->lastbcomm =
v_wstrdup(sp, cmdp->argv[argc]->bp,
cmdp->argv[argc]->len)) == NULL) {

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_screen.c,v 10.12 2001/06/25 15:19:19 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -12,10 +12,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_script.c,v 10.44 2012/10/05 10:17:47 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/queue.h>
@ -93,7 +89,7 @@ sscr_init(SCR *sp)
if (opts_empty(sp, O_SHELL, 0))
return (1);
MALLOC_RET(sp, sc, SCRIPT *, sizeof(SCRIPT));
MALLOC_RET(sp, sc, sizeof(SCRIPT));
sp->script = sc;
sc->sh_prompt = NULL;
sc->sh_prompt_len = 0;
@ -523,9 +519,8 @@ sscr_setprompt(SCR *sp, char *buf, size_t len)
SCRIPT *sc;
sc = sp->script;
if (sc->sh_prompt)
free(sc->sh_prompt);
MALLOC(sp, sc->sh_prompt, char *, len + 1);
free(sc->sh_prompt);
MALLOC(sp, sc->sh_prompt, len + 1);
if (sc->sh_prompt == NULL) {
sscr_end(sp);
return (1);

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_set.c,v 10.8 2001/06/25 15:19:19 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_shell.c,v 10.44 2012/07/06 06:51:26 zy Exp $";
#endif /* not lint */
#include <sys/queue.h>
#include <sys/time.h>
#include <sys/wait.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_shift.c,v 10.17 2001/06/25 15:19:20 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -25,7 +21,7 @@ static const char sccsid[] = "$Id: ex_shift.c,v 10.17 2001/06/25 15:19:20 skimo
#include "../common/common.h"
enum which {LEFT, RIGHT};
enum which {RETAB, LEFT, RIGHT};
static int shift(SCR *, EXCMD *, enum which);
/*
@ -51,6 +47,18 @@ ex_shiftr(SCR *sp, EXCMD *cmdp)
return (shift(sp, cmdp, RIGHT));
}
/*
* ex_retab -- Expand tabs (if enabled)
*
*
* PUBLIC: int ex_retab(SCR *, EXCMD *);
*/
int
ex_retab(SCR *sp, EXCMD *cmdp)
{
return (shift(sp, cmdp, RETAB));
}
/*
* shift --
* Ex shift support.
@ -114,7 +122,9 @@ shift(SCR *sp, EXCMD *cmdp, enum which rl)
break;
/* Calculate the new indent amount. */
if (rl == RIGHT)
if (rl == RETAB)
newcol = oldcol;
else if (rl == RIGHT)
newcol = oldcol + sw;
else {
newcol = oldcol < sw ? 0 : oldcol - sw;
@ -132,10 +142,13 @@ shift(SCR *sp, EXCMD *cmdp, enum which rl)
* Build a new indent string and count the number of
* characters it uses.
*/
for (tbp = bp, newidx = 0;
newcol >= O_VAL(sp, O_TABSTOP); ++newidx) {
*tbp++ = '\t';
newcol -= O_VAL(sp, O_TABSTOP);
tbp = bp;
newidx = 0;
if (!O_ISSET(sp, O_EXPANDTAB)) {
for (; newcol >= O_VAL(sp, O_TABSTOP); ++newidx) {
*tbp++ = '\t';
newcol -= O_VAL(sp, O_TABSTOP);
}
}
for (; newcol > 0; --newcol, ++newidx)
*tbp++ = ' ';

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_source.c,v 10.17 2011/12/19 16:17:06 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
@ -65,7 +61,7 @@ ex_source(SCR *sp, EXCMD *cmdp)
goto err;
}
MALLOC(sp, bp, char *, (size_t)sb.st_size + 1);
MALLOC(sp, bp, (size_t)sb.st_size + 1);
if (bp == NULL) {
(void)close(fd);
return (1);
@ -88,8 +84,7 @@ err: msgq_str(sp, M_SYSERR, name, "%s");
msgq(sp, M_ERR, "323|Invalid input. Truncated.");
/* Put it on the ex queue. */
rc = ex_run_str(sp, np, wp, wlen - 1, 1, 0);
if (np != NULL)
free(np);
free(np);
free(bp);
return (rc);
}

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_stop.c,v 10.11 2001/06/25 15:19:20 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_subst.c,v 10.53 2011/12/21 20:40:35 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -78,7 +74,7 @@ ex_s(SCR *sp, EXCMD *cmdp)
subagain: return (ex_subagain(sp, cmdp));
delim = *p++;
if (!isascii(delim) || isalnum(delim) || delim == '\\')
if (is09azAZ(delim) || delim == '\\')
return (s(sp, cmdp, p, &sp->subre_c, SUB_MUSTSETR));
/*
@ -190,8 +186,7 @@ subagain: return (ex_subagain(sp, cmdp));
if (p[0] == '\0' || p[0] == delim) {
if (p[0] == delim)
++p;
if (sp->repl != NULL)
free(sp->repl);
free(sp->repl);
sp->repl = NULL;
sp->repl_len = 0;
} else if (p[0] == '%' && (p[1] == '\0' || p[1] == delim))
@ -230,9 +225,8 @@ tilde: ++p;
++len;
}
if ((sp->repl_len = len) != 0) {
if (sp->repl != NULL)
free(sp->repl);
MALLOC(sp, sp->repl, CHAR_T *, len * sizeof(CHAR_T));
free(sp->repl);
MALLOC(sp, sp->repl, len * sizeof(CHAR_T));
if (sp->repl == NULL) {
FREE_SPACEW(sp, bp, blen);
return (1);
@ -870,8 +864,7 @@ err: rval = 1;
if (bp != NULL)
FREE_SPACEW(sp, bp, blen);
if (lb != NULL)
free(lb);
free(lb);
return (rval);
}
@ -940,10 +933,9 @@ re_compile(SCR *sp, CHAR_T *ptrn, size_t plen, CHAR_T **ptrnp, size_t *lenp, reg
return (1);
/* Discard previous pattern. */
if (*ptrnp != NULL) {
free(*ptrnp);
*ptrnp = NULL;
}
free(*ptrnp);
*ptrnp = NULL;
if (lenp != NULL)
*lenp = plen;
@ -954,7 +946,7 @@ re_compile(SCR *sp, CHAR_T *ptrn, size_t plen, CHAR_T **ptrnp, size_t *lenp, reg
* Regcomp isn't 8-bit clean, so the pattern is nul-terminated
* for now. There's just no other solution.
*/
MALLOC(sp, *ptrnp, CHAR_T *, (plen + 1) * sizeof(CHAR_T));
MALLOC(sp, *ptrnp, (plen + 1) * sizeof(CHAR_T));
if (*ptrnp != NULL) {
MEMCPY(*ptrnp, ptrn, plen);
(*ptrnp)[plen] = '\0';
@ -1289,7 +1281,7 @@ re_error(SCR *sp, int errcode, regex_t *preg)
char *oe;
s = regerror(errcode, preg, "", 0);
MALLOC(sp, oe, char *, s);
MALLOC(sp, oe, s);
if (oe != NULL) {
(void)regerror(errcode, preg, oe, s);
msgq(sp, M_ERR, "RE error: %s", oe);

View File

@ -12,10 +12,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_tag.c,v 10.54 2012/04/12 07:17:30 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/queue.h>
@ -98,8 +94,7 @@ ex_tag_push(SCR *sp, EXCMD *cmdp)
exp = EXP(sp);
switch (cmdp->argc) {
case 1:
if (exp->tag_last != NULL)
free(exp->tag_last);
free(exp->tag_last);
if ((exp->tag_last = v_wstrdup(sp, cmdp->argv[0]->bp,
cmdp->argv[0]->len)) == NULL) {
@ -590,12 +585,14 @@ tagf_copy(SCR *sp, TAGF *otfp, TAGF **tfpp)
{
TAGF *tfp;
MALLOC_RET(sp, tfp, TAGF *, sizeof(TAGF));
MALLOC_RET(sp, tfp, sizeof(TAGF));
*tfp = *otfp;
/* XXX: Allocate as part of the TAGF structure!!! */
if ((tfp->name = strdup(otfp->name)) == NULL)
if ((tfp->name = strdup(otfp->name)) == NULL) {
free(tfp);
return (1);
}
*tfpp = tfp;
return (0);
@ -614,7 +611,7 @@ tagq_copy(SCR *sp, TAGQ *otqp, TAGQ **tqpp)
len = sizeof(TAGQ);
if (otqp->tag != NULL)
len += otqp->tlen + 1;
MALLOC_RET(sp, tqp, TAGQ *, len);
MALLOC_RET(sp, tqp, len);
memcpy(tqp, otqp, len);
TAILQ_INIT(tqp->tagq);
@ -643,7 +640,7 @@ tag_copy(SCR *sp, TAG *otp, TAG **tpp)
len += otp->slen + 1;
if (otp->msg != NULL)
len += otp->mlen + 1;
MALLOC_RET(sp, tp, TAG *, len);
MALLOC_RET(sp, tp, len);
memcpy(tp, otp, len);
if (otp->fname != NULL)
@ -727,11 +724,11 @@ tagq_push(SCR *sp, TAGQ *tqp, int new_screen, int force)
rtqp = NULL;
if (TAILQ_EMPTY(exp->tq)) {
/* Initialize the `local context' tag queue structure. */
CALLOC_GOTO(sp, rtqp, TAGQ *, 1, sizeof(TAGQ));
CALLOC_GOTO(sp, rtqp, 1, sizeof(TAGQ));
TAILQ_INIT(rtqp->tagq);
/* Initialize and link in its tag structure. */
CALLOC_GOTO(sp, rtp, TAG *, 1, sizeof(TAG));
CALLOC_GOTO(sp, rtp, 1, sizeof(TAG));
TAILQ_INSERT_HEAD(rtqp->tagq, rtp, q);
rtqp->current = rtp;
}
@ -802,10 +799,8 @@ tagq_push(SCR *sp, TAGQ *tqp, int new_screen, int force)
err:
alloc_err:
if (rtqp != NULL)
free(rtqp);
if (rtp != NULL)
free(rtp);
free(rtqp);
free(rtp);
tagq_free(sp, tqp);
return (1);
}
@ -858,8 +853,8 @@ ex_tagf_alloc(SCR *sp, char *str)
for (p = t = str;; ++p) {
if (*p == '\0' || cmdskip(*p)) {
if ((len = p - t)) {
MALLOC_RET(sp, tfp, TAGF *, sizeof(TAGF));
MALLOC(sp, tfp->name, char *, len + 1);
MALLOC_RET(sp, tfp, sizeof(TAGF));
MALLOC(sp, tfp->name, len + 1);
if (tfp->name == NULL) {
free(tfp);
return (1);
@ -896,8 +891,7 @@ ex_tag_free(SCR *sp)
tagq_free(sp, tqp);
while ((tfp = TAILQ_FIRST(exp->tagfq)) != NULL)
tagf_free(sp, tfp);
if (exp->tag_last != NULL)
free(exp->tag_last);
free(exp->tag_last);
return (0);
}
@ -985,7 +979,7 @@ ctag_slist(SCR *sp, CHAR_T *tag)
/* Allocate and initialize the tag queue structure. */
INT2CHAR(sp, tag, STRLEN(tag) + 1, np, nlen);
len = nlen - 1;
CALLOC_GOTO(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + len + 1);
CALLOC_GOTO(sp, tqp, 1, sizeof(TAGQ) + len + 1);
TAILQ_INIT(tqp->tagq);
tqp->tag = tqp->buf;
memcpy(tqp->tag, np, (tqp->tlen = len) + 1);
@ -1125,9 +1119,8 @@ corrupt: p = msg_print(sp, tname, &nf1);
/* Resolve the file name. */
ctag_file(sp, tfp, name, &dname, &dlen);
CALLOC_GOTO(sp, tp,
TAG *, 1, sizeof(TAG) + dlen + 2 + nlen + 1 +
(slen + 1) * sizeof(CHAR_T));
CALLOC_GOTO(sp, tp, 1,
sizeof(TAG) + dlen + 2 + nlen + 1 + (slen + 1) * sizeof(CHAR_T));
tp->fname = (char *)tp->buf;
if (dlen == 1 && *dname == '.')
--dlen;

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_txt.c,v 10.23 2001/06/25 15:19:21 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -406,8 +402,12 @@ txt_dent(SCR *sp, TEXT *tp)
*
* Count up spaces/tabs needed to get to the target.
*/
for (cno = 0, tabs = 0; cno + COL_OFF(cno, ts) <= scno; ++tabs)
cno += COL_OFF(cno, ts);
cno = 0;
tabs = 0;
if (!O_ISSET(sp, O_EXPANDTAB)) {
for (; cno + COL_OFF(cno, ts) <= scno; ++tabs)
cno += COL_OFF(cno, ts);
}
spaces = scno - cno;
/* Make sure there's enough room. */

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_undo.c,v 10.7 2001/06/25 15:19:21 skimo Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

View File

@ -9,10 +9,6 @@
#include "config.h"
#ifndef lint
static const char sccsid[] = "$Id: ex_usage.c,v 10.16 2011/12/21 19:26:48 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
@ -170,7 +166,8 @@ nokey: (void)ex_printf(sp,
else
(void)ex_printf(sp,
" Key:%s%s\nUsage: %s\n",
isblank(*kp->help) ? "" : " ", kp->help, kp->usage);
isblank((u_char)*kp->help) ? "" : " ",
kp->help, kp->usage);
break;
case 0:
for (key = 0; key <= MAXVIKEY && !INTERRUPTED(sp); ++key) {

Some files were not shown because too many files have changed in this diff Show More