Declare tags.c variables in tags.h. Declare stuff with external

linkage that is not in any other header in misc.h.  Remove some
redundant declarations elsewhere.
(prompt, doredir, dopipe, doexecute, output, screen, parsedelay):
Static linkage.
This commit is contained in:
Markus Armbruster 2004-02-20 08:22:28 +00:00
parent 8d438a4601
commit e7811102a3
11 changed files with 55 additions and 51 deletions

View file

@ -71,6 +71,7 @@ clean:
expect.o: misc.h fnlist.h expect.o: misc.h fnlist.h
globals.o: misc.h fnlist.h proto.h globals.o: misc.h fnlist.h proto.h
handle.o: misc.h
host.o: misc.h host.o: misc.h
ioqueue.o: misc.h queue.h ioqueue.h ioqueue.o: misc.h queue.h ioqueue.h
ipglob.o: misc.h ipglob.o: misc.h

View file

@ -142,7 +142,6 @@ expect(int s, int match, s_char *buf)
void void
sendcmd(int s, int cmd, s_char *arg) sendcmd(int s, int cmd, s_char *arg)
{ {
extern struct fn fnlist[];
s_char buf[128]; s_char buf[128];
int cc; int cc;
int len; int len;

View file

@ -35,12 +35,11 @@
#if !defined(_WIN32) #if !defined(_WIN32)
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "misc.h"
int int
handleintr(int s) handleintr(int s)
{ {
extern int interrupt;
if (interrupt) { if (interrupt) {
/* tacky, but it works */ /* tacky, but it works */
if (write(s, "\naborted\n", 1 + 7 + 1) <= 0) if (write(s, "\naborted\n", 1 + 7 + 1) <= 0)

View file

@ -47,8 +47,6 @@ static int dequeuecc(register struct ioqueue *ioq, register int cc);
void void
ioq_init(struct ioqueue *ioq, int bsize) ioq_init(struct ioqueue *ioq, int bsize)
{ {
extern s_char num_teles[];
initque(&ioq->queue); initque(&ioq->queue);
ioq->cc = 0; ioq->cc = 0;
ioq->bsize = bsize; ioq->bsize = bsize;

View file

@ -43,9 +43,6 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
int expect(int s, int match, s_char *buf);
void sendcmd(int s, int cmd, s_char *arg);
int int
login(int s, s_char *uname, s_char *cname, s_char *cpass, int kill_proc) login(int s, s_char *uname, s_char *cname, s_char *cpass, int kill_proc)
{ {

View file

@ -73,17 +73,6 @@ HANDLE hStdIn;
int interrupt; int interrupt;
int sock; int sock;
void saveargv(int ac, s_char **src, s_char **dst);
void getsose(void);
int hostport(s_char *name, struct sockaddr_in *addr);
int hostaddr(s_char *name, struct sockaddr_in *addr);
int hostconnect(struct sockaddr_in *addr);
int login(int s, s_char *uname, s_char *cname, s_char *cpass, int kill_proc);
int handleintr(int);
int termio(int fd, int sock, FILE *auxfi);
int serverio(int s, struct ioqueue *ioq);
void servercmd(struct ioqueue *ioq, FILE *auxfi);
static void intr(int sig); static void intr(int sig);
@ -98,8 +87,6 @@ main(int ac, s_char **av)
DWORD stdinmode; DWORD stdinmode;
SECURITY_ATTRIBUTES security; SECURITY_ATTRIBUTES security;
#endif #endif
extern s_char empireport[];
extern s_char empirehost[];
fd_set mask; fd_set mask;
struct ioqueue server; struct ioqueue server;
s_char *argv[128]; s_char *argv[128];

View file

@ -35,7 +35,14 @@
#define _MISC_H_ #define _MISC_H_
#include <ctype.h> #include <ctype.h>
#include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef _WIN32
#include <windows.h>
#include <winsock.h>
#else
#include <netinet/in.h>
#endif
#if !defined(aix) && !defined(sgi) #if !defined(aix) && !defined(sgi)
#ifndef ultrix /* already defined in ultrix */ #ifndef ultrix /* already defined in ultrix */
@ -46,4 +53,33 @@ typedef signed char s_char;
#endif /* !aix && !sgi */ #endif /* !aix && !sgi */
typedef short coord; /* also change NSC_COORD in nsc.h */ typedef short coord; /* also change NSC_COORD in nsc.h */
struct ioqueue;
extern struct fn fnlist[];
extern s_char empirehost[];
extern s_char empireport[];
extern int interrupt;
extern s_char num_teles[];
extern int sock;
extern s_char *SO;
extern s_char *SE;
#ifdef _WIN32
HANDLE hStdIn;
#endif
void getsose(void);
int expect(int s, int match, s_char *buf);
int handleintr(int);
int hostaddr(s_char *name, struct sockaddr_in *addr);
int hostconnect(struct sockaddr_in *addr);
int hostport(s_char *name, struct sockaddr_in *addr);
int login(int s, s_char *uname, s_char *cname, s_char *cpass, int kill_proc);
void saveargv(int ac, s_char **src, s_char **dst);
void sendcmd(int s, int cmd, s_char *arg);
int sendeof(int sock);
void servercmd(struct ioqueue *ioq, FILE *auxfi);
int serverio(int s, struct ioqueue *ioq);
int termio(int fd, int sock, FILE *auxfi);
#endif #endif

View file

@ -58,18 +58,12 @@ FILE *redir_fp;
FILE *pipe_fp; FILE *pipe_fp;
int exec_fd; int exec_fd;
void prompt(FILE *auxfi); static void prompt(FILE *auxfi);
void doredir(s_char *p); static void doredir(s_char *p);
void dopipe(s_char *p); static void dopipe(s_char *p);
void doexecute(s_char *p, FILE *auxfi); static void doexecute(s_char *p, FILE *auxfi);
void output(int code, s_char *buf, FILE *auxfi); static void output(int code, s_char *buf, FILE *auxfi);
void screen(register s_char *buf); static void screen(register s_char *buf);
int sendeof(int);
int termio(int fd, int sock, FILE *auxfi);
void _noecho(int);
extern s_char *SO;
extern s_char *SE;
void void
servercmd(struct ioqueue *ioq, FILE *auxfi) servercmd(struct ioqueue *ioq, FILE *auxfi)
@ -128,7 +122,7 @@ servercmd(struct ioqueue *ioq, FILE *auxfi)
} }
} }
void static void
prompt(FILE *auxfi) prompt(FILE *auxfi)
{ {
if (mode == C_PROMPT) { if (mode == C_PROMPT) {
@ -160,7 +154,7 @@ prompt(FILE *auxfi)
/* /*
* opens redir_fp if successful * opens redir_fp if successful
*/ */
void static void
doredir(s_char *p) doredir(s_char *p)
{ {
s_char *how; s_char *how;
@ -212,7 +206,7 @@ doredir(s_char *p)
/* /*
* opens "pipe_fp" if successful * opens "pipe_fp" if successful
*/ */
void static void
dopipe(s_char *p) dopipe(s_char *p)
{ {
s_char *tag; s_char *tag;
@ -242,10 +236,9 @@ dopipe(s_char *p)
free(tag); free(tag);
} }
void static void
doexecute(s_char *p, FILE *auxfi) doexecute(s_char *p, FILE *auxfi)
{ {
extern int sock;
int fd; int fd;
s_char *tag; s_char *tag;
@ -286,7 +279,7 @@ doexecute(s_char *p, FILE *auxfi)
free(tag); free(tag);
} }
void static void
output(int code, s_char *buf, FILE *auxfi) output(int code, s_char *buf, FILE *auxfi)
{ {
switch (code) { switch (code) {
@ -344,7 +337,7 @@ output(int code, s_char *buf, FILE *auxfi)
} }
} }
void static void
screen(register s_char *buf) screen(register s_char *buf)
{ {
register s_char *sop; register s_char *sop;

View file

@ -39,6 +39,10 @@ struct tagstruct {
struct tagstruct *next; struct tagstruct *next;
}; };
extern struct tagstruct *taglist;
extern s_char buf[4096];
extern s_char exec[8];
void io_init(void); void io_init(void);
s_char *gettag(s_char *p); s_char *gettag(s_char *p);

View file

@ -44,16 +44,6 @@
#include "misc.h" #include "misc.h"
#include "tags.h" #include "tags.h"
extern struct tagstruct *taglist;
extern s_char buf[4096];
extern s_char exec[];
#ifdef _WIN32
extern HANDLE hStdIn;
#endif
int sendeof(int sock);
int int
termio(int fd, int sock, FILE *auxfi) termio(int fd, int sock, FILE *auxfi)
{ {

View file

@ -47,7 +47,7 @@ s_char *SE = 0;
int tgetent(char *, char *); int tgetent(char *, char *);
void static void
parsedelay(s_char *r) parsedelay(s_char *r)
{ {
s_char *s, *t; s_char *s, *t;