Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warnings for bare CR in line endings #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crossassemblers/macro1/macro1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,7 @@ void readLine()
WORD32 ix;
WORD32 iy;
char inpline[LINELEN];
char *ch;

/* XXX panic if nrepeats > 0 (if self-feeding, do the backup here?) */

Expand Down Expand Up @@ -1875,7 +1876,9 @@ void readLine()
lineno++; /* Count lines read. */
listed = FALSE; /* Mark as not listed. */
READ_LINE:
if(( fgets( inpline, LINELEN - 1, infile )) == NULL ) {
if(( fgets( inpline, LINELEN - 1, infile )) == NULL || ((ch = strchr(inpline, '\r')) != NULL && ch[1] != '\n')) {
if ( (ch = strchr(inpline, '\r')) != NULL && ch[1] != '\n' && pass == 1)
fprintf( stderr, "%s: bare CR found in %s; check your line endings\n", save_argv[0], save_argv[filix_curr]);
filix_curr++; /* Advance to next file. */
if( filix_curr < save_argc ) { /* More files? */
fclose( infile );
Expand Down