source: trunk/minix/lib/ack/libp/arg.c@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.1 KB
Line 
1/* $Header: /cvsup/minix/src/lib/ack/libp/arg.c,v 1.1 2005/10/10 15:27:46 beng Exp $ */
2/*
3 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 *
5 * This product is part of the Amsterdam Compiler Kit.
6 *
7 * Permission to use, sell, duplicate or disclose this software must be
8 * obtained in writing. Requests for such permissions may be sent to
9 *
10 * Dr. Andrew S. Tanenbaum
11 * Wiskundig Seminarium
12 * Vrije Universiteit
13 * Postbox 7161
14 * 1007 MC Amsterdam
15 * The Netherlands
16 *
17 */
18
19/* Author: J.W. Stevenson */
20
21/* function argc:integer; extern; */
22/* function argv(i:integer):string; extern; */
23/* procedure argshift; extern; */
24/* function environ(i:integer):string; extern; */
25
26extern int _pargc;
27extern char **_pargv;
28extern char ***_penviron;
29
30int argc() {
31 return(_pargc);
32}
33
34char *argv(i) {
35 if (i >= _pargc)
36 return(0);
37 return(_pargv[i]);
38}
39
40argshift() {
41
42 if (_pargc > 1) {
43 --_pargc;
44 _pargv++;
45 }
46}
47
48char *environ(i) {
49 char **p; char *q;
50
51 if (p = *_penviron)
52 while (q = *p++)
53 if (i-- < 0)
54 return(q);
55 return(0);
56}
Note: See TracBrowser for help on using the repository browser.