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)) __attribute__((__noreturn__
));
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, const char *, ...)) __attribute__((format(printf
, 2, 3)));
44 extern void Panic
__P((int, const char *, ...)) __attribute__((format(printf
, 2, 3))) __attribute__((__noreturn__
));
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((int));
295 extern void freetty
__P((void));
296 extern void Resize_obuf
__P((void));
298 extern void NukePending
__P((void));
301 extern void ClearAllXtermOSC
__P((void));
302 extern void SetXtermOSC
__P((int, char *));
305 extern int color256to16
__P((int));
307 extern int color256to88
__P((int));
310 extern void ResetIdle
__P((void));
311 extern void KillBlanker
__P((void));
312 extern void DisplaySleep1000
__P((int, int));
315 extern int ChangeWindowSize
__P((struct win
*, int, int, int));
316 extern void ChangeScreenSize
__P((int, int, int));
317 extern void CheckScreenSize
__P((int));
318 extern char *xrealloc
__P((char *, int));
319 extern void ResizeLayersToCanvases
__P((void));
320 extern void ResizeLayer
__P((struct layer
*, int, int, struct display
*));
321 extern int MayResizeLayer
__P((struct layer
*));
322 extern void FreeAltScreen
__P((struct win
*));
323 extern void EnterAltScreen
__P((struct win
*));
324 extern void LeaveAltScreen
__P((struct win
*));
327 extern void evenq
__P((struct event
*));
328 extern void evdeq
__P((struct event
*));
329 extern void SetTimeout
__P((struct event
*, int));
330 extern void sched
__P((void));
333 extern int FindSocket
__P((int *, int *, int *, char *));
334 extern int MakeClientSocket
__P((int));
335 extern int MakeServerSocket
__P((void));
336 extern int RecoverSocket
__P((void));
337 extern int chsock
__P((void));
338 extern void ReceiveMsg
__P((void));
339 extern void SendCreateMsg
__P((char *, struct NewWindow
*));
340 extern int SendErrorMsg
__P((char *, char *));
341 extern int SendAttachMsg
__P((int, struct msg
*, int));
344 extern char *SaveStr
__P((const char *));
345 extern char *SaveStrn
__P((const char *, int));
346 extern char *InStr
__P((char *, const char *));
347 #ifndef HAVE_STRERROR
348 extern char *strerror
__P((int));
350 extern void centerline
__P((char *, int));
351 extern void leftline
__P((char *, int));
352 extern char *Filename
__P((char *));
353 extern char *stripdev
__P((char *));
354 #ifdef NEED_OWN_BCOPY
355 extern void xbcopy
__P((char *, char *, int));
357 extern void bclear
__P((char *, int));
358 extern void closeallfiles
__P((int));
359 extern int UserContext
__P((void));
360 extern void UserReturn
__P((int));
361 extern int UserStatus
__P((void));
362 #if defined(POSIX) || defined(hpux)
363 extern void (*xsignal
__P((int, void (*)SIGPROTOARG
))) __P(SIGPROTOARG
);
366 extern int rename
__P((char *, char *));
368 #if defined(HAVE_SETEUID) || defined(HAVE_SETREUID)
369 extern void xseteuid
__P((int));
370 extern void xsetegid
__P((int));
372 extern int AddXChar
__P((char *, int));
373 extern int AddXChars
__P((char *, int, char *));
374 extern void xsetenv
__P((char *, char *));
375 extern void sleep1000
__P((int));
377 extern void opendebug
__P((int, int));
380 # ifndef HAVE_VSNPRINTF
381 extern int xvsnprintf
__P((char *, int, char *, va_list));
384 extern int xsnprintf
__P(());
390 extern int AclCheckPermWin
__P((struct acluser
*, int, struct win
*));
391 extern int AclCheckPermCmd
__P((struct acluser
*, int, struct comm
*));
392 extern int AclSetPerm
__P((struct acluser
*, struct acluser
*, char *, char *));
393 extern int AclUmask
__P((struct acluser
*, char *, char **));
394 extern int UsersAcl
__P((struct acluser
*, int, char **));
395 extern void AclWinSwap
__P((int, int));
396 extern int NewWindowAcl
__P((struct win
*, struct acluser
*));
397 extern void FreeWindowAcl
__P((struct win
*));
398 extern char *DoSu
__P((struct acluser
**, char *, char *, char *));
399 extern int AclLinkUser
__P((char *, char *));
400 #endif /* MULTIUSER */
401 extern int UserFreeCopyBuffer
__P((struct acluser
*));
402 extern struct acluser
**FindUserPtr
__P((char *));
403 extern int UserAdd
__P((char *, char *, struct acluser
**));
404 extern int UserDel
__P((char *, struct acluser
**));
409 extern void InitBraille
__P((void));
410 extern void RefreshBraille
__P((void));
411 extern void DoBrailleAction
__P((struct action
*, int));
412 extern void BGotoPos
__P((struct layer
*, int, int));
413 extern void BPutChar
__P((struct layer
*, struct mchar
*, int, int));
414 extern void BPutStr
__P((struct layer
*, char *, int, struct mchar
*, int, int));
415 extern void BCDisplayLine
__P((struct layer
*, struct mline
*, int, int, int, int));
422 extern void LGotoPos
__P((struct layer
*, int, int));
423 extern void LPutChar
__P((struct layer
*, struct mchar
*, int, int));
424 extern void LInsChar
__P((struct layer
*, struct mchar
*, int, int, struct mline
*));
425 extern void LPutStr
__P((struct layer
*, char *, int, struct mchar
*, int, int));
426 extern void LPutWinMsg
__P((struct layer
*, char *, int, struct mchar
*, int, int));
427 extern void LScrollH
__P((struct layer
*, int, int, int, int, int, struct mline
*));
428 extern void LScrollV
__P((struct layer
*, int, int, int, int));
429 extern void LClearAll
__P((struct layer
*, int));
430 extern void LClearArea
__P((struct layer
*, int, int, int, int, int, int));
431 extern void LClearLine
__P((struct layer
*, int, int, int, int, struct mline
*));
432 extern void LRefreshAll
__P((struct layer
*, int));
433 extern void LCDisplayLine
__P((struct layer
*, struct mline
*, int, int, int, int));
434 extern void LCDisplayLineWrap
__P((struct layer
*, struct mline
*, int, int, int, int));
435 extern void LSetRendition
__P((struct layer
*, struct mchar
*));
436 extern void LWrapChar
__P((struct layer
*, struct mchar
*, int, int, int, int));
437 extern void LCursorVisibility
__P((struct layer
*, int));
438 extern void LSetFlow
__P((struct layer
*, int));
439 extern void LKeypadMode
__P((struct layer
*, int));
440 extern void LCursorkeysMode
__P((struct layer
*, int));
441 extern void LMouseMode
__P((struct layer
*, int));
443 extern void LMsg
__P((int, const char *, ...)) __attribute__((format(printf
, 2, 3)));
445 extern void LMsg
__P(());
447 extern void KillLayerChain
__P((struct layer
*));
448 extern int InitOverlayPage
__P((int, struct LayFuncs
*, int));
449 extern void ExitOverlayPage
__P((void));
452 #ifdef BUILTIN_TELNET
453 extern int TelOpen
__P((char **));
454 extern int TelConnect
__P((struct win
*));
455 extern int TelIsline
__P((struct win
*p
));
456 extern void TelProcessLine
__P((char **, int *));
457 extern int DoTelnet
__P((char *, int *, int));
458 extern int TelIn
__P((struct win
*, char *, int, int));
459 extern void TelBreak
__P((struct win
*));
460 extern void TelWindowSize
__P((struct win
*));
461 extern void TelStatus
__P((struct win
*, char *, int));
465 extern const char *DoNLS
__P((const char *));
470 extern void InitBuiltinTabs
__P((void));
471 extern struct mchar
*recode_mchar
__P((struct mchar
*, int, int));
472 extern struct mline
*recode_mline
__P((struct mline
*, int, int, int));
473 extern int FromUtf8
__P((int, int *));
474 extern void AddUtf8
__P((int));
475 extern int ToUtf8
__P((char *, int));
476 extern int ToUtf8_comb
__P((char *, int));
477 extern int utf8_isdouble
__P((int));
478 extern int utf8_iscomb
__P((int));
479 extern void utf8_handle_comb
__P((int, struct mchar
*));
480 extern int ContainsSpecialDeffont
__P((struct mline
*, int, int, int));
481 extern int LoadFontTranslation
__P((int, char *));
482 extern void LoadFontTranslationsForEncoding
__P((int));
484 extern void WinSwitchEncoding
__P((struct win
*, int));
485 extern int FindEncoding
__P((char *));
486 extern char *EncodingName
__P((int));
487 extern int EncodingDefFont
__P((int));
488 extern void ResetEncoding
__P((struct win
*));
489 extern int CanEncodeFont
__P((int, int));
490 extern int DecodeChar
__P((int, int, int *));
491 extern int RecodeBuf
__P((unsigned char *, int, int, int, unsigned char *));
493 extern int PrepareEncodedChar
__P((int));
496 extern int EncodeChar
__P((char *, int, int, int *));