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
|
||||
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");
|
||||
if (home != NULL && *home != '\0') {
|
||||
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;
|
||||
}
|
||||
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 */
|
||||
|
||||
if (pledge("stdio rpath wpath cpath", NULL) == -1)
|
||||
err(1, "pledge");
|
||||
#if defined(__linux__)
|
||||
//
|
||||
#else
|
||||
if (pledge("stdio rpath wpath cpath", NULL) == -1)
|
||||
err(1, "pledge");
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------*\
|
||||
| INITIALIZATION |
|
||||
@ -1305,7 +1309,11 @@ bakcopy(void)
|
||||
if (*p == '/')
|
||||
p++;
|
||||
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 */
|
||||
bakchn = open(bakfile, O_CREAT | O_TRUNC | O_WRONLY, 0600);
|
||||
@ -1328,6 +1336,10 @@ bakcopy(void)
|
||||
if (output == NULL) {
|
||||
int saved_errno = errno;
|
||||
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)
|
||||
if (*tp++ == ')' && (*tp == ';' || *tp == ','))
|
||||
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;
|
||||
rparen_count = 1;
|
||||
not_proc:;
|
||||
|
Loading…
Reference in New Issue
Block a user