1 /* Copyright (c) 2008, 2009
2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4 * Micah Cowan (micah@cowan.name)
5 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
6 * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
7 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
8 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
9 * Copyright (c) 1987 Oliver Laumann
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3, or (at your option)
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program (see the file COPYING); if not, see
23 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 ****************************************************************
30 #if !defined(__GNUC__) || __GNUC__ < 2
32 #define __attribute__(x)
36 extern int main
__P((int, char **));
37 extern sigret_t SigHup
__P(SIGPROTOARG
);
38 extern void eexit
__P((int));
39 extern void Detach
__P((int));
40 extern void Hangup
__P((void));
41 extern void Kill
__P((int, int));
43 extern void Msg
__P((int, char *, ...)) __attribute__((format(printf
, 2, 3)));
44 extern void Panic
__P((int, char *, ...)) __attribute__((format(printf
, 2, 3)));
46 extern void Msg
__P(());
47 extern void Panic
__P(());
49 extern void Finit
__P((int));
50 extern void MakeNewEnv
__P((void));
51 extern char *MakeWinMsg
__P((char *, struct win
*, int));
52 extern char *MakeWinMsgEv
__P((char *, struct win
*, int, int, struct event
*, int));
53 extern int AddWinMsgRend
__P((const char *, int));
54 extern void PutWinMsg
__P((char *, int, int));
56 extern void WindowDied
__P((struct win
*, union wait
, int));
58 extern void WindowDied
__P((struct win
*, int, int));
60 extern void setbacktick
__P((int, int, int, char **));
63 extern void ResetAnsiState
__P((struct win
*));
64 extern void ResetWindow
__P((struct win
*));
65 extern void ResetCharsets
__P((struct win
*));
66 extern void WriteString
__P((struct win
*, char *, int));
67 extern void ChangeAKA
__P((struct win
*, char *, int));
68 extern void SetCharsets
__P((struct win
*, char *));
69 extern int GetAnsiStatus
__P((struct win
*, char *));
70 extern void WNewAutoFlow
__P((struct win
*, int));
71 extern void WBell
__P((struct win
*, int));
72 extern void WMsg
__P((struct win
*, int, char *));
73 extern void WChangeSize
__P((struct win
*, int, int));
74 extern void WindowChanged
__P((struct win
*, int));
75 extern int MFindUsedLine
__P((struct win
*, int, int));
78 extern int StartRc
__P((char *, int));
79 extern void FinishRc
__P((char *));
80 extern void RcLine
__P((char *, int));
81 extern FILE *secfopen
__P((char *, char *));
82 extern int secopen
__P((char *, int, int));
83 extern void WriteFile
__P((struct acluser
*, char *, int));
84 extern char *ReadFile
__P((char *, int *));
85 extern void KillBuffers
__P((void));
86 extern int printpipe
__P((struct win
*, char *));
87 extern int readpipe
__P((char **));
88 extern void RunBlanker
__P((char **));
89 extern void do_source
__P((char *));
92 extern int OpenTTY
__P((char *, char *));
93 extern void InitTTY
__P((struct mode
*, int));
94 extern void GetTTY
__P((int, struct mode
*));
95 extern void SetTTY
__P((int, struct mode
*));
96 extern void SetMode
__P((struct mode
*, struct mode
*, int, int));
97 extern void SetFlow
__P((int));
98 extern void SendBreak
__P((struct win
*, int, int));
99 extern int TtyGrabConsole
__P((int, int, char *));
100 extern char *TtyGetModemStatus
__P((int, char *));
102 extern void DebugTTY
__P((struct mode
*));
104 extern int fgtty
__P((int));
105 extern void brktty
__P((int));
106 extern struct baud_values
*lookup_baud
__P((int bps
));
107 extern int SetBaud
__P((struct mode
*, int, int));
108 extern int SttyMode
__P((struct mode
*, char *));
112 extern int GetHistory
__P((void));
113 extern void MarkRoutine
__P((void));
114 extern void revto_line
__P((int, int, int));
115 extern void revto
__P((int, int));
116 extern int InMark
__P((void));
117 extern void MakePaster
__P((struct paster
*, char *, int, int));
118 extern void FreePaster
__P((struct paster
*));
121 extern void Search
__P((int));
122 extern void ISearch
__P((int));
125 extern void inp_setprompt
__P((char *, char *));
126 extern void Input
__P((char *, int, int, void (*)(char *, int, char *), char *, int));
127 extern int InInput
__P((void));
130 extern void exit_with_usage
__P((char *, char *, char *));
131 extern void display_help
__P((char *, struct action
*));
132 extern void display_copyright
__P((void));
133 extern void display_displays
__P((void));
134 extern void display_bindkey
__P((char *, struct action
*));
135 extern void display_wlist
__P((int, int, struct win
*));
136 extern int InWList
__P((void));
137 extern void WListUpdatecv
__P((struct canvas
*, struct win
*));
138 extern void WListLinkChanged
__P((void));
140 extern void ZmodemPage
__P((void));
144 extern int MakeWindow
__P((struct NewWindow
*));
145 extern int RemakeWindow
__P((struct win
*));
146 extern void FreeWindow
__P((struct win
*));
148 extern int winexec
__P((char **));
149 extern void FreePseudowin
__P((struct win
*));
151 extern void nwin_compose
__P((struct NewWindow
*, struct NewWindow
*, struct NewWindow
*));
152 extern int DoStartLog
__P((struct win
*, char *, int));
153 extern int ReleaseAutoWritelock
__P((struct display
*, struct win
*));
154 extern int ObtainAutoWritelock
__P((struct display
*, struct win
*));
155 extern void CloseDevice
__P((struct win
*));
157 extern void zmodem_abort
__P((struct win
*, struct display
*));
159 extern void execvpe
__P((char *, char **, char **));
163 extern void InitUtmp
__P((void));
164 extern void RemoveLoginSlot
__P((void));
165 extern void RestoreLoginSlot
__P((void));
166 extern int SetUtmp
__P((struct win
*));
167 extern int RemoveUtmp
__P((struct win
*));
169 extern void SlotToggle
__P((int));
171 extern int CountUsers
__P((void));
174 extern void CarefulUtmp
__P((void));
176 # define CarefulUtmp() /* nothing */
177 #endif /* CAREFULUTMP */
182 extern void InitLoadav
__P((void));
183 extern void AddLoadav
__P((char *));
187 extern int OpenPTY
__P((char **));
188 extern void InitPTY
__P((int));
191 extern void InitKeytab
__P((void));
192 extern void ProcessInput
__P((char *, int));
194 extern void ProcessInput2
__P((char *, int));
196 extern void DoProcess
__P((struct win
*, char **, int *, struct paster
*));
197 extern void DoAction
__P((struct action
*, int));
198 extern int FindCommnr
__P((char *));
199 extern void DoCommand
__P((char **, int *));
200 extern void Activate
__P((int));
201 extern void KillWindow
__P((struct win
*));
202 extern void SetForeWindow
__P((struct win
*));
203 extern int Parse
__P((char *, int, char **, int *));
204 extern void SetEscape
__P((struct acluser
*, int, int));
205 extern void DoScreen
__P((char *, char **));
206 extern int IsNumColon
__P((char *, int, char *, int));
207 extern void ShowWindows
__P((int));
208 extern char *AddWindows
__P((char *, int, int, int));
209 extern char *AddWindowFlags
__P((char *, int, struct win
*));
210 extern char *AddOtherUsers
__P((char *, int, struct win
*));
211 extern int WindowByNoN
__P((char *));
212 extern struct win
*FindNiceWindow
__P((struct win
*, char *));
214 extern int CompileKeys
__P((char *, int, unsigned char *));
217 extern void RefreshXtermOSC
__P((void));
219 extern int ParseSaveStr
__P((struct action
*act
, char **));
220 extern int ParseNum
__P((struct action
*act
, int *));
221 extern int ParseSwitch
__P((struct action
*, int *));
222 extern int ParseAttrColor
__P((char *, char *, int));
223 extern void ApplyAttrColor
__P((int, struct mchar
*));
224 extern void SwitchWindow
__P((int));
225 extern int StuffKey
__P((int));
228 extern int InitTermcap
__P((int, int));
229 extern char *MakeTermcap
__P((int));
230 extern char *gettermcapstring
__P((char *));
232 extern int remap
__P((int, int));
233 extern void CheckEscape
__P((void));
235 extern int CreateTransTable
__P((char *));
236 extern void FreeTransTable
__P((void));
239 extern int Attach
__P((int));
240 extern void Attacher
__P((void));
241 extern sigret_t AttacherFinit
__P(SIGPROTOARG
);
242 extern void SendCmdMessage
__P((char *, char *, char **));
245 extern struct display
*MakeDisplay
__P((char *, char *, char *, int, int, struct mode
*));
246 extern void FreeDisplay
__P((void));
247 extern void DefProcess
__P((char **, int *));
248 extern void DefRedisplayLine
__P((int, int, int, int));
249 extern void DefClearLine
__P((int, int, int, int));
250 extern int DefRewrite
__P((int, int, int, struct mchar
*, int));
251 extern int DefResize
__P((int, int));
252 extern void DefRestore
__P((void));
253 extern void AddCStr
__P((char *));
254 extern void AddCStr2
__P((char *, int));
255 extern void InitTerm
__P((int));
256 extern void FinitTerm
__P((void));
257 extern void PUTCHAR
__P((int));
258 extern void PUTCHARLP
__P((int));
259 extern void ClearAll
__P((void));
260 extern void ClearArea
__P((int, int, int, int, int, int, int, int));
261 extern void ClearLine
__P((struct mline
*, int, int, int, int));
262 extern void RefreshAll
__P((int));
263 extern void RefreshArea
__P((int, int, int, int, int));
264 extern void RefreshLine
__P((int, int, int, int));
265 extern void Redisplay
__P((int));
266 extern void RedisplayDisplays
__P((int));
267 extern void ShowHStatus
__P((char *));
268 extern void RefreshHStatus
__P((void));
269 extern void DisplayLine
__P((struct mline
*, struct mline
*, int, int, int));
270 extern void GotoPos
__P((int, int));
271 extern int CalcCost
__P((char *));
272 extern void ScrollH
__P((int, int, int, int, int, struct mline
*));
273 extern void ScrollV
__P((int, int, int, int, int, int));
274 extern void PutChar
__P((struct mchar
*, int, int));
275 extern void InsChar
__P((struct mchar
*, int, int, int, struct mline
*));
276 extern void WrapChar
__P((struct mchar
*, int, int, int, int, int, int, int));
277 extern void ChangeScrollRegion
__P((int, int));
278 extern void InsertMode
__P((int));
279 extern void KeypadMode
__P((int));
280 extern void CursorkeysMode
__P((int));
281 extern void ReverseVideo
__P((int));
282 extern void CursorVisibility
__P((int));
283 extern void MouseMode
__P((int));
284 extern void SetFont
__P((int));
285 extern void SetAttr
__P((int));
286 extern void SetColor
__P((int, int));
287 extern void SetRendition
__P((struct mchar
*));
288 extern void SetRenditionMline
__P((struct mline
*, int));
289 extern void MakeStatus
__P((char *));
290 extern void RemoveStatus
__P((void));
291 extern int ResizeDisplay
__P((int, int));
292 extern void AddStr
__P((char *));
293 extern void AddStrn
__P((char *, int));
294 extern void Flush
__P((void));
295 extern void freetty
__P((void));
296 extern void Resize_obuf
__P((void));
298 extern void NukePending
__P((void));
300 extern void SetCanvasWindow
__P((struct canvas
*, struct win
*));
301 extern int MakeDefaultCanvas
__P((void));
302 extern int AddCanvas
__P((int));
303 extern void RemCanvas
__P((void));
304 extern void OneCanvas
__P((void));
305 extern void ResizeCanvas
__P((struct canvas
*));
306 extern void RecreateCanvasChain
__P((void));
307 extern int RethinkDisplayViewports
__P((void));
308 extern void RethinkViewportOffsets
__P((struct canvas
*));
309 extern int CountCanvasPerp
__P((struct canvas
*));
310 extern void EqualizeCanvas
__P((struct canvas
*, int));
312 extern void ClearAllXtermOSC
__P((void));
313 extern void SetXtermOSC
__P((int, char *));
316 extern int color256to16
__P((int));
318 extern int color256to88
__P((int));
321 extern void ResetIdle
__P((void));
322 extern void KillBlanker
__P((void));
323 extern void DisplaySleep1000
__P((int, int));
324 extern void AutosaveLayout
__P((struct layout
*));
325 extern void LoadLayout
__P((struct layout
*, struct canvas
*));
326 extern void NewLayout
__P((char *, int));
327 extern void SaveLayout
__P((char *, struct canvas
*));
328 extern void ShowLayouts
__P((int));
329 extern struct layout
*FindLayout
__P((char *));
332 extern int ChangeWindowSize
__P((struct win
*, int, int, int));
333 extern void ChangeScreenSize
__P((int, int, int));
334 extern void CheckScreenSize
__P((int));
335 extern char *xrealloc
__P((char *, int));
336 extern void ResizeLayersToCanvases
__P((void));
337 extern void ResizeLayer
__P((struct layer
*, int, int, struct display
*));
338 extern int MayResizeLayer
__P((struct layer
*));
339 extern void FreeAltScreen
__P((struct win
*));
340 extern void EnterAltScreen
__P((struct win
*));
341 extern void LeaveAltScreen
__P((struct win
*));
344 extern void evenq
__P((struct event
*));
345 extern void evdeq
__P((struct event
*));
346 extern void SetTimeout
__P((struct event
*, int));
347 extern void sched
__P((void));
350 extern int FindSocket
__P((int *, int *, int *, char *));
351 extern int MakeClientSocket
__P((int));
352 extern int MakeServerSocket
__P((void));
353 extern int RecoverSocket
__P((void));
354 extern int chsock
__P((void));
355 extern void ReceiveMsg
__P((void));
356 extern void SendCreateMsg
__P((char *, struct NewWindow
*));
357 extern int SendErrorMsg
__P((char *, char *));
358 extern int SendAttachMsg
__P((int, struct msg
*, int));
361 extern char *SaveStr
__P((const char *));
362 extern char *SaveStrn
__P((const char *, int));
363 extern char *InStr
__P((char *, const char *));
364 #ifndef HAVE_STRERROR
365 extern char *strerror
__P((int));
367 extern void centerline
__P((char *, int));
368 extern void leftline
__P((char *, int));
369 extern char *Filename
__P((char *));
370 extern char *stripdev
__P((char *));
371 #ifdef NEED_OWN_BCOPY
372 extern void xbcopy
__P((char *, char *, int));
374 extern void bclear
__P((char *, int));
375 extern void closeallfiles
__P((int));
376 extern int UserContext
__P((void));
377 extern void UserReturn
__P((int));
378 extern int UserStatus
__P((void));
379 #if defined(POSIX) || defined(hpux)
380 extern void (*xsignal
__P((int, void (*)SIGPROTOARG
))) __P(SIGPROTOARG
);
383 extern int rename
__P((char *, char *));
385 #if defined(HAVE_SETEUID) || defined(HAVE_SETREUID)
386 extern void xseteuid
__P((int));
387 extern void xsetegid
__P((int));
389 extern int AddXChar
__P((char *, int));
390 extern int AddXChars
__P((char *, int, char *));
391 extern void xsetenv
__P((char *, char *));
392 extern void sleep1000
__P((int));
394 extern void opendebug
__P((int, int));
397 # ifndef HAVE_VSNPRINTF
398 extern int xvsnprintf
__P((char *, int, char *, va_list));
401 extern int xsnprintf
__P(());
407 extern int AclCheckPermWin
__P((struct acluser
*, int, struct win
*));
408 extern int AclCheckPermCmd
__P((struct acluser
*, int, struct comm
*));
409 extern int AclSetPerm
__P((struct acluser
*, struct acluser
*, char *, char *));
410 extern int AclUmask
__P((struct acluser
*, char *, char **));
411 extern int UsersAcl
__P((struct acluser
*, int, char **));
412 extern void AclWinSwap
__P((int, int));
413 extern int NewWindowAcl
__P((struct win
*, struct acluser
*));
414 extern void FreeWindowAcl
__P((struct win
*));
415 extern char *DoSu
__P((struct acluser
**, char *, char *, char *));
416 extern int AclLinkUser
__P((char *, char *));
417 #endif /* MULTIUSER */
418 extern int UserFreeCopyBuffer
__P((struct acluser
*));
419 extern struct acluser
**FindUserPtr
__P((char *));
420 extern int UserAdd
__P((char *, char *, struct acluser
**));
421 extern int UserDel
__P((char *, struct acluser
**));
426 extern void InitBraille
__P((void));
427 extern void RefreshBraille
__P((void));
428 extern void DoBrailleAction
__P((struct action
*, int));
429 extern void BGotoPos
__P((struct layer
*, int, int));
430 extern void BPutChar
__P((struct layer
*, struct mchar
*, int, int));
431 extern void BPutStr
__P((struct layer
*, char *, int, struct mchar
*, int, int));
432 extern void BCDisplayLine
__P((struct layer
*, struct mline
*, int, int, int, int));
439 extern void LGotoPos
__P((struct layer
*, int, int));
440 extern void LPutChar
__P((struct layer
*, struct mchar
*, int, int));
441 extern void LInsChar
__P((struct layer
*, struct mchar
*, int, int, struct mline
*));
442 extern void LPutStr
__P((struct layer
*, char *, int, struct mchar
*, int, int));
443 extern void LPutWinMsg
__P((struct layer
*, char *, int, struct mchar
*, int, int));
444 extern void LScrollH
__P((struct layer
*, int, int, int, int, int, struct mline
*));
445 extern void LScrollV
__P((struct layer
*, int, int, int, int));
446 extern void LClearAll
__P((struct layer
*, int));
447 extern void LClearArea
__P((struct layer
*, int, int, int, int, int, int));
448 extern void LClearLine
__P((struct layer
*, int, int, int, int, struct mline
*));
449 extern void LRefreshAll
__P((struct layer
*, int));
450 extern void LCDisplayLine
__P((struct layer
*, struct mline
*, int, int, int, int));
451 extern void LCDisplayLineWrap
__P((struct layer
*, struct mline
*, int, int, int, int));
452 extern void LSetRendition
__P((struct layer
*, struct mchar
*));
453 extern void LWrapChar
__P((struct layer
*, struct mchar
*, int, int, int, int));
454 extern void LCursorVisibility
__P((struct layer
*, int));
455 extern void LSetFlow
__P((struct layer
*, int));
456 extern void LKeypadMode
__P((struct layer
*, int));
457 extern void LCursorkeysMode
__P((struct layer
*, int));
458 extern void LMouseMode
__P((struct layer
*, int));
460 extern void LMsg
__P((int, char *, ...)) __attribute__((format(printf
, 2, 3)));
462 extern void LMsg
__P(());
464 extern void KillLayerChain
__P((struct layer
*));
465 extern int InitOverlayPage
__P((int, struct LayFuncs
*, int));
466 extern void ExitOverlayPage
__P((void));
469 #ifdef BUILTIN_TELNET
470 extern int TelOpen
__P((char **));
471 extern int TelConnect
__P((struct win
*));
472 extern int TelIsline
__P((struct win
*p
));
473 extern void TelProcessLine
__P((char **, int *));
474 extern int DoTelnet
__P((char *, int *, int));
475 extern int TelIn
__P((struct win
*, char *, int, int));
476 extern void TelBreak
__P((struct win
*));
477 extern void TelWindowSize
__P((struct win
*));
478 extern void TelStatus
__P((struct win
*, char *, int));
482 extern char *DoNLS
__P((char *));
487 extern void InitBuiltinTabs
__P((void));
488 extern struct mchar
*recode_mchar
__P((struct mchar
*, int, int));
489 extern struct mline
*recode_mline
__P((struct mline
*, int, int, int));
490 extern int FromUtf8
__P((int, int *));
491 extern void AddUtf8
__P((int));
492 extern int ToUtf8
__P((char *, int));
493 extern int ToUtf8_comb
__P((char *, int));
494 extern int utf8_isdouble
__P((int));
495 extern int utf8_iscomb
__P((int));
496 extern void utf8_handle_comb
__P((int, struct mchar
*));
497 extern int ContainsSpecialDeffont
__P((struct mline
*, int, int, int));
498 extern int LoadFontTranslation
__P((int, char *));
499 extern void LoadFontTranslationsForEncoding
__P((int));
501 extern void WinSwitchEncoding
__P((struct win
*, int));
502 extern int FindEncoding
__P((char *));
503 extern char *EncodingName
__P((int));
504 extern int EncodingDefFont
__P((int));
505 extern void ResetEncoding
__P((struct win
*));
506 extern int CanEncodeFont
__P((int, int));
507 extern int DecodeChar
__P((int, int, int *));
508 extern int RecodeBuf
__P((unsigned char *, int, int, int, unsigned char *));
510 extern int PrepareEncodedChar
__P((int));
513 extern int EncodeChar
__P((char *, int, int, int *));