Changeset View
Changeset View
Standalone View
Standalone View
contrib/less/lessecho.c
Show All 32 Lines | |||||
static char openquote = '"'; | static char openquote = '"'; | ||||
static char closequote = '"'; | static char closequote = '"'; | ||||
static char *meta_escape = "\\"; | static char *meta_escape = "\\"; | ||||
static char meta_escape_buf[2]; | static char meta_escape_buf[2]; | ||||
static char metachars[64] = ""; | static char metachars[64] = ""; | ||||
static int num_metachars = 0; | static int num_metachars = 0; | ||||
static void | static void | ||||
pr_usage() | pr_usage(void) | ||||
{ | { | ||||
fprintf(stderr, | fprintf(stderr, | ||||
"usage: lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-fn] [-a] file ...\n"); | "usage: lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-fn] [-a] file ...\n"); | ||||
} | } | ||||
static void | static void | ||||
pr_version() | pr_version(void) | ||||
{ | { | ||||
char *p; | char *p; | ||||
char buf[10]; | char buf[10]; | ||||
char *pbuf = buf; | char *pbuf = buf; | ||||
for (p = version; *p != ' '; p++) | for (p = version; *p != ' '; p++) | ||||
if (*p == '\0') | if (*p == '\0') | ||||
return; | return; | ||||
for (p++; *p != '$' && *p != ' ' && *p != '\0'; p++) | for (p++; *p != '$' && *p != ' ' && *p != '\0'; p++) | ||||
*pbuf++ = *p; | *pbuf++ = *p; | ||||
*pbuf = '\0'; | *pbuf = '\0'; | ||||
printf("%s\n", buf); | printf("%s\n", buf); | ||||
} | } | ||||
static void | static void | ||||
pr_error(s) | pr_error(char *s) | ||||
char *s; | |||||
{ | { | ||||
fprintf(stderr, "%s\n", s); | fprintf(stderr, "%s\n", s); | ||||
exit(1); | exit(1); | ||||
} | } | ||||
static long | static long | ||||
lstrtol(s, radix, pend) | lstrtol(char *s, int radix, char **pend) | ||||
char *s; | |||||
int radix; | |||||
char **pend; | |||||
{ | { | ||||
int v; | int v; | ||||
int neg = 0; | int neg = 0; | ||||
long n = 0; | long n = 0; | ||||
/* Skip leading white space. */ | /* Skip leading white space. */ | ||||
while (*s == ' ' || *s == '\t') | while (*s == ' ' || *s == '\t') | ||||
s++; | s++; | ||||
▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines |