* version.h doesn't need an RCS ID
* compat.h does, add it to misc.c, always include it, move if NEED_COMPAT * major whitespace cleanup in sh.h
This commit is contained in:
parent
e20d82c4d1
commit
a87ff74cbd
9
compat.h
9
compat.h
@ -1,5 +1,6 @@
|
|||||||
/* $MirOS: src/bin/mksh/compat.h,v 1.3 2006/08/18 18:59:49 tg Exp $ */
|
#define MKSH_COMPAT_H_ID "$MirOS: src/bin/mksh/compat.h,v 1.4 2006/08/22 22:16:04 tg Exp $"
|
||||||
|
|
||||||
|
#ifdef NEED_COMPAT
|
||||||
/* Part I: extra headers */
|
/* Part I: extra headers */
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__INTERIX)
|
#if defined(__sun__) || defined(__INTERIX)
|
||||||
@ -39,7 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef S_ISTXT
|
#ifndef S_ISTXT
|
||||||
#define S_ISTXT 0001000 /* sticky bit */
|
#define S_ISTXT 0001000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -60,8 +61,10 @@ mode_t getmode(const void *, mode_t);
|
|||||||
void *setmode(const char *);
|
void *setmode(const char *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__INTERIX)
|
#ifdef __INTERIX
|
||||||
#define makedev(x,y) mkdev((x),(y))
|
#define makedev(x,y) mkdev((x),(y))
|
||||||
extern int __cdecl seteuid(uid_t);
|
extern int __cdecl seteuid(uid_t);
|
||||||
extern int __cdecl setegid(gid_t);
|
extern int __cdecl setegid(gid_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
4
misc.c
4
misc.c
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.13 2006/08/09 20:44:15 tg Exp $"
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.14 2006/08/22 22:16:04 tg Exp $"
|
||||||
"\t" MKSH_SH_H_ID);
|
"\t" MKSH_SH_H_ID "\t" MKSH_COMPAT_H_ID);
|
||||||
|
|
||||||
short chtypes[UCHAR_MAX+1]; /* type bits for unsigned char */
|
short chtypes[UCHAR_MAX+1]; /* type bits for unsigned char */
|
||||||
|
|
||||||
|
93
sh.h
93
sh.h
@ -8,7 +8,7 @@
|
|||||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||||
|
|
||||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.35 2006/08/16 00:00:24 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.36 2006/08/22 22:16:04 tg Exp $"
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
@ -44,9 +44,8 @@
|
|||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#if defined(NEED_COMPAT)
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#endif
|
#include "version.h"
|
||||||
|
|
||||||
/* some useful #defines */
|
/* some useful #defines */
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
@ -86,7 +85,7 @@ typedef int32_t Tflag;
|
|||||||
#define _PATH_DEFPATH "/bin:/usr/bin:/sbin:/usr/sbin"
|
#define _PATH_DEFPATH "/bin:/usr/bin:/sbin:/usr/sbin"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXTERN char * kshname; /* $0 */
|
EXTERN char *kshname; /* $0 */
|
||||||
EXTERN pid_t kshpid; /* $$, shell pid */
|
EXTERN pid_t kshpid; /* $$, shell pid */
|
||||||
EXTERN pid_t procpid; /* pid of executing process */
|
EXTERN pid_t procpid; /* pid of executing process */
|
||||||
EXTERN uid_t ksheuid; /* effective uid of shell */
|
EXTERN uid_t ksheuid; /* effective uid of shell */
|
||||||
@ -560,15 +559,14 @@ struct arg_info {
|
|||||||
*/
|
*/
|
||||||
struct block {
|
struct block {
|
||||||
Area area; /* area to allocate things */
|
Area area; /* area to allocate things */
|
||||||
/*struct arg_info argi;*/
|
|
||||||
char **argv;
|
char **argv;
|
||||||
int argc;
|
int argc;
|
||||||
int flags; /* see BF_* */
|
int flags; /* see BF_* */
|
||||||
struct table vars; /* local variables */
|
struct table vars; /* local variables */
|
||||||
struct table funs; /* local functions */
|
struct table funs; /* local functions */
|
||||||
Getopt getopts_state;
|
Getopt getopts_state;
|
||||||
char * error; /* error handler */
|
char *error; /* error handler */
|
||||||
char * exit; /* exit handler */
|
char *exit; /* exit handler */
|
||||||
struct block *next; /* enclosing block */
|
struct block *next; /* enclosing block */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -803,7 +801,7 @@ typedef char *XStringP;
|
|||||||
#define Xsavepos(xs, xp) ((xp) - (xs).beg)
|
#define Xsavepos(xs, xp) ((xp) - (xs).beg)
|
||||||
#define Xrestpos(xs, xp, n) ((xs).beg + (n))
|
#define Xrestpos(xs, xp, n) ((xs).beg + (n))
|
||||||
|
|
||||||
char * Xcheck_grow_(XString *, char *, unsigned);
|
char *Xcheck_grow_(XString *, char *, unsigned);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* expandable vector of generic pointers
|
* expandable vector of generic pointers
|
||||||
@ -962,32 +960,32 @@ EXTERN char **histptr; /* last history item */
|
|||||||
EXTERN int histsize; /* history size */
|
EXTERN int histsize; /* history size */
|
||||||
|
|
||||||
/* alloc.c */
|
/* alloc.c */
|
||||||
Area * ainit(Area *);
|
Area *ainit(Area *);
|
||||||
void afreeall(Area *);
|
void afreeall(Area *);
|
||||||
void * alloc(size_t, Area *);
|
void *alloc(size_t, Area *);
|
||||||
void * aresize(void *, size_t, Area *);
|
void *aresize(void *, size_t, Area *);
|
||||||
void afree(void *, Area *);
|
void afree(void *, Area *);
|
||||||
/* edit.c */
|
/* edit.c */
|
||||||
void x_init(void);
|
void x_init(void);
|
||||||
int x_read(char *, size_t);
|
int x_read(char *, size_t);
|
||||||
int x_bind(const char *, const char *, int, int);
|
int x_bind(const char *, const char *, int, int);
|
||||||
/* eval.c */
|
/* eval.c */
|
||||||
char * substitute(const char *, int);
|
char *substitute(const char *, int);
|
||||||
char ** eval(char **, int);
|
char **eval(char **, int);
|
||||||
char * evalstr(char *cp, int);
|
char *evalstr(char *cp, int);
|
||||||
char * evalonestr(char *cp, int);
|
char *evalonestr(char *cp, int);
|
||||||
char *debunk(char *, const char *, size_t);
|
char *debunk(char *, const char *, size_t);
|
||||||
void expand(char *, XPtrV *, int);
|
void expand(char *, XPtrV *, int);
|
||||||
int glob_str(char *, XPtrV *, int);
|
int glob_str(char *, XPtrV *, int);
|
||||||
/* exec.c */
|
/* exec.c */
|
||||||
int execute(struct op * volatile, volatile int);
|
int execute(struct op * volatile, volatile int);
|
||||||
int shcomexec(char **);
|
int shcomexec(char **);
|
||||||
struct tbl * findfunc(const char *, unsigned int, int);
|
struct tbl *findfunc(const char *, unsigned int, int);
|
||||||
int define(const char *, struct op *);
|
int define(const char *, struct op *);
|
||||||
void builtin(const char *, int (*)(char **));
|
void builtin(const char *, int (*)(char **));
|
||||||
struct tbl * findcom(const char *, int);
|
struct tbl *findcom(const char *, int);
|
||||||
void flushcom(int);
|
void flushcom(int);
|
||||||
char * search(const char *, const char *, int, int *);
|
char *search(const char *, const char *, int, int *);
|
||||||
int search_access(const char *, int, int *);
|
int search_access(const char *, int, int *);
|
||||||
int pr_menu(char *const *);
|
int pr_menu(char *const *);
|
||||||
int pr_list(char *const *);
|
int pr_list(char *const *);
|
||||||
@ -1038,14 +1036,14 @@ void histsave(int, const char *, int);
|
|||||||
int c_fc(char **);
|
int c_fc(char **);
|
||||||
void sethistsize(int);
|
void sethistsize(int);
|
||||||
void sethistfile(const char *);
|
void sethistfile(const char *);
|
||||||
char ** histpos(void);
|
char **histpos(void);
|
||||||
int histnum(int);
|
int histnum(int);
|
||||||
int findhist(int, int, const char *, int);
|
int findhist(int, int, const char *, int);
|
||||||
int findhistrel(const char *);
|
int findhistrel(const char *);
|
||||||
char **hist_get_newest(int);
|
char **hist_get_newest(int);
|
||||||
void inittraps(void);
|
void inittraps(void);
|
||||||
void alarm_init(void);
|
void alarm_init(void);
|
||||||
Trap * gettrap(const char *, int);
|
Trap *gettrap(const char *, int);
|
||||||
void trapsig(int);
|
void trapsig(int);
|
||||||
void intrcheck(void);
|
void intrcheck(void);
|
||||||
int fatal_trap_check(void);
|
int fatal_trap_check(void);
|
||||||
@ -1078,7 +1076,7 @@ int j_stopped_running(void);
|
|||||||
int yylex(int);
|
int yylex(int);
|
||||||
void yyerror(const char *, ...)
|
void yyerror(const char *, ...)
|
||||||
__attribute__((__noreturn__, __format__ (printf, 1, 2)));
|
__attribute__((__noreturn__, __format__ (printf, 1, 2)));
|
||||||
Source * pushs(int, Area *);
|
Source *pushs(int, Area *);
|
||||||
void set_prompt(int, Source *);
|
void set_prompt(int, Source *);
|
||||||
void pprompt(const char *, int);
|
void pprompt(const char *, int);
|
||||||
int promptlen(const char *);
|
int promptlen(const char *);
|
||||||
@ -1121,28 +1119,27 @@ void coproc_cleanup(int);
|
|||||||
struct temp *maketemp(Area *, Temp_type, struct temp **);
|
struct temp *maketemp(Area *, Temp_type, struct temp **);
|
||||||
unsigned int hash(const char *);
|
unsigned int hash(const char *);
|
||||||
void ktinit(struct table *, Area *, int);
|
void ktinit(struct table *, Area *, int);
|
||||||
struct tbl * ktsearch(struct table *, const char *, unsigned int);
|
struct tbl *ktsearch(struct table *, const char *, unsigned int);
|
||||||
struct tbl * ktenter(struct table *, const char *, unsigned int);
|
struct tbl *ktenter(struct table *, const char *, unsigned int);
|
||||||
void ktdelete(struct tbl *);
|
void ktdelete(struct tbl *);
|
||||||
void ktwalk(struct tstate *, struct table *);
|
void ktwalk(struct tstate *, struct table *);
|
||||||
struct tbl * ktnext(struct tstate *);
|
struct tbl *ktnext(struct tstate *);
|
||||||
struct tbl ** ktsort(struct table *);
|
struct tbl **ktsort(struct table *);
|
||||||
/* misc.c */
|
/* misc.c */
|
||||||
void setctypes(const char *, int);
|
void setctypes(const char *, int);
|
||||||
void initctypes(void);
|
void initctypes(void);
|
||||||
char * ulton(unsigned long, int);
|
char *ulton(unsigned long, int);
|
||||||
char * str_save(const char *, Area *);
|
char *str_save(const char *, Area *);
|
||||||
char * str_nsave(const char *, int, Area *);
|
char *str_nsave(const char *, int, Area *);
|
||||||
int option(const char *);
|
int option(const char *);
|
||||||
char * getoptions(void);
|
char *getoptions(void);
|
||||||
void change_flag(enum sh_flag, int, int);
|
void change_flag(enum sh_flag, int, int);
|
||||||
int parse_args(char **, int, int *);
|
int parse_args(char **, int, int *);
|
||||||
int getn(const char *, int *);
|
int getn(const char *, int *);
|
||||||
int bi_getn(const char *, int *);
|
int bi_getn(const char *, int *);
|
||||||
int gmatchx(const char *, const char *, int);
|
int gmatchx(const char *, const char *, int);
|
||||||
int has_globbing(const char *, const char *);
|
int has_globbing(const char *, const char *);
|
||||||
const unsigned char *pat_scan(const unsigned char *, const unsigned char *,
|
const unsigned char *pat_scan(const unsigned char *, const unsigned char *, int);
|
||||||
int);
|
|
||||||
void qsortp(void **, size_t, int (*)(void *, void *));
|
void qsortp(void **, size_t, int (*)(void *, void *));
|
||||||
int xstrcmp(void *, void *);
|
int xstrcmp(void *, void *);
|
||||||
void ksh_getopt_reset(Getopt *, int);
|
void ksh_getopt_reset(Getopt *, int);
|
||||||
@ -1165,10 +1162,10 @@ struct shf *shf_reopen(int, int, struct shf *);
|
|||||||
struct shf *shf_sopen(char *, int, int, struct shf *);
|
struct shf *shf_sopen(char *, int, int, struct shf *);
|
||||||
int shf_close(struct shf *);
|
int shf_close(struct shf *);
|
||||||
int shf_fdclose(struct shf *);
|
int shf_fdclose(struct shf *);
|
||||||
char * shf_sclose(struct shf *);
|
char *shf_sclose(struct shf *);
|
||||||
int shf_flush(struct shf *);
|
int shf_flush(struct shf *);
|
||||||
int shf_read(char *, int, struct shf *);
|
int shf_read(char *, int, struct shf *);
|
||||||
char * shf_getse(char *, int, struct shf *);
|
char *shf_getse(char *, int, struct shf *);
|
||||||
int shf_getchar(struct shf *s);
|
int shf_getchar(struct shf *s);
|
||||||
int shf_ungetc(int, struct shf *);
|
int shf_ungetc(int, struct shf *);
|
||||||
int shf_putchar(int, struct shf *);
|
int shf_putchar(int, struct shf *);
|
||||||
@ -1176,41 +1173,41 @@ int shf_puts(const char *, struct shf *);
|
|||||||
int shf_write(const char *, int, struct shf *);
|
int shf_write(const char *, int, struct shf *);
|
||||||
int shf_fprintf(struct shf *, const char *, ...);
|
int shf_fprintf(struct shf *, const char *, ...);
|
||||||
int shf_snprintf(char *, int, const char *, ...);
|
int shf_snprintf(char *, int, const char *, ...);
|
||||||
char * shf_smprintf(const char *, ...);
|
char *shf_smprintf(const char *, ...);
|
||||||
int shf_vfprintf(struct shf *, const char *, va_list);
|
int shf_vfprintf(struct shf *, const char *, va_list);
|
||||||
/* syn.c */
|
/* syn.c */
|
||||||
void initkeywords(void);
|
void initkeywords(void);
|
||||||
struct op * compile(Source *);
|
struct op *compile(Source *);
|
||||||
/* tree.c */
|
/* tree.c */
|
||||||
int fptreef(struct shf *, int, const char *, ...);
|
int fptreef(struct shf *, int, const char *, ...);
|
||||||
char * snptreef(char *, int, const char *, ...);
|
char *snptreef(char *, int, const char *, ...);
|
||||||
struct op * tcopy(struct op *, Area *);
|
struct op *tcopy(struct op *, Area *);
|
||||||
char * wdcopy(const char *, Area *);
|
char *wdcopy(const char *, Area *);
|
||||||
char * wdscan(const char *, int);
|
char *wdscan(const char *, int);
|
||||||
char * wdstrip(const char *);
|
char *wdstrip(const char *);
|
||||||
void tfree(struct op *, Area *);
|
void tfree(struct op *, Area *);
|
||||||
/* var.c */
|
/* var.c */
|
||||||
void newblock(void);
|
void newblock(void);
|
||||||
void popblock(void);
|
void popblock(void);
|
||||||
void initvar(void);
|
void initvar(void);
|
||||||
struct tbl * global(const char *);
|
struct tbl *global(const char *);
|
||||||
struct tbl * local(const char *, bool);
|
struct tbl *local(const char *, bool);
|
||||||
char * str_val(struct tbl *);
|
char *str_val(struct tbl *);
|
||||||
long intval(struct tbl *);
|
long intval(struct tbl *);
|
||||||
int setstr(struct tbl *, const char *, int);
|
int setstr(struct tbl *, const char *, int);
|
||||||
struct tbl *setint_v(struct tbl *, struct tbl *, bool);
|
struct tbl *setint_v(struct tbl *, struct tbl *, bool);
|
||||||
void setint(struct tbl *, long);
|
void setint(struct tbl *, long);
|
||||||
int getint(struct tbl *, long *, bool);
|
int getint(struct tbl *, long *, bool);
|
||||||
struct tbl * typeset(const char *, Tflag, Tflag, int, int);
|
struct tbl *typeset(const char *, Tflag, Tflag, int, int);
|
||||||
void unset(struct tbl *, int);
|
void unset(struct tbl *, int);
|
||||||
char * skip_varname(const char *, int);
|
char *skip_varname(const char *, int);
|
||||||
char *skip_wdvarname(const char *, int);
|
char *skip_wdvarname(const char *, int);
|
||||||
int is_wdvarname(const char *, int);
|
int is_wdvarname(const char *, int);
|
||||||
int is_wdvarassign(const char *);
|
int is_wdvarassign(const char *);
|
||||||
char ** makenv(void);
|
char **makenv(void);
|
||||||
void change_random(void);
|
void change_random(void);
|
||||||
int array_ref_len(const char *);
|
int array_ref_len(const char *);
|
||||||
char * arrayname(const char *);
|
char *arrayname(const char *);
|
||||||
void set_array(const char *, int, char **);
|
void set_array(const char *, int, char **);
|
||||||
int eaccess(const char *, int);
|
int eaccess(const char *, int);
|
||||||
|
|
||||||
@ -1270,8 +1267,6 @@ EXTERN struct termios tty_state; /* saved tty state */
|
|||||||
extern void tty_init(int);
|
extern void tty_init(int);
|
||||||
extern void tty_close(void);
|
extern void tty_close(void);
|
||||||
|
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
/* be sure not to interfere with anyone else's idea about EXTERN */
|
/* be sure not to interfere with anyone else's idea about EXTERN */
|
||||||
#ifdef EXTERN_DEFINED
|
#ifdef EXTERN_DEFINED
|
||||||
# undef EXTERN_DEFINED
|
# undef EXTERN_DEFINED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user