mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-07 09:00:28 +00:00
Some amount of style(9)
-- function definitions, header ordering, and $FreeBSD$.
This commit is contained in:
parent
675cf9154b
commit
02c751922e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=237625
|
@ -22,8 +22,6 @@
|
|||
* Author: James da Silva, Systems Design and Analysis Group
|
||||
* Computer Science Department
|
||||
* University of Maryland at College Park
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
/*
|
||||
* crunched_main.c - main program for crunched binaries, it branches to a
|
||||
|
@ -33,6 +31,10 @@
|
|||
* or calls one of them based on argv[1]. This allows the testing of
|
||||
* the crunched binary without creating all the links.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -45,7 +47,8 @@ struct stub {
|
|||
extern char *__progname;
|
||||
extern struct stub entry_points[];
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
int
|
||||
main(int argc, char **argv, char **envp)
|
||||
{
|
||||
char *slash, *basename;
|
||||
struct stub *ep;
|
||||
|
@ -68,7 +71,8 @@ int main(int argc, char **argv, char **envp)
|
|||
}
|
||||
|
||||
|
||||
int crunched_here(char *path)
|
||||
int
|
||||
crunched_here(char *path)
|
||||
{
|
||||
char *slash, *basename;
|
||||
struct stub *ep;
|
||||
|
@ -83,7 +87,8 @@ int crunched_here(char *path)
|
|||
}
|
||||
|
||||
|
||||
int crunched_main(int argc, char **argv, char **envp)
|
||||
int
|
||||
crunched_main(int argc, char **argv, char **envp)
|
||||
{
|
||||
char *slash;
|
||||
struct stub *ep;
|
||||
|
@ -99,7 +104,8 @@ int crunched_main(int argc, char **argv, char **envp)
|
|||
}
|
||||
|
||||
|
||||
int crunched_usage()
|
||||
int
|
||||
crunched_usage()
|
||||
{
|
||||
int columns, len;
|
||||
struct stub *ep;
|
||||
|
@ -122,4 +128,3 @@ int crunched_usage()
|
|||
}
|
||||
|
||||
/* end of crunched_main.c */
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
* Author: James da Silva, Systems Design and Analysis Group
|
||||
* Computer Science Department
|
||||
* University of Maryland at College Park
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
/*
|
||||
* ========================================================================
|
||||
|
@ -32,9 +30,12 @@
|
|||
* Generates a Makefile and main C file for a crunched executable,
|
||||
* from specs given in a .conf file.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
|
@ -119,7 +120,8 @@ void parse_conf_file(void);
|
|||
void gen_outputs(void);
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *p;
|
||||
int optc;
|
||||
|
@ -223,7 +225,8 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
void usage(void)
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "%s%s\n\t%s%s\n", "usage: crunchgen [-foq] ",
|
||||
"[-h <makefile-header-name>] [-m <makefile>]",
|
||||
|
@ -255,7 +258,8 @@ prog_t *find_prog(char *str);
|
|||
void add_prog(char *progname);
|
||||
|
||||
|
||||
void parse_conf_file(void)
|
||||
void
|
||||
parse_conf_file(void)
|
||||
{
|
||||
if (!is_nonempty_file(infilename))
|
||||
errx(1, "fatal: input file \"%s\" not found", infilename);
|
||||
|
@ -268,7 +272,8 @@ void parse_conf_file(void)
|
|||
}
|
||||
|
||||
|
||||
void parse_one_file(char *filename)
|
||||
void
|
||||
parse_one_file(char *filename)
|
||||
{
|
||||
char *fieldv[MAXFIELDS];
|
||||
int fieldc;
|
||||
|
@ -334,7 +339,8 @@ void parse_one_file(char *filename)
|
|||
}
|
||||
|
||||
|
||||
void parse_line(char *line, int *fc, char **fv, int nf)
|
||||
void
|
||||
parse_line(char *line, int *fc, char **fv, int nf)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
@ -365,7 +371,8 @@ void parse_line(char *line, int *fc, char **fv, int nf)
|
|||
}
|
||||
|
||||
|
||||
void add_srcdirs(int argc, char **argv)
|
||||
void
|
||||
add_srcdirs(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -381,7 +388,8 @@ void add_srcdirs(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
void add_progs(int argc, char **argv)
|
||||
void
|
||||
add_progs(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -390,7 +398,8 @@ void add_progs(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
void add_prog(char *progname)
|
||||
void
|
||||
add_prog(char *progname)
|
||||
{
|
||||
prog_t *p1, *p2;
|
||||
|
||||
|
@ -431,7 +440,8 @@ void add_prog(char *progname)
|
|||
}
|
||||
|
||||
|
||||
void add_link(int argc, char **argv)
|
||||
void
|
||||
add_link(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
prog_t *p = find_prog(argv[1]);
|
||||
|
@ -452,7 +462,8 @@ void add_link(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
void add_libs(int argc, char **argv)
|
||||
void
|
||||
add_libs(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -466,7 +477,8 @@ void add_libs(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
void add_libs_so(int argc, char **argv)
|
||||
void
|
||||
add_libs_so(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -480,7 +492,8 @@ void add_libs_so(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
void add_buildopts(int argc, char **argv)
|
||||
void
|
||||
add_buildopts(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -489,7 +502,8 @@ void add_buildopts(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
void add_special(int argc, char **argv)
|
||||
void
|
||||
add_special(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
prog_t *p = find_prog(argv[1]);
|
||||
|
@ -591,7 +605,8 @@ char *genident(char *str);
|
|||
char *dir_search(char *progname);
|
||||
|
||||
|
||||
void gen_outputs(void)
|
||||
void
|
||||
gen_outputs(void)
|
||||
{
|
||||
prog_t *p;
|
||||
|
||||
|
@ -611,7 +626,8 @@ void gen_outputs(void)
|
|||
/*
|
||||
* run the makefile for the program to find which objects are necessary
|
||||
*/
|
||||
void fillin_program(prog_t *p)
|
||||
void
|
||||
fillin_program(prog_t *p)
|
||||
{
|
||||
char path[MAXPATHLEN];
|
||||
char line[MAXLINELEN];
|
||||
|
@ -686,7 +702,8 @@ void fillin_program(prog_t *p)
|
|||
p->goterror = 1;
|
||||
}
|
||||
|
||||
void fillin_program_objs(prog_t *p, char *path)
|
||||
void
|
||||
fillin_program_objs(prog_t *p, char *path)
|
||||
{
|
||||
char *obj, *cp;
|
||||
int fd, rc;
|
||||
|
@ -773,7 +790,8 @@ void fillin_program_objs(prog_t *p, char *path)
|
|||
unlink(tempfname);
|
||||
}
|
||||
|
||||
void remove_error_progs(void)
|
||||
void
|
||||
remove_error_progs(void)
|
||||
{
|
||||
prog_t *p1, *p2;
|
||||
|
||||
|
@ -794,7 +812,8 @@ void remove_error_progs(void)
|
|||
}
|
||||
}
|
||||
|
||||
void gen_specials_cache(void)
|
||||
void
|
||||
gen_specials_cache(void)
|
||||
{
|
||||
FILE *cachef;
|
||||
prog_t *p;
|
||||
|
@ -834,7 +853,8 @@ void gen_specials_cache(void)
|
|||
}
|
||||
|
||||
|
||||
void gen_output_makefile(void)
|
||||
void
|
||||
gen_output_makefile(void)
|
||||
{
|
||||
prog_t *p;
|
||||
FILE *outmk;
|
||||
|
@ -864,7 +884,8 @@ void gen_output_makefile(void)
|
|||
}
|
||||
|
||||
|
||||
void gen_output_cfile(void)
|
||||
void
|
||||
gen_output_cfile(void)
|
||||
{
|
||||
extern char *crunched_skel[];
|
||||
char **cp;
|
||||
|
@ -952,7 +973,8 @@ char *dir_search(char *progname)
|
|||
}
|
||||
|
||||
|
||||
void top_makefile_rules(FILE *outmk)
|
||||
void
|
||||
top_makefile_rules(FILE *outmk)
|
||||
{
|
||||
prog_t *p;
|
||||
|
||||
|
@ -1010,7 +1032,8 @@ void top_makefile_rules(FILE *outmk)
|
|||
}
|
||||
|
||||
|
||||
void prog_makefile_rules(FILE *outmk, prog_t *p)
|
||||
void
|
||||
prog_makefile_rules(FILE *outmk, prog_t *p)
|
||||
{
|
||||
strlst_t *lst;
|
||||
|
||||
|
@ -1095,7 +1118,8 @@ void prog_makefile_rules(FILE *outmk, prog_t *p)
|
|||
fprintf(outmk, "%s.lo\n", p->name);
|
||||
}
|
||||
|
||||
void output_strlst(FILE *outf, strlst_t *lst)
|
||||
void
|
||||
output_strlst(FILE *outf, strlst_t *lst)
|
||||
{
|
||||
for (; lst != NULL; lst = lst->next)
|
||||
if ( strlen(lst->str) )
|
||||
|
@ -1110,7 +1134,8 @@ void output_strlst(FILE *outf, strlst_t *lst)
|
|||
*
|
||||
*/
|
||||
|
||||
void status(char *str)
|
||||
void
|
||||
status(char *str)
|
||||
{
|
||||
static int lastlen = 0;
|
||||
int len, spaces;
|
||||
|
@ -1129,13 +1154,15 @@ void status(char *str)
|
|||
}
|
||||
|
||||
|
||||
void out_of_memory(void)
|
||||
void
|
||||
out_of_memory(void)
|
||||
{
|
||||
err(1, "%s: %d: out of memory, stopping", infilename, linenum);
|
||||
}
|
||||
|
||||
|
||||
void add_string(strlst_t **listp, char *str)
|
||||
void
|
||||
add_string(strlst_t **listp, char *str)
|
||||
{
|
||||
strlst_t *p1, *p2;
|
||||
|
||||
|
@ -1159,7 +1186,8 @@ void add_string(strlst_t **listp, char *str)
|
|||
p1->next = p2;
|
||||
}
|
||||
|
||||
int subtract_strlst(strlst_t **lista, strlst_t **listb)
|
||||
int
|
||||
subtract_strlst(strlst_t **lista, strlst_t **listb)
|
||||
{
|
||||
int subtract_count = 0;
|
||||
strlst_t *p1;
|
||||
|
@ -1172,7 +1200,8 @@ int subtract_strlst(strlst_t **lista, strlst_t **listb)
|
|||
return subtract_count;
|
||||
}
|
||||
|
||||
int in_list(strlst_t **listp, char *str)
|
||||
int
|
||||
in_list(strlst_t **listp, char *str)
|
||||
{
|
||||
strlst_t *p1;
|
||||
for (p1 = *listp; p1 != NULL; p1 = p1->next)
|
||||
|
@ -1181,7 +1210,8 @@ int in_list(strlst_t **listp, char *str)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int is_dir(char *pathname)
|
||||
int
|
||||
is_dir(char *pathname)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
|
@ -1191,7 +1221,8 @@ int is_dir(char *pathname)
|
|||
return S_ISDIR(buf.st_mode);
|
||||
}
|
||||
|
||||
int is_nonempty_file(char *pathname)
|
||||
int
|
||||
is_nonempty_file(char *pathname)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* $NetBSD: crunchide.c,v 1.8 1997/11/01 06:51:45 lukem Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (c) 1997 Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1994 University of Maryland
|
||||
|
@ -59,20 +58,22 @@
|
|||
* that the final crunched binary BSS size is the max of all the
|
||||
* component programs' BSS sizes, rather than their sum.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: crunchide.c,v 1.8 1997/11/01 06:51:45 lukem Exp $");
|
||||
#endif
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <a.out.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
|
@ -89,9 +90,8 @@ int verbose;
|
|||
|
||||
int main(int, char *[]);
|
||||
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ch, errors;
|
||||
|
||||
|
@ -127,7 +127,8 @@ char **argv;
|
|||
return errors;
|
||||
}
|
||||
|
||||
void usage(void)
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-k <symbol-name>] [-f <keep-list-file>] <files> ...\n",
|
||||
|
@ -142,7 +143,8 @@ struct keep {
|
|||
char *sym;
|
||||
} *keep_list;
|
||||
|
||||
void add_to_keep_list(char *symbol)
|
||||
void
|
||||
add_to_keep_list(char *symbol)
|
||||
{
|
||||
struct keep *newp, *prevp, *curp;
|
||||
int cmp;
|
||||
|
@ -167,7 +169,8 @@ void add_to_keep_list(char *symbol)
|
|||
else keep_list = newp;
|
||||
}
|
||||
|
||||
int in_keep_list(const char *symbol)
|
||||
int
|
||||
in_keep_list(const char *symbol)
|
||||
{
|
||||
struct keep *curp;
|
||||
int cmp;
|
||||
|
@ -180,7 +183,8 @@ int in_keep_list(const char *symbol)
|
|||
return curp && cmp == 0;
|
||||
}
|
||||
|
||||
void add_file_to_keep_list(char *filename)
|
||||
void
|
||||
add_file_to_keep_list(char *filename)
|
||||
{
|
||||
FILE *keepf;
|
||||
char symbol[1024];
|
||||
|
@ -222,7 +226,8 @@ struct {
|
|||
#endif
|
||||
};
|
||||
|
||||
int hide_syms(const char *filename)
|
||||
int
|
||||
hide_syms(const char *filename)
|
||||
{
|
||||
int fd, i, n, rv;
|
||||
|
||||
|
|
Loading…
Reference in a new issue