manual: Fix missing declaration in strdupa example.

Without _GNU_SOURCE defined this file fails to compile with the
following error:

    $ gcc manual/examples/strdupa.c
    manual/examples/strdupa.c: In function ‘main’:
    manual/examples/strdupa.c:27:19: error: implicit declaration of function ‘strdupa’; did you mean ‘strdup’? [-Wimplicit-function-declaration]
       27 |   char *wr_path = strdupa (path);
          |                   ^~~~~~~
          |                   strdup
    manual/examples/strdupa.c:27:19: error: initialization of ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
Collin Funk 2025-09-28 15:17:17 -07:00
parent 0d98af2e1d
commit 8a80c7f9d7
1 changed files with 1 additions and 0 deletions

View File

@ -15,6 +15,7 @@
along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE 1
#include <paths.h>
#include <string.h>
#include <stdio.h>