mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-21 14:22:34 +03:00
1967c25fac
git-svn-id: svn://kolibrios.org@718 a494cfbc-eb01-0410-851d-a64ba20cac60
30 lines
611 B
C
30 lines
611 B
C
#include <stdio.h>
|
|
/*
|
|
** Get command line argument.
|
|
** Entry: n = Number of the argument.
|
|
** s = Destination string pointer.
|
|
** size = Size of destination string.
|
|
** argc = Argument count from main().
|
|
** argv = Argument vector(s) from main().
|
|
** Returns number of characters moved on success,
|
|
** else EOF.
|
|
*/
|
|
getarg(n,s,size,argc,argv)
|
|
int n; char *s; int size,argc,argv[];
|
|
{char *str;
|
|
int i;
|
|
|
|
if(n<0 | n>=argc)
|
|
{*s=NULL;
|
|
return EOF;
|
|
}
|
|
i=0;
|
|
str=argv[n];
|
|
while(i<size)
|
|
{if((s[i]=str[i])==NULL) break;
|
|
++i;
|
|
}
|
|
s[i]=NULL;
|
|
return i;
|
|
}
|