Skip to content

Commit

Permalink
Fix warnings in screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ccoffing committed Jan 16, 2024
1 parent f827cd1 commit e63b610
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 59 deletions.
3 changes: 3 additions & 0 deletions elkscmd/screen/ansi.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ enum move_t {

extern char *getenv(), *tgetstr(), *tgoto();

static void RedisplayLine(char *os, char *oa, char *of, int y, int from, int to);
static void DisplayLine(char *os, char *oa, char *of, char *s, char *as, char *fs, int y, int from, int to);

int rows, cols;
int status;
int flowctl;
Expand Down
2 changes: 0 additions & 2 deletions elkscmd/screen/ansi.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ int InitTerm(void);
int FinitTerm(void);
static int AddCap(char *s);
char *MakeTermcap(int aflag);
static void DisplayLine(char *os, char *oa, char *of, char *s, char *as, char *fs, int y, int from, int to);
static int MakeString(char *cap, char *buf, char *s);
static int Special(int c);
static int DoCSI(int c, int intermediate);
Expand Down Expand Up @@ -64,7 +63,6 @@ static int SaveAttr(int newattr);
static int RestoreAttr(int oldattr);
static int FillWithEs(void);
static int Redisplay(void);
static void RedisplayLine(char *os, char *oa, char *of, int y, int from, int to);
static int MakeBlankLine(char *p, int n);

int Activate(struct win *wp);
Expand Down
57 changes: 51 additions & 6 deletions elkscmd/screen/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,59 @@ static char ttys[] = "/etc/ttys";

#define Ctrl(c) ((c)&037)

static int SigHandler(void);
static int DoWait(void);
static void CheckWindows(void);
static int ProcessInput(char *buf, int len);
static void SwitchWindow(int n);
static int SetCurrWindow(int n);
static int NextWindow(void);
static int PreviousWindow(void);
static int FreeWindow(struct win *wp);
static int ShowWindows(void);
static int MakeServerSocket(void);
static int MakeClientSocket(int err);
static int SendCreateMsg(int s, int ac, char **av, int aflag);
static int SendErrorMsg(char *fmt,...);
static void ReceiveMsg(int s);
static int ExecCreate(struct msg *mp);
static void ReadRc(char *fn);
static int Parse(char *fn, char *buf, char **args);
static char **SaveArgs(int argc, char **argv);
static int MakeNewEnv(void);
static int IsSymbol(char *e, char *s);
static char *Filename(char *s);
static int IsNum(char *s, int base);
static int RemoveUtmp(int slot);
static int SetUtmp(char *name);
static int InitUtmp(void);
static int MoreWindows(void);
static int MakeWindow(char *prog, char **args, int aflag, int StartAt, char *dir);
static int GetSockName(void);
static int Kill(int pid, int sig);
static void Attacher(void);
static int Attach(int how);
static void Detach(int suspend);
static int SetTTY(int fd, struct mode *mp);
static int GetTTY(int fd, struct mode *mp);
static int ShowInfo(void);
static void screen_execvpe(char *prog, char **args, char **env);
static void WriteFile(int dump);
static void KillWindow(struct win **pp);
static void Finit(int signum);
static int InitKeytab(void);
static int enableRawMode(int fd);
static void disableRawMode(int fd);
static void brktty(void);
static void freetty(void);

extern char *blank, Term[];
extern int rows, cols;
extern int ISO2022;
extern int status;
extern time_t TimeDisplayed;
extern char AnsiVersion[];
extern int flowctl;
extern int sys_nerr;
extern char *MakeTermcap(int aflag);
extern char *getlogin(void);
static void AttacherFinit(int signum);
Expand All @@ -94,8 +139,6 @@ static int ESCseen;
static int GotSignal;
static char DefaultShell[] = "/bin/sh";
static char DefaultPath[] = ":/bin:/usr/bin";
static char PtyProto[] = "/dev/ptyXY";
static char TtyProto[] = "/dev/ttyXY";
static int TtyMode = 0622;
static char SockPath[PATH_MAX];
static char SockDir[] = "screen";
Expand All @@ -106,9 +149,11 @@ static char Esc = Ctrl('a');
static char MetaEsc = 'a';
static char *home;
static int HasWindow;
#ifdef UTMP
static int utmp, utmpf;
static char UtmpName[] = "/etc/utmp";
static char *LoginName;
#endif
static char *BellString = "Bell in window %";
static int mflag, nflag, fflag, rflag;
static char HostName[MAXSTR];
Expand Down Expand Up @@ -199,7 +244,7 @@ main(int ac, char **av)
int n, len;
struct win **pp, *p;
char *ap;
int s, x = 0;
int s;
fd_set r_readfd, w_writefd, e_errfd;
int aflag = 0;
int lflag = 0;
Expand Down Expand Up @@ -766,7 +811,7 @@ SetCurrWindow(int n)
return 0;
}

