Email List: Xaustin-group-lX
[All Lists]

Re: [1003.1(2008)/Issue 7 0000177]: mismatch between example description

To: noreply@xxxxxxxxxxxxx, austin-group-l@xxxxxxxxxxxxx
Subject: Re: [1003.1(2008)/Issue 7 0000177]: mismatch between example descriptionand code
From: shwaresyst@xxxxxxx
Date: Wed, 04 Nov 2009 14:40:38 -0500
Problem: line_max is declared as long. To use it as the array limit declarator it would have to be '#define line_max =0;' but then sysconf() couldn't be used to assign its runtime value. Suggested fix: change the line[line_max] declaration to 'char *line;' declaration with a malloc()/free() pair to assign line a value.


-----Original Message-----
From: Austin Group Bug Tracker <noreply@xxxxxx>
To: austin-group-l@xxxxxx
Sent: Wed, Nov 4, 2009 1:56 pm
Subject: [1003.1(2008)/Issue 7 0000177]: mismatch between example description and code











A NOTE has been added to this issue.
======================================================================
http://austingroupbugs.net/view.php?id=177
======================================================================
Reported By: Don Cragun
Assigned To: ajosey
======================================================================
Project: 1003.1(2008)/Issue 7
Issue ID: 177
Category: System Interfaces
Type: Error
Severity: Editorial
Priority: normal
Status: Under Review
Name: Don Cragun
Organization: N/A
User Reference: strtok() example
Section: strtok()
Page Number: 2041
Line Number: 64700-64701
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2009-11-03 22:32 UTC
Last Modified: 2009-11-04 18:56 UTC
======================================================================
Summary: mismatch between example description and code
======================================================================

----------------------------------------------------------------------
(0000278) nick (manager) - 2009-11-04 18:56
http://austingroupbugs.net/view.php?id=177#c278
----------------------------------------------------------------------
A better example:

<pre>
#include <stdio.h>
#include <limits.h>
#include <unistd.h>

void f()
{
long line_max;
FILE *fp;
...
if ((line_max = sysconf(_SC_LINE_MAX)) <= 0) {
line_max = LINE_MAX;
}
char line[line_max];
while (fgets(line, line_max, fp) != NULL) {
...
}
return;
}

</pre>

Issue History
Date Modified Username Field Change
======================================================================
2009-11-03 22:32 Don Cragun New Issue
2009-11-03 22:32 Don Cragun Status New => Under Review
2009-11-03 22:32 Don Cragun Assigned To => ajosey
2009-11-03 22:32 Don Cragun Name => Don Cragun
2009-11-03 22:32 Don Cragun Organization => N/A
2009-11-03 22:32 Don Cragun User Reference => strtok() example
2009-11-03 22:32 Don Cragun Section => strtok()
2009-11-03 22:32 Don Cragun Page Number => 2041
2009-11-03 22:32 Don Cragun Line Number => 64700-64701
2009-11-03 22:32 Don Cragun Interp Status => ---
2009-11-04 09:54 geoffclare Note Added: 0000277
2009-11-04 18:56 nick Note Added: 0000278
======================================================================






<Prev in Thread] Current Thread [Next in Thread>