OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [argz/] [argz_extract.c] - Blame information for rev 297

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
2
 *
3
 * Permission to use, copy, modify, and distribute this software
4
 * is freely granted, provided that this notice is preserved.
5
 */
6
 
7
#include <stddef.h>
8
#include <argz.h>
9
#include <sys/types.h>
10
 
11
void
12
_DEFUN (argz_extract, (argz, argz_len, argv),
13
       char *argz _AND
14
       size_t argz_len _AND
15
       char **argv)
16
{
17
  size_t i = 0;
18
  int j = 0;
19
  const size_t count = argz_count(argz, argz_len);
20
 
21
  if (argz_len > 1)
22
    for (i = argz_len - 2; i > 0; i--)
23
      {
24
        if (argz[i] == '\0')
25
          {
26
            j++;
27
            argv[count - j] = &argz[i + 1];
28
          }
29
      }
30
  argv[0] = &argz[0];
31
  argv[count] = NULL;
32
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.