int
static int
NextWindow(void)
{
struct win **pp;
Expand Down Expand Up @@ -1746,7 +1791,7 @@ static char *
MakeBellMsg(int n)
{
static char buf[MAXSTR];
char *p = buf, *s = BellString;
char *p = buf, *s;

for (s = BellString; *s && p < buf + MAXSTR - 1; s++)
*p++ = (*s == '%') ? n + '0' : *s;
Expand Down
51 changes: 0 additions & 51 deletions elkscmd/screen/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,54 +110,9 @@ struct mode {
#endif
};

static int SigHandler(void);
static int DoWait(void);
static void CheckWindows(void);
static int ProcessInput(char *buf, int len);
static void SwitchWindow(int n);
static int SetCurrWindow(int n);
int NextWindow(void);
static int PreviousWindow(void);
static int FreeWindow(struct win *wp);
static int ShowWindows(void);
static void DisplayLine(char *, char *, char *, char *, char *, char *, int, int, int);
static void RedisplayLine(char *, char *, char *, int, int, int);

static int CheckSockName(int client);
static int MakeServerSocket(void);
static int MakeClientSocket(int err);
static int SendCreateMsg(int s, int ac, char **av, int aflag);
static int SendErrorMsg(char *fmt,...);
static void ReceiveMsg(int s);
static int ExecCreate(struct msg *mp);
static void ReadRc(char *fn);
static int Parse(char *fn, char *buf, char **args);
static char **SaveArgs(int argc, char **argv);
static int MakeNewEnv(void);
static int IsSymbol(char *e, char *s);
void Msg(int err, char *fmt,...);
int bclear(char *p, int n);
static char *Filename(char *s);
static int IsNum(char *s, int base);

static int RemoveUtmp(int slot);
static int SetUtmp(char *name);
static int InitUtmp(void);
static int MoreWindows(void);
int MakeWindow(char *prog, char **args, int aflag, int StartAt, char *dir);
static int GetSockName(void);
static int Kill(int pid, int sig);
static void Attacher(void);
static int Attach(int how);
static void Detach(int suspend);
static int SetTTY(int fd, struct mode *mp);
static int GetTTY(int fd, struct mode *mp);
static int ShowInfo(void);
static void screen_execvpe(char *prog, char **args, char **env);
static void WriteFile(int dump);
static void KillWindow(struct win **pp);
static void Finit(int signum);
static int InitKeytab(void);
int InitTerm(void);
int FinitTerm(void);
void WriteString(struct win *wp, char *buf, int len);
Expand All @@ -168,12 +123,6 @@ void RemoveStatus(struct win *p);
int MakeStatus(char *msg, struct win *wp);
int gethostname(char *host, size_t size);

static int enableRawMode(int fd);
static void disableRawMode(int fd);

static void brktty(void);
static void freetty(void);

void exit_with_usage(char *myname);
int display_help(void);

Expand Down

0 comments on commit e63b610

Please sign in to comment.