summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/indent/args.c147
-rw-r--r--usr.bin/indent/indent.c71
-rw-r--r--usr.bin/indent/indent_globs.h4
-rw-r--r--usr.bin/indent/io.c17
-rw-r--r--usr.bin/indent/lexi.c68
-rw-r--r--usr.bin/indent/parse.c8
-rw-r--r--usr.bin/indent/pr_comment.c14
7 files changed, 174 insertions, 155 deletions
diff --git a/usr.bin/indent/args.c b/usr.bin/indent/args.c
index b7abbf77cf5..c7547903b16 100644
--- a/usr.bin/indent/args.c
+++ b/usr.bin/indent/args.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: args.c,v 1.3 1996/10/28 00:36:23 millert Exp $ */
+/* $OpenBSD: args.c,v 1.4 1997/07/25 22:00:44 mickey Exp $ */
/*
* Copyright (c) 1985 Sun Microsystems, Inc.
@@ -37,7 +37,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)args.c 5.10 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$OpenBSD: args.c,v 1.3 1996/10/28 00:36:23 millert Exp $";
+static char rcsid[] = "$OpenBSD: args.c,v 1.4 1997/07/25 22:00:44 mickey Exp $";
#endif /* not lint */
/*
@@ -51,6 +51,7 @@ static char rcsid[] = "$OpenBSD: args.c,v 1.3 1996/10/28 00:36:23 millert Exp $"
#include <string.h>
#include <errno.h>
#include "indent_globs.h"
+#include <err.h>
/* profile types */
#define PRO_SPECIAL 1 /* special case */
@@ -84,77 +85,85 @@ struct pro {
int *p_obj; /* the associated variable */
} pro[] = {
- "T", PRO_SPECIAL, 0, KEY, 0,
- "bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation,
- "badp", PRO_BOOL, false, ON, &blanklines_after_declarations_at_proctop,
- "bad", PRO_BOOL, false, ON, &blanklines_after_declarations,
- "bap", PRO_BOOL, false, ON, &blanklines_after_procs,
- "bbb", PRO_BOOL, false, ON, &blanklines_before_blockcomments,
- "bc", PRO_BOOL, true, OFF, &ps.leave_comma,
- "bl", PRO_BOOL, true, OFF, &btype_2,
- "br", PRO_BOOL, true, ON, &btype_2,
- "bs", PRO_BOOL, false, ON, &Bill_Shannon,
- "cdb", PRO_BOOL, true, ON, &comment_delimiter_on_blankline,
- "cd", PRO_INT, 0, 0, &ps.decl_com_ind,
- "ce", PRO_BOOL, true, ON, &cuddle_else,
- "ci", PRO_INT, 0, 0, &continuation_indent,
- "cli", PRO_SPECIAL, 0, CLI, 0,
- "c", PRO_INT, 33, 0, &ps.com_ind,
- "di", PRO_INT, 16, 0, &ps.decl_indent,
- "dj", PRO_BOOL, false, ON, &ps.ljust_decl,
- "d", PRO_INT, 0, 0, &ps.unindent_displace,
- "eei", PRO_BOOL, false, ON, &extra_expression_indent,
- "ei", PRO_BOOL, true, ON, &ps.else_if,
- "fbc", PRO_FONT, 0, 0, (int *) &blkcomf,
- "fbx", PRO_FONT, 0, 0, (int *) &boxcomf,
- "fb", PRO_FONT, 0, 0, (int *) &bodyf,
- "fc1", PRO_BOOL, true, ON, &format_col1_comments,
- "fc", PRO_FONT, 0, 0, (int *) &scomf,
- "fk", PRO_FONT, 0, 0, (int *) &keywordf,
- "fs", PRO_FONT, 0, 0, (int *) &stringf,
- "ip", PRO_BOOL, true, ON, &ps.indent_parameters,
- "i", PRO_INT, 8, 0, &ps.ind_size,
- "lc", PRO_INT, 0, 0, &block_comment_max_col,
- "lp", PRO_BOOL, true, ON, &lineup_to_parens,
- "l", PRO_INT, 78, 0, &max_col,
- "nbacc", PRO_BOOL, false, OFF, &blanklines_around_conditional_compilation,
- "nbadp", PRO_BOOL, false, OFF, &blanklines_after_declarations_at_proctop,
- "nbad", PRO_BOOL, false, OFF, &blanklines_after_declarations,
- "nbap", PRO_BOOL, false, OFF, &blanklines_after_procs,
- "nbbb", PRO_BOOL, false, OFF, &blanklines_before_blockcomments,
- "nbc", PRO_BOOL, true, ON, &ps.leave_comma,
- "nbs", PRO_BOOL, false, OFF, &Bill_Shannon,
- "ncdb", PRO_BOOL, true, OFF, &comment_delimiter_on_blankline,
- "nce", PRO_BOOL, true, OFF, &cuddle_else,
- "ndj", PRO_BOOL, false, OFF, &ps.ljust_decl,
- "neei", PRO_BOOL, false, OFF, &extra_expression_indent,
- "nei", PRO_BOOL, true, OFF, &ps.else_if,
- "nfc1", PRO_BOOL, true, OFF, &format_col1_comments,
- "nip", PRO_BOOL, true, OFF, &ps.indent_parameters,
- "nlp", PRO_BOOL, true, OFF, &lineup_to_parens,
- "npcs", PRO_BOOL, false, OFF, &proc_calls_space,
- "npro", PRO_SPECIAL, 0, IGN, 0,
- "npsl", PRO_BOOL, true, OFF, &procnames_start_line,
- "nps", PRO_BOOL, false, OFF, &pointer_as_binop,
- "nsc", PRO_BOOL, true, OFF, &star_comment_cont,
- "nsob", PRO_BOOL, false, OFF, &swallow_optional_blanklines,
- "nv", PRO_BOOL, false, OFF, &verbose,
- "pcs", PRO_BOOL, false, ON, &proc_calls_space,
- "psl", PRO_BOOL, true, ON, &procnames_start_line,
- "ps", PRO_BOOL, false, ON, &pointer_as_binop,
- "sc", PRO_BOOL, true, ON, &star_comment_cont,
- "sob", PRO_BOOL, false, ON, &swallow_optional_blanklines,
- "st", PRO_SPECIAL, 0, STDIN, 0,
- "troff", PRO_BOOL, false, ON, &troff,
- "v", PRO_BOOL, false, ON, &verbose,
- /* whew! */
- 0, 0, 0, 0, 0
+ { "T", PRO_SPECIAL, 0, KEY, 0 },
+ {"bacc", PRO_BOOL, false, ON,
+ &blanklines_around_conditional_compilation },
+ {"badp", PRO_BOOL, false, ON,
+ &blanklines_after_declarations_at_proctop },
+ {"bad", PRO_BOOL, false, ON, &blanklines_after_declarations },
+ {"bap", PRO_BOOL, false, ON, &blanklines_after_procs },
+ {"bbb", PRO_BOOL, false, ON, &blanklines_before_blockcomments },
+ {"bc", PRO_BOOL, true, OFF, &ps.leave_comma },
+ {"bl", PRO_BOOL, true, OFF, &btype_2 },
+ {"br", PRO_BOOL, true, ON, &btype_2 },
+ {"bs", PRO_BOOL, false, ON, &Bill_Shannon },
+ {"cdb", PRO_BOOL, true, ON, &comment_delimiter_on_blankline },
+ {"cd", PRO_INT, 0, 0, &ps.decl_com_ind },
+ {"ce", PRO_BOOL, true, ON, &cuddle_else },
+ {"ci", PRO_INT, 0, 0, &continuation_indent },
+ {"cli", PRO_SPECIAL, 0, CLI, 0 },
+ {"c", PRO_INT, 33, 0, &ps.com_ind },
+ {"di", PRO_INT, 16, 0, &ps.decl_indent },
+ {"dj", PRO_BOOL, false, ON, &ps.ljust_decl },
+ {"d", PRO_INT, 0, 0, &ps.unindent_displace },
+ {"eei", PRO_BOOL, false, ON, &extra_expression_indent },
+ {"ei", PRO_BOOL, true, ON, &ps.else_if },
+ {"fbc", PRO_FONT, 0, 0, (int *) &blkcomf },
+ {"fbx", PRO_FONT, 0, 0, (int *) &boxcomf },
+ {"fb", PRO_FONT, 0, 0, (int *) &bodyf },
+ {"fc1", PRO_BOOL, true, ON, &format_col1_comments },
+ {"fc", PRO_FONT, 0, 0, (int *) &scomf },
+ {"fk", PRO_FONT, 0, 0, (int *) &keywordf },
+ {"fs", PRO_FONT, 0, 0, (int *) &stringf },
+ {"ip", PRO_BOOL, true, ON, &ps.indent_parameters },
+ {"i", PRO_INT, 8, 0, &ps.ind_size },
+ {"lc", PRO_INT, 0, 0, &block_comment_max_col },
+ {"lp", PRO_BOOL, true, ON, &lineup_to_parens },
+ {"l", PRO_INT, 78, 0, &max_col },
+ {"nbacc", PRO_BOOL, false, OFF,
+ &blanklines_around_conditional_compilation },
+ {"nbadp", PRO_BOOL, false, OFF,
+ &blanklines_after_declarations_at_proctop },
+ {"nbad", PRO_BOOL, false, OFF, &blanklines_after_declarations },
+ {"nbap", PRO_BOOL, false, OFF, &blanklines_after_procs },
+ {"nbbb", PRO_BOOL, false, OFF, &blanklines_before_blockcomments },
+ {"nbc", PRO_BOOL, true, ON, &ps.leave_comma },
+ {"nbs", PRO_BOOL, false, OFF, &Bill_Shannon },
+ {"ncdb", PRO_BOOL, true, OFF, &comment_delimiter_on_blankline },
+ {"nce", PRO_BOOL, true, OFF, &cuddle_else },
+ {"ndj", PRO_BOOL, false, OFF, &ps.ljust_decl },
+ {"neei", PRO_BOOL, false, OFF, &extra_expression_indent },
+ {"nei", PRO_BOOL, true, OFF, &ps.else_if },
+ {"nfc1", PRO_BOOL, true, OFF, &format_col1_comments },
+ {"nip", PRO_BOOL, true, OFF, &ps.indent_parameters },
+ {"nlp", PRO_BOOL, true, OFF, &lineup_to_parens },
+ {"npcs", PRO_BOOL, false, OFF, &proc_calls_space },
+ {"npro", PRO_SPECIAL, 0, IGN, 0 },
+ {"npsl", PRO_BOOL, true, OFF, &procnames_start_line },
+ {"nps", PRO_BOOL, false, OFF, &pointer_as_binop },
+ {"nsc", PRO_BOOL, true, OFF, &star_comment_cont },
+ {"nsob", PRO_BOOL, false, OFF, &swallow_optional_blanklines },
+ {"nv", PRO_BOOL, false, OFF, &verbose },
+ {"pcs", PRO_BOOL, false, ON, &proc_calls_space },
+ {"psl", PRO_BOOL, true, ON, &procnames_start_line },
+ {"ps", PRO_BOOL, false, ON, &pointer_as_binop },
+ {"sc", PRO_BOOL, true, ON, &star_comment_cont },
+ {"sob", PRO_BOOL, false, ON, &swallow_optional_blanklines },
+ {"st", PRO_SPECIAL, 0, STDIN, 0 },
+ {"troff", PRO_BOOL, false, ON, &troff },
+ {"v", PRO_BOOL, false, ON, &verbose },
+ /* whew! */
+ { 0, 0, 0, 0, 0 }
};
+void scan_profile();
+void set_option();
+
/*
* set_profile reads $HOME/.indent.pro and ./.indent.pro and handles arguments
* given in these files.
*/
+void
set_profile()
{
register FILE *f;
@@ -177,6 +186,7 @@ set_profile()
option_source = "Command line";
}
+void
scan_profile(f)
register FILE *f;
{
@@ -199,6 +209,7 @@ scan_profile(f)
char *param_start;
+int
eqin(s1, s2)
register char *s1;
register char *s2;
@@ -214,6 +225,7 @@ eqin(s1, s2)
/*
* Set the defaults.
*/
+void
set_defaults()
{
register struct pro *p;
@@ -228,6 +240,7 @@ set_defaults()
*p->p_obj = p->p_default;
}
+void
set_option(arg)
register char *arg;
{
diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c
index 44fcf259b99..6a01ee249c3 100644
--- a/usr.bin/indent/indent.c
+++ b/usr.bin/indent/indent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: indent.c,v 1.3 1996/06/26 05:34:29 deraadt Exp $ */
+/* $OpenBSD: indent.c,v 1.4 1997/07/25 22:00:45 mickey Exp $ */
/*
* Copyright (c) 1985 Sun Microsystems, Inc.
@@ -45,7 +45,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)indent.c 5.16 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$OpenBSD: indent.c,v 1.3 1996/06/26 05:34:29 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: indent.c,v 1.4 1997/07/25 22:00:45 mickey Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -58,6 +58,7 @@ static char rcsid[] = "$OpenBSD: indent.c,v 1.3 1996/06/26 05:34:29 deraadt Exp
#include "indent_codes.h"
#include <ctype.h>
#include <errno.h>
+#include <err.h>
char *in_name = "Standard Input"; /* will always point to name of input
* file */
@@ -65,6 +66,9 @@ char *out_name = "Standard Output"; /* will always point to name
* of output file */
char bakfile[MAXPATHLEN] = "";
+void bakcopy();
+
+int
main(argc, argv)
int argc;
char **argv;
@@ -185,33 +189,28 @@ main(argc, argv)
if (input == 0) { /* we must have the input file */
in_name = argv[i]; /* remember name of input file */
input = fopen(in_name, "r");
- if (input == 0) /* check for open error */
- err(in_name);
+ if (input == NULL) /* check for open error */
+ err(1, in_name);
continue;
}
else if (output == 0) { /* we have the output file */
out_name = argv[i]; /* remember name of output file */
- if (strcmp(in_name, out_name) == 0) { /* attempt to overwrite
+ if (strcmp(in_name, out_name) == 0) /* attempt to overwrite
* the file */
- fprintf(stderr, "indent: input and output files must be different\n");
- exit(1);
- }
+ errx(1, "input and output files must be different\n");
output = fopen(out_name, "w");
- if (output == 0) /* check for create error */
- err(out_name);
+ if (output == NULL) /* check for create error */
+ err(1, out_name);
continue;
}
- fprintf(stderr, "indent: unknown parameter: %s\n", argv[i]);
- exit(1);
+ errx(1, "unknown parameter: %s\n", argv[i]);
}
else
set_option(argv[i]);
} /* end of for */
- if (input == 0) {
- fprintf(stderr, "indent: usage: indent file [ outfile ] [ options ]\n");
- exit(1);
- }
- if (output == 0)
+ if (input == NULL)
+ errx(1, "usage: indent file [ outfile ] [ options ]\n");
+ if (output == NULL)
if (troff)
output = stdout;
else {
@@ -246,7 +245,7 @@ main(argc, argv)
ps.decl_com_ind = ps.ljust_decl ? (ps.com_ind <= 10 ? 2 : ps.com_ind - 8) : ps.com_ind;
if (continuation_indent == 0)
continuation_indent = ps.ind_size;
- fill_buffer(); /* get first batch of stuff into input buffer */
+ fill_buffer(); /* get first batch of stuff into input buffer */
parse(semicolon);
{
@@ -362,11 +361,11 @@ main(argc, argv)
if (flushed_nl) /* if we flushed a newline, make sure it is
* put back */
force_nl = true;
- if (type_code == sp_paren && *token == 'i'
- && last_else && ps.else_if
- || type_code == sp_nparen && *token == 'e'
- && e_code != s_code && e_code[-1] == '}')
- force_nl = false;
+ if ((type_code == sp_paren && *token == 'i'
+ && last_else && ps.else_if) ||
+ (type_code == sp_nparen && *token == 'e'
+ && e_code != s_code && e_code[-1] == '}'))
+ force_nl = false;
if (sc_end == 0) { /* ignore buffering if comment wasnt
* saved up */
@@ -1113,7 +1112,7 @@ check_type:
break; /* subsequent processing of the newline
* character will cause the line to be printed */
- case comment: /* we have gotten a /* this is a biggie */
+ case comment: /* we have gotten a comment this is a biggie */
if (flushed_nl) { /* we should force a broken line here */
flushed_nl = false;
dump_line();
@@ -1135,6 +1134,7 @@ check_type:
* backup file will be ".Bfile" then make the backup file the input and
* original input file the output
*/
+void
bakcopy()
{
int n,
@@ -1153,30 +1153,23 @@ bakcopy()
/* copy in_name to backup file */
bakchn = creat(bakfile, 0600);
if (bakchn < 0)
- err(bakfile);
- while (n = read(fileno(input), buff, sizeof buff))
+ err(1, bakfile);
+ while ((n = read(fileno(input), buff, sizeof buff)) > 0)
if (write(bakchn, buff, n) != n)
- err(bakfile);
+ err(1, bakfile);
if (n < 0)
- err(in_name);
+ err(1, in_name);
close(bakchn);
fclose(input);
/* re-open backup file as the input file */
input = fopen(bakfile, "r");
- if (input == 0)
- err(bakfile);
+ if (input == NULL)
+ err(1, bakfile);
/* now the original input file will be the output */
output = fopen(in_name, "w");
- if (output == 0) {
+ if (output == NULL) {
unlink(bakfile);
- err(in_name);
+ err(1, in_name);
}
}
-
-err(msg)
- char *msg;
-{
- (void)fprintf(stderr, "indent: %s: %s\n", msg, strerror(errno));
- exit(1);
-}
diff --git a/usr.bin/indent/indent_globs.h b/usr.bin/indent/indent_globs.h
index 2f2b38f0410..3e7c88fd1b9 100644
--- a/usr.bin/indent/indent_globs.h
+++ b/usr.bin/indent/indent_globs.h
@@ -1,4 +1,4 @@
-/* * $OpenBSD: indent_globs.h,v 1.2 1996/06/26 05:34:30 deraadt Exp $*/
+/* * $OpenBSD: indent_globs.h,v 1.3 1997/07/25 22:00:45 mickey Exp $*/
/*
* Copyright (c) 1985 Sun Microsystems, Inc.
* Copyright (c) 1980 The Regents of the University of California.
@@ -218,7 +218,7 @@ struct parser_state {
float cstk[STACKSIZE];/* used to store case stmt indentation levels */
int box_com; /* set to true when we are in a "boxed"
* comment. In that case, the first non-blank
- * char should be lined up with the / in /* */
+ * char should be lined up with the / in rem */
int comment_delta,
n_comment_delta;
int cast_mask; /* indicates which close parens close off
diff --git a/usr.bin/indent/io.c b/usr.bin/indent/io.c
index 829ec832220..cf436ae7f97 100644
--- a/usr.bin/indent/io.c
+++ b/usr.bin/indent/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.2 1996/06/26 05:34:31 deraadt Exp $ */
+/* $OpenBSD: io.c,v 1.3 1997/07/25 22:00:46 mickey Exp $ */
/*
* Copyright (c) 1985 Sun Microsystems, Inc.
@@ -37,19 +37,21 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)io.c 5.15 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$OpenBSD: io.c,v 1.2 1996/06/26 05:34:31 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: io.c,v 1.3 1997/07/25 22:00:46 mickey Exp $";
#endif /* not lint */
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <err.h>
#include "indent_globs.h"
int comment_open;
static paren_target;
+void
dump_line()
{ /* dump_line is the routine that actually
* effects the printing of the new source. It
@@ -281,6 +283,7 @@ inhibit_newline:
return;
}
+int
compute_code_target()
{
register target_col = ps.ind_size * ps.ind_level + 1;
@@ -306,6 +309,7 @@ compute_code_target()
return target_col;
}
+int
compute_label_target()
{
return
@@ -330,7 +334,7 @@ compute_label_target()
* buffer from temporary buffer
*
*/
-int
+void
fill_buffer()
{ /* this routine reads stuff from the input */
register char *p;
@@ -351,7 +355,7 @@ fill_buffer()
register offset = p - in_buffer;
in_buffer = (char *) realloc(in_buffer, size);
if (in_buffer == 0)
- err("input line too long");
+ errx(1, "input line too long");
p = in_buffer + offset;
in_buffer_limit = in_buffer + size - 2;
}
@@ -445,6 +449,7 @@ fill_buffer()
* HISTORY: initial coding November 1976 D A Willcox of CAC
*
*/
+int
pad_output(current, target) /* writes tabs and blanks (if necessary) to
* get the current output position up to the
* target column */
@@ -530,6 +535,7 @@ count_spaces(current, buffer)
int found_err;
/* VARARGS2 */
+void
diag(level, msg, a, b)
char *msg;
{
@@ -547,6 +553,7 @@ diag(level, msg, a, b)
}
}
+void
writefdef(f, nm)
register struct fstate *f;
{
@@ -587,7 +594,7 @@ chfont(of, nf, s)
return s;
}
-
+void
parsefont(f, s0)
register struct fstate *f;
char *s0;
diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c
index 2b5b96e19bb..fb6ba7fd24f 100644
--- a/usr.bin/indent/lexi.c
+++ b/usr.bin/indent/lexi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lexi.c,v 1.2 1996/06/26 05:34:31 deraadt Exp $ */
+/* $OpenBSD: lexi.c,v 1.3 1997/07/25 22:00:46 mickey Exp $ */
/*
* Copyright (c) 1985 Sun Microsystems, Inc.
@@ -37,7 +37,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)lexi.c 5.16 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$OpenBSD: lexi.c,v 1.2 1996/06/26 05:34:31 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: lexi.c,v 1.3 1997/07/25 22:00:46 mickey Exp $";
#endif /* not lint */
/*
@@ -63,35 +63,35 @@ struct templ {
struct templ specials[100] =
{
- "switch", 1,
- "case", 2,
- "break", 0,
- "struct", 3,
- "union", 3,
- "enum", 3,
- "default", 2,
- "int", 4,
- "char", 4,
- "float", 4,
- "double", 4,
- "long", 4,
- "short", 4,
- "typdef", 4,
- "unsigned", 4,
- "register", 4,
- "static", 4,
- "global", 4,
- "extern", 4,
- "void", 4,
- "goto", 0,
- "return", 0,
- "if", 5,
- "while", 5,
- "for", 5,
- "else", 6,
- "do", 6,
- "sizeof", 7,
- 0, 0
+ { "switch", 1 },
+ { "case", 2 },
+ { "break", 0 },
+ { "struct", 3 },
+ { "union", 3 },
+ { "enum", 3 },
+ { "default", 2 },
+ { "int", 4 },
+ { "char", 4 },
+ { "float", 4 },
+ { "double", 4 },
+ { "long", 4 },
+ { "short", 4 },
+ { "typdef", 4 },
+ { "unsigned", 4 },
+ { "register", 4 },
+ { "static", 4 },
+ { "global", 4 },
+ { "extern", 4 },
+ { "void", 4 },
+ { "goto", 0 },
+ { "return", 0 },
+ { "if", 5 },
+ { "while", 5 },
+ { "for", 5 },
+ { "else", 6 },
+ { "do", 6 },
+ { "sizeof", 7 },
+ { 0, 0 }
};
char chartype[128] =
@@ -144,7 +144,8 @@ lexi()
}
/* Scan an alphanumeric token */
- if (chartype[*buf_ptr] == alphanum || buf_ptr[0] == '.' && isdigit(buf_ptr[1])) {
+ if (chartype[*buf_ptr] == alphanum ||
+ (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) {
/*
* we have a character or number
*/
@@ -153,7 +154,7 @@ lexi()
* reserved words */
register struct templ *p;
- if (isdigit(*buf_ptr) || buf_ptr[0] == '.' && isdigit(buf_ptr[1])) {
+ if (isdigit(*buf_ptr) || (buf_ptr[0] == '.' && isdigit(buf_ptr[1]))) {
int seendot = 0,
seenexp = 0;
if (*buf_ptr == '0' &&
@@ -542,6 +543,7 @@ stop_lit:
/*
* Add the given keyword to the keyword table, using val as the keyword type
*/
+void
addkey(key, val)
char *key;
{
diff --git a/usr.bin/indent/parse.c b/usr.bin/indent/parse.c
index 6ce19ea84c8..cc9f46e9e2f 100644
--- a/usr.bin/indent/parse.c
+++ b/usr.bin/indent/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.2 1996/06/26 05:34:32 deraadt Exp $ */
+/* $OpenBSD: parse.c,v 1.3 1997/07/25 22:00:47 mickey Exp $ */
/*
* Copyright (c) 1985 Sun Microsystems, Inc.
@@ -37,13 +37,16 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)parse.c 5.12 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$OpenBSD: parse.c,v 1.2 1996/06/26 05:34:32 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: parse.c,v 1.3 1997/07/25 22:00:47 mickey Exp $";
#endif /* not lint */
#include <stdio.h>
#include "indent_globs.h"
#include "indent_codes.h"
+void reduce();
+
+void
parse(tk)
int tk; /* the code for the construct scanned */
{
@@ -245,6 +248,7 @@ parse(tk)
/*----------------------------------------------*\
| REDUCTION PHASE |
\*----------------------------------------------*/
+void
reduce()
{
diff --git a/usr.bin/indent/pr_comment.c b/usr.bin/indent/pr_comment.c
index dd17868a243..e3c26ce2d39 100644
--- a/usr.bin/indent/pr_comment.c
+++ b/usr.bin/indent/pr_comment.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pr_comment.c,v 1.2 1996/06/26 05:34:33 deraadt Exp $ */
+/* $OpenBSD: pr_comment.c,v 1.3 1997/07/25 22:00:47 mickey Exp $ */
/*
* Copyright (c) 1985 Sun Microsystems, Inc.
@@ -37,7 +37,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)pr_comment.c 5.12 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$OpenBSD: pr_comment.c,v 1.2 1996/06/26 05:34:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: pr_comment.c,v 1.3 1997/07/25 22:00:47 mickey Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -75,7 +75,7 @@ static char rcsid[] = "$OpenBSD: pr_comment.c,v 1.2 1996/06/26 05:34:33 deraadt
* beginning of the input line are removed
*/
-
+void
pr_comment()
{
int now_col; /* column we are in now */
@@ -86,12 +86,12 @@ pr_comment()
char *t_ptr; /* used for moving string */
int unix_comment; /* tri-state variable used to decide if it is
* a unix-style comment. 0 means only blanks
- * since /*, 1 means regular style comment, 2
+ * since / *, 1 means regular style comment, 2
* means unix style comment */
int break_delim = comment_delimiter_on_blankline;
int l_just_saw_decl = ps.just_saw_decl;
/*
- * int ps.last_nl = 0; /* true iff the last significant thing
+ * int ps.last_nl = 0; true iff the last significant thing
* weve seen is a newline
*/
int one_liner = 1; /* true iff this comment is a one-liner */
@@ -116,7 +116,7 @@ pr_comment()
else {
if (*buf_ptr == '-' || *buf_ptr == '*' || *buf_ptr == '\n') {
ps.box_com = true; /* a comment with a '-', '*' or newline
- * immediately after the /* is assumed to be
+ * immediately after the / * is assumed to be
* a boxed comment */
break_delim = 0;
}
@@ -159,7 +159,7 @@ pr_comment()
buf_ptr++;
}
ps.comment_delta = 0;
- *e_com++ = '/'; /* put '/*' into buffer */
+ *e_com++ = '/'; /* put '/ *' into buffer */
*e_com++ = '*';
if (*buf_ptr != ' ' && !ps.box_com)
*e_com++ = ' ';