version 1.3, 2010/04/23 05:34:05 |
version 1.5, 2020/11/01 10:28:22 |
|
|
/* Copyright (c) 1987, 1988 by Software Research Associates, Inc. */ |
/* Copyright (c) 1987, 1988 by Software Research Associates, Inc. */ |
|
|
|
#if defined(ANDROID) |
|
#include <strings.h> |
|
#define index(s,c) strchr(s,c) |
|
#define rindex(s,c) strrchr(s,c) |
|
#endif |
|
|
#ifndef lint |
#ifndef lint |
static char rcsid[]= |
static char rcsid[]= |
"$Header$ (SRA)"; |
"$Header$ (SRA)"; |
Line 8 static char rcsid[]= |
|
Line 14 static char rcsid[]= |
|
#ifndef MKARGDEBUG |
#ifndef MKARGDEBUG |
|
|
#include <stdio.h> |
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <unistd.h> |
#include <string.h> |
#include <string.h> |
#include <pwd.h> |
#include <pwd.h> |
#include <sys/types.h> |
#include <sys/types.h> |
#if defined(__CYGWIN__) || defined(sun) |
#if defined(__CYGWIN__) || defined(sun) || defined(ANDROID) |
#include <dirent.h> |
#include <dirent.h> |
#else |
#else |
#include <sys/dir.h> |
#include <sys/dir.h> |
#endif |
#endif |
#include <ctype.h> |
#include <ctype.h> |
#include "fep_defs.h" |
#include "fep_defs.h" |
|
#include "fep_funcs.h" |
|
|
message(messageString) |
void message(char *messageString) |
char *messageString; |
|
{ |
{ |
write (2, messageString, strlen (messageString)); |
write (2, messageString, strlen (messageString)); |
} |
} |
|
|
errorBell() |
void errorBell() |
{ |
{ |
write (2, "\007", 1); |
write (2, "\007", 1); |
} |
} |
|
|
ctlprint(string) |
void ctlprint(char *string) |
char *string; |
|
{ |
{ |
register char *cp; |
register char *cp; |
|
|
|
|
/* |
/* |
* Print string using "^" for control characters |
* Print string using "^" for control characters |
*/ |
*/ |
printS (string) |
void printS (char *string) |
char *string; |
|
{ |
{ |
char *cp; |
char *cp; |
|
|
|
|
/* |
/* |
* Check the line is empty or not |
* Check the line is empty or not |
*/ |
*/ |
is_empty_line(line) |
int is_empty_line(char *line) |
char *line; |
|
{ |
{ |
register char *cp; |
register char *cp; |
|
|
Line 78 is_empty_line(line) |
|
Line 83 is_empty_line(line) |
|
/* |
/* |
* Put character using "^" for control characters |
* Put character using "^" for control characters |
*/ |
*/ |
putChar(c) |
void putChar(char c) |
char c; |
|
{ |
{ |
if (isctlchar(c)) { |
if (isctlchar(c)) { |
(void) putchar('^'); |
(void) putchar('^'); |
|
|
(void) putchar(c); |
(void) putchar(c); |
} |
} |
|
|
char * |
char * x_dirname (char *dir) |
x_dirname (dir) |
|
char *dir; |
|
{ |
{ |
static char dirname [256]; |
static char dirname [256]; |
|
#if !defined(ANDROID) |
char *index(); |
char *index(); |
|
#endif |
|
|
if (*dir != '~') |
if (*dir != '~') |
strcpy (dirname, dir); |
strcpy (dirname, dir); |
|
|
return (dirname); |
return (dirname); |
} |
} |
|
|
DIR * |
DIR * x_opendir (char *dir) |
x_opendir (dir) |
|
char *dir; |
|
{ |
{ |
return (opendir (x_dirname (dir))); |
return (opendir (x_dirname (dir))); |
} |
} |
|
|
/* |
/* |
* Strring compare for qsort |
* Strring compare for qsort |
*/ |
*/ |
scmp (a, b) |
int scmp (char **a, char **b) |
char **a, **b; |
|
{ |
{ |
|
|
return (strcmp (*a, *b)); |
return (strcmp (*a, *b)); |
|
|
/* |
/* |
* Return 1 if "str" is prefixed by "sub" |
* Return 1 if "str" is prefixed by "sub" |
*/ |
*/ |
prefix (sub, str) |
int prefix (char *sub, char *str) |
register char *sub, *str; |
|
{ |
{ |
|
|
for (;;) { |
for (;;) { |
Line 163 prefix (sub, str) |
|
Line 163 prefix (sub, str) |
|
/* |
/* |
* Return 1 if s includes character c |
* Return 1 if s includes character c |
*/ |
*/ |
any (c, s) |
int any (int c, char *s) |
register int c; |
|
register char *s; |
|
{ |
{ |
|
|
while (*s) |
while (*s) |
|
|
/* |
/* |
* Return maximum number of d1 and d2 |
* Return maximum number of d1 and d2 |
*/ |
*/ |
max (d1, d2) |
int max (int d1, int d2) |
int d1, d2; |
|
{ |
{ |
return (d1 > d2 ? d1 : d2); |
return (d1 > d2 ? d1 : d2); |
} |
} |
|
|
} |
} |
#endif /* MKARGDEBUG */ |
#endif /* MKARGDEBUG */ |
|
|
showArgs (comline) |
void showArgs (char *comline) |
char *comline; |
|
{ |
{ |
char *argv[MAXARGS]; |
char *argv[MAXARGS]; |
register int c; |
register int c; |
Line 225 showArgs (comline) |
|
Line 221 showArgs (comline) |
|
printf ("\n"); |
printf ("\n"); |
} |
} |
|
|
mkargv (s, argv, maxarg) |
int mkargv (char *s, char *argv[], int maxarg) |
char *s; |
|
char *argv[]; |
|
int maxarg; |
|
{ |
{ |
register char *cp; |
register char *cp; |
register int argc = 0; |
register int argc = 0; |
|
|
return (argc); |
return (argc); |
} |
} |
|
|
reverse_strcpy (to, from) |
void reverse_strcpy (char *to, char *from) |
register char *to, *from; |
|
{ |
{ |
register int len; |
register int len; |
|
|
Line 348 reverse_strcpy (to, from) |
|
Line 340 reverse_strcpy (to, from) |
|
*(to + len) = *(from + len); |
*(to + len) = *(from + len); |
} |
} |
|
|
char *search_string (s, lookup) |
char *search_string (char *s, char *lookup) |
char *s, *lookup; |
|
{ |
{ |
int len = strlen (lookup); |
int len = strlen (lookup); |
enum {SQUOTE, DQUOTE, NORMAL} status = NORMAL; |
enum {SQUOTE, DQUOTE, NORMAL} status = NORMAL; |
Line 386 char *search_string (s, lookup) |
|
Line 377 char *search_string (s, lookup) |
|
* It is assumed that first byte of strint s can't be second byte of KANJI |
* It is assumed that first byte of strint s can't be second byte of KANJI |
* code. |
* code. |
*/ |
*/ |
iskanji_in_string (s, i) |
int iskanji_in_string (char *s, int i) |
char *s; |
|
int i; |
|
{ |
{ |
register char *cp = s, *target = s + i; |
register char *cp = s, *target = s + i; |
|
|