Skip to content

Commit

Permalink
README: Add warnings about file contents being deleted
Browse files Browse the repository at this point in the history
main.c: make an error being output to stderr instead of stdout
  • Loading branch information
EinBaum committed Mar 10, 2018
1 parent 65faf19 commit 1cc715d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 EinBaum
Copyright (c) 2017-2018 EinBaum

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 4 additions & 0 deletions README.base
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ cat spag.c | spaghetti -d > main2.c
# Same as above
spaghetti -d -i spag.c -o main2.c
```

Warning #1: The output file is either created or cleared if it exists. Previous contents are lost!

Warning #2: Do not use a file as both input and output file. The file contents will be deleted before the file can be spaghettified.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ cat spag.c | spaghetti -d > main2.c
# Same as above
spaghetti -d -i spag.c -o main2.c
```

Warning #1: The output file is either created or cleared if it exists. Previous contents are lost!

Warning #2: Do not use a file as both input and output file. The file contents will be deleted before the file can be spaghettified.
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ int main(int argc, char **argv) {

int selected = (opt_print + opt_spaghettify + opt_despaghettify);
if (selected > 1) {
printf("Too many options selected\n");
exit(0);
fprintf(stderr, "Too many options selected\n");
exit(1);
} else if (selected == 0) {
opt_spaghettify = 1;
}
Expand Down

0 comments on commit 1cc715d

Please sign in to comment.