linux comp
This commit is contained in:
parent
003e7a740c
commit
a250dd83d4
23
.editorconfig
Normal file
23
.editorconfig
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[{*.c,*.h}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[README]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[indent.1]
|
||||||
|
indent_size = unset
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
indent
|
3
Makefile
3
Makefile
@ -3,4 +3,5 @@
|
|||||||
PROG= indent
|
PROG= indent
|
||||||
SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c
|
SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
$(PROG): $(SRCS)
|
||||||
|
# .include <bsd.prog.mk>
|
||||||
|
6
args.c
6
args.c
@ -168,7 +168,11 @@ set_profile(void)
|
|||||||
home = getenv("HOME");
|
home = getenv("HOME");
|
||||||
if (home != NULL && *home != '\0') {
|
if (home != NULL && *home != '\0') {
|
||||||
if (snprintf(fname, sizeof fname, "%s/%s", home, prof) >= sizeof fname) {
|
if (snprintf(fname, sizeof fname, "%s/%s", home, prof) >= sizeof fname) {
|
||||||
warnc(ENAMETOOLONG, "%s/%s", home, prof);
|
#if defined(__linux__)
|
||||||
|
printf("%s/%s", home, prof); // FIXIT
|
||||||
|
#else
|
||||||
|
warnc(ENAMETOOLONG, "%s/%s", home, prof);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((f = fopen(option_source = fname, "r")) != NULL) {
|
if ((f = fopen(option_source = fname, "r")) != NULL) {
|
||||||
|
20
indent.c
20
indent.c
@ -202,8 +202,12 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
int last_else = 0; /* true iff last keyword was an else */
|
int last_else = 0; /* true iff last keyword was an else */
|
||||||
|
|
||||||
if (pledge("stdio rpath wpath cpath", NULL) == -1)
|
#if defined(__linux__)
|
||||||
err(1, "pledge");
|
//
|
||||||
|
#else
|
||||||
|
if (pledge("stdio rpath wpath cpath", NULL) == -1)
|
||||||
|
err(1, "pledge");
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------*\
|
/*-----------------------------------------------*\
|
||||||
| INITIALIZATION |
|
| INITIALIZATION |
|
||||||
@ -1305,7 +1309,11 @@ bakcopy(void)
|
|||||||
if (*p == '/')
|
if (*p == '/')
|
||||||
p++;
|
p++;
|
||||||
if (snprintf(bakfile, PATH_MAX, "%s.BAK", p) >= PATH_MAX)
|
if (snprintf(bakfile, PATH_MAX, "%s.BAK", p) >= PATH_MAX)
|
||||||
errc(1, ENAMETOOLONG, "%s.BAK", p);
|
#if defined(__linux__)
|
||||||
|
printf("%s.BAK", p); // FIXIT
|
||||||
|
#else
|
||||||
|
errc(1, ENAMETOOLONG, "%s.BAK", p);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* copy in_name to backup file */
|
/* copy in_name to backup file */
|
||||||
bakchn = open(bakfile, O_CREAT | O_TRUNC | O_WRONLY, 0600);
|
bakchn = open(bakfile, O_CREAT | O_TRUNC | O_WRONLY, 0600);
|
||||||
@ -1328,6 +1336,10 @@ bakcopy(void)
|
|||||||
if (output == NULL) {
|
if (output == NULL) {
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
unlink(bakfile);
|
unlink(bakfile);
|
||||||
errc(1, saved_errno, "%s", in_name);
|
#if defined(__linux__)
|
||||||
|
printf("%s", in_name); // FIXIT
|
||||||
|
#else
|
||||||
|
errc(1, saved_errno, "%s", in_name);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
lexi.c
3
lexi.c
@ -297,7 +297,8 @@ lexi(void)
|
|||||||
while (tp < buf_end)
|
while (tp < buf_end)
|
||||||
if (*tp++ == ')' && (*tp == ';' || *tp == ','))
|
if (*tp++ == ')' && (*tp == ';' || *tp == ','))
|
||||||
goto not_proc;
|
goto not_proc;
|
||||||
strlcpy(ps.procname, token, sizeof ps.procname);
|
strncpy(ps.procname, token, sizeof ps.procname);
|
||||||
|
// strlcpy(ps.procname, token, sizeof ps.procname);
|
||||||
ps.in_parameter_declaration = 1;
|
ps.in_parameter_declaration = 1;
|
||||||
rparen_count = 1;
|
rparen_count = 1;
|
||||||
not_proc:;
|
not_proc:;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user