diff options
Diffstat (limited to 'usr/src/cmd')
| -rw-r--r-- | usr/src/cmd/tic/Makefile.common | 3 | ||||
| -rw-r--r-- | usr/src/cmd/tic/tic_main.c | 46 | ||||
| -rw-r--r-- | usr/src/cmd/tic/tic_parse.c | 70 | ||||
| -rw-r--r-- | usr/src/cmd/tic/tic_read.c | 20 | ||||
| -rw-r--r-- | usr/src/cmd/tic/tic_scan.c | 4 |
5 files changed, 58 insertions, 85 deletions
diff --git a/usr/src/cmd/tic/Makefile.common b/usr/src/cmd/tic/Makefile.common index 00c0948db7..07df0ca8aa 100644 --- a/usr/src/cmd/tic/Makefile.common +++ b/usr/src/cmd/tic/Makefile.common @@ -43,9 +43,6 @@ MAPFILES= $(MAPFILE.INT) $(MAPFILE.NGB) LDFLAGS += $(MAPFILES:%=-Wl,-M%) CERRWARN += -_gcc=-Wno-char-subscripts -CERRWARN += -_gcc=-Wno-implicit-function-declaration -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += $(CNOWARN_UNINIT) # not linted SMATCH=off diff --git a/usr/src/cmd/tic/tic_main.c b/usr/src/cmd/tic/tic_main.c index 99312d3093..bde662ed2c 100644 --- a/usr/src/cmd/tic/tic_main.c +++ b/usr/src/cmd/tic/tic_main.c @@ -24,14 +24,14 @@ * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ -/* +/* * University Copyright- Copyright (c) 1982, 1986, 1988 * The Regents of the University of California * All Rights Reserved - * + * * University Acknowledgment- Portions of this document are derived from * software developed by the University of California, Berkeley, and its * contributors. @@ -233,43 +233,3 @@ check_dir(char dirletter) } return; } - -#include <curses.h> -#if (defined(SYSV) || defined(USG)) && !defined(SIGPOLL) -/* - * mkdir(dirname, mode) - * - * forks and execs the mkdir program to create the given directory - * - */ - -mkdir(dirname, mode) -#ifdef __STDC__ -const -#endif -char *dirname; -int mode; -{ - int fork_rtn; - int status; - - fork_rtn = fork(); - - switch (fork_rtn) { - case 0: /* Child */ - (void) execl("/bin/mkdir", "mkdir", dirname, (char *)0); - _exit(1); - - case -1: /* Error */ - fprintf(stderr, "%s: SYSTEM ERROR!! Fork failed!!!\n", - progname); - exit(1); - - default: - (void) wait(&status); - if ((status != 0) || (chmod(dirname, mode) == -1)) - return (-1); - return (0); - } -} -#endif diff --git a/usr/src/cmd/tic/tic_parse.c b/usr/src/cmd/tic/tic_parse.c index 37f5a7db6f..4afb2d2c62 100644 --- a/usr/src/cmd/tic/tic_parse.c +++ b/usr/src/cmd/tic/tic_parse.c @@ -122,9 +122,25 @@ struct use_header { struct use_header use_list = {NULL, NULL}; int use_count = 0; + +extern int get_token(void); +extern int must_swap(void); +extern void check_dir(char); +extern void err_abort(char *, ...); +extern void panic_mode(char); +extern int read_entry(char *, struct _bool_struct *, struct _num_struct *, + struct _str_struct *); +extern void reset_input(void); +extern void syserr_abort(char *, ...); +extern void warning(char *, ...); + +int do_entry(struct use_item *); +int handle_use(struct use_item *, long, short *, short *, short *); +int save_str(char *); +int write_object(FILE *, short *, short *, short *); void dequeue(struct use_item *); -void init_structure(short Booleans[], short Numbers[], short Strings[]); -void dump_structure(short Booleans[], short Numbers[], short Strings[]); +void dump_structure(short *, short *, short *); +void init_structure(short *, short *, short *); /* * The use_list is a doubly-linked list with NULLs terminating the lists: @@ -276,8 +292,7 @@ dump_list(char *str) */ int -do_entry(item_ptr) -struct use_item *item_ptr; +do_entry(struct use_item *item_ptr) { long entry_offset; int token_type; @@ -524,14 +539,13 @@ void dump_structure(short Booleans[], short Numbers[], short Strings[]) { struct stat64 statbuf; - FILE *fp; + FILE *fp = NULL; char name_list[1024]; char *first_name, *other_names, *cur_name; char filename[128 + 2 + 1]; char linkname[128 + 2 + 1]; int len; int alphastart = 0; - extern char *strchr(), *strrchr(); strcpy(name_list, term_names + string_table); DEBUG(7, "Name list = '%s'\n", name_list); @@ -666,11 +680,7 @@ dump_structure(short Booleans[], short Numbers[], short Strings[]) int -write_object(fp, Booleans, Numbers, Strings) -FILE *fp; -short Booleans[]; -short Numbers[]; -short Strings[]; +write_object(FILE *fp, short Booleans[], short Numbers[], short Strings[]) { struct header header; char *namelist; @@ -707,9 +717,8 @@ short Strings[]; cBooleans[i] = Booleans[i]; if (fwrite(&header, sizeof (header), 1, fp) != 1 || - fwrite(namelist, sizeof (char), namelen, fp) != namelen || - fwrite(cBooleans, sizeof (char), BoolCount, fp) != - BoolCount) + fwrite(namelist, sizeof (char), namelen, fp) != namelen || + fwrite(cBooleans, sizeof (char), BoolCount, fp) != BoolCount) return (-1); if ((namelen+BoolCount) % 2 != 0 && @@ -744,14 +753,13 @@ short Strings[]; */ int -save_str(string) -char *string; +save_str(char *string) { int old_next_free; /* Do not let an offset be 255. It reads as -1 in Vr2 binaries. */ if (next_free % 256 == 255) - next_free++; + string_table[next_free++] = '\0'; old_next_free = next_free; @@ -825,12 +833,8 @@ init_structure(short Booleans[], short Numbers[], short Strings[]) */ int -handle_use(item_ptr, entry_offset, Booleans, Numbers, Strings) -long entry_offset; -struct use_item *item_ptr; -short Booleans[]; -short Numbers[]; -short Strings[]; +handle_use(struct use_item *item_ptr, long entry_offset, + short Booleans[], short Numbers[], short Strings[]) { struct _bool_struct use_bools; struct _num_struct use_nums; @@ -848,8 +852,8 @@ short Strings[]; sprintf(filename, "%c/%s", curr_token.tk_valstring[0], curr_token.tk_valstring); - if (stat64(filename, &statbuf) < 0 || - part2 == 0 && statbuf.st_mtime < start_time) { + if ((stat64(filename, &statbuf) < 0) || + (part2 == 0 && statbuf.st_mtime < start_time)) { DEBUG(2, "Forward USE to %s", curr_token.tk_valstring); if (item_ptr == NULL) { @@ -865,11 +869,13 @@ short Strings[]; filename); for (i = 0; i < BoolCount; i++) { - if (Booleans[i] == FALSE) - if (UB[i] == TRUE) /* now true */ + if (Booleans[i] == FALSE) { + if (UB[i] == TRUE) { /* now true */ Booleans[i] = TRUE; - else if (UB[i] > TRUE) /* cancelled */ + } else if (UB[i] > TRUE) { /* cancelled */ Booleans[i] = -2; + } + } } for (i = 0; i < NumCount; i++) { @@ -878,11 +884,13 @@ short Strings[]; } for (i = 0; i < StrCount; i++) { - if (Strings[i] == -1) - if (US[i] == (char *)-1) + if (Strings[i] == -1) { + if (US[i] == (char *)-1) { Strings[i] = -2; - else if (US[i] != (char *)0) + } else if (US[i] != (char *)0) { Strings[i] = save_str(US[i]); + } + } } } diff --git a/usr/src/cmd/tic/tic_read.c b/usr/src/cmd/tic/tic_read.c index b6acd1d7ce..b1d017cb15 100644 --- a/usr/src/cmd/tic/tic_read.c +++ b/usr/src/cmd/tic/tic_read.c @@ -38,8 +38,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ******************************************************************** * COPYRIGHT NOTICE * @@ -91,7 +89,12 @@ #include <sys/types.h> #include <sys/stat.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include <fcntl.h> #include <stdlib.h> +#include <unistd.h> #include "curses_inc.h" #include "object.h" @@ -115,12 +118,15 @@ static char TermNames[128]; /* Buffer for terminal names for first term */ static char StringTable[2048]; /* String table for first terminal */ static int beencalled = 0; /* read_entry has been called before */ +extern void err_abort(char *, ...); +extern void syserr_abort(char *, ...); +extern void warning(char *, ...); + +int must_swap(void); + int -read_entry(filename, bptr, nptr, sptr) -char *filename; -struct _bool_struct *bptr; -struct _num_struct *nptr; -struct _str_struct *sptr; +read_entry(char *filename, struct _bool_struct *bptr, struct _num_struct *nptr, + struct _str_struct *sptr) { int fd; int numread; diff --git a/usr/src/cmd/tic/tic_scan.c b/usr/src/cmd/tic/tic_scan.c index c0f748f27f..460394aa99 100644 --- a/usr/src/cmd/tic/tic_scan.c +++ b/usr/src/cmd/tic/tic_scan.c @@ -90,6 +90,9 @@ #define iswhite(ch) (ch == ' ' || ch == '\t') +extern void err_abort(char *, ...); +extern void syserr_abort(char *, ...); +extern void warning(char *, ...); static int first_column; /* See 'next_char()' below */ @@ -128,7 +131,6 @@ void panic_mode(int); * EOF The end of the file has been reached. * */ - int get_token() { |
