version 1.13, 2015/11/19 18:39:49 |
version 1.14, 2015/11/23 09:39:55 |
|
|
int cn_action; |
int cn_action; |
}; |
}; |
|
|
static void lkerr(char *s); |
static void lkerr(char *); |
|
|
struct cmdname cmdnames[] = { |
struct cmdname cmdnames[] = { |
{ "back-bracket", A_B_BRACKET }, |
{ "back-bracket", A_B_BRACKET }, |
|
|
|
|
extern char version[]; |
extern char version[]; |
|
|
void |
static void |
usage(void) |
usage(void) |
{ |
{ |
(void) fprintf(stderr, "usage: lesskey [-o output] [input]\n"); |
(void) fprintf(stderr, "usage: lesskey [-o output] [input]\n"); |
exit(1); |
exit(1); |
} |
} |
|
|
char * |
static char * |
mkpathname(char *dirname, char *filename) |
mkpathname(char *dirname, char *filename) |
{ |
{ |
char *pathname; |
char *pathname; |
|
|
/* |
/* |
* Parse command line arguments. |
* Parse command line arguments. |
*/ |
*/ |
void |
static void |
parse_args(int argc, char **argv) |
parse_args(int argc, char **argv) |
{ |
{ |
char *arg; |
char *arg; |
|
|
/* |
/* |
* Initialize data structures. |
* Initialize data structures. |
*/ |
*/ |
void |
static void |
init_tables(void) |
init_tables(void) |
{ |
{ |
cmdtable.names = cmdnames; |
cmdtable.names = cmdnames; |
|
|
/* |
/* |
* Parse one character of a string. |
* Parse one character of a string. |
*/ |
*/ |
char * |
static char * |
tstr(char **pp, int xlate) |
tstr(char **pp, int xlate) |
{ |
{ |
char *p; |
char *p; |
|
|
/* |
/* |
* Skip non-space characters in a string. |
* Skip non-space characters in a string. |
*/ |
*/ |
char * |
static char * |
skipnsp(char *s) |
skipnsp(char *s) |
{ |
{ |
while (*s != '\0' && *s != ' ' && *s != '\t') |
while (*s != '\0' && *s != ' ' && *s != '\t') |
|
|
* Clean up an input line: |
* Clean up an input line: |
* strip off the trailing newline & any trailing # comment. |
* strip off the trailing newline & any trailing # comment. |
*/ |
*/ |
char * |
static char * |
clean_line(char *s) |
clean_line(char *s) |
{ |
{ |
int i; |
int i; |
|
|
/* |
/* |
* Add a byte to the output command table. |
* Add a byte to the output command table. |
*/ |
*/ |
void |
static void |
add_cmd_char(int c) |
add_cmd_char(int c) |
{ |
{ |
if (currtable->pbuffer >= currtable->buffer + MAX_USERCMD) { |
if (currtable->pbuffer >= currtable->buffer + MAX_USERCMD) { |
|
|
/* |
/* |
* Add a string to the output command table. |
* Add a string to the output command table. |
*/ |
*/ |
void |
static void |
add_cmd_str(char *s) |
add_cmd_str(char *s) |
{ |
{ |
for (; *s != '\0'; s++) |
for (; *s != '\0'; s++) |
|
|
/* |
/* |
* See if we have a special "control" line. |
* See if we have a special "control" line. |
*/ |
*/ |
int |
static int |
control_line(char *s) |
control_line(char *s) |
{ |
{ |
#define PREFIX(str, pat) (strncmp(str, pat, strlen(pat)) == 0) |
#define PREFIX(str, pat) (strncmp(str, pat, strlen(pat)) == 0) |
|
|
/* |
/* |
* Output some bytes. |
* Output some bytes. |
*/ |
*/ |
void |
static void |
fputbytes(FILE *fd, char *buf, int len) |
fputbytes(FILE *fd, char *buf, int len) |
{ |
{ |
while (len-- > 0) { |
while (len-- > 0) { |
|
|
/* |
/* |
* Output an integer, in special KRADIX form. |
* Output an integer, in special KRADIX form. |
*/ |
*/ |
void |
static void |
fputint(FILE *fd, unsigned int val) |
fputint(FILE *fd, unsigned int val) |
{ |
{ |
char c; |
char c; |
|
|
/* |
/* |
* Find an action, given the name of the action. |
* Find an action, given the name of the action. |
*/ |
*/ |
int |
static int |
findaction(char *actname) |
findaction(char *actname) |
{ |
{ |
int i; |
int i; |
|
|
return (A_INVALID); |
return (A_INVALID); |
} |
} |
|
|
void |
static void |
lkerr(char *s) |
lkerr(char *s) |
{ |
{ |
(void) fprintf(stderr, "line %d: %s\n", linenum, s); |
(void) fprintf(stderr, "line %d: %s\n", linenum, s); |
|
|
} |
} |
|
|
|
|
void |
static void |
parse_cmdline(char *p) |
parse_cmdline(char *p) |
{ |
{ |
int cmdlen; |
int cmdlen; |
|
|
} |
} |
} |
} |
|
|
void |
static void |
parse_varline(char *p) |
parse_varline(char *p) |
{ |
{ |
char *s; |
char *s; |
|
|
/* |
/* |
* Parse a line from the lesskey file. |
* Parse a line from the lesskey file. |
*/ |
*/ |
void |
static void |
parse_line(char *line) |
parse_line(char *line) |
{ |
{ |
char *p; |
char *p; |