386BSD 0.1 development
[unix-history] / usr / othersrc / contrib / isode / dsap / common / cstrings.c
CommitLineData
04c6839a
WJ
1/* cstrings.c - */
2
3#ifndef lint
4static char *rcsid = "$Header: /f/osi/dsap/common/RCS/cstrings.c,v 7.2 91/02/22 09:18:54 mrose Interim $";
5#endif
6
7/*
8 * $Header: /f/osi/dsap/common/RCS/cstrings.c,v 7.2 91/02/22 09:18:54 mrose Interim $
9 *
10 *
11 * $Log: cstrings.c,v $
12 * Revision 7.2 91/02/22 09:18:54 mrose
13 * Interim 6.8
14 *
15 * Revision 7.1 90/07/09 14:45:33 mrose
16 * sync
17 *
18 * Revision 7.0 89/11/23 22:16:59 mrose
19 * Release 6.0
20 *
21 */
22
23/*
24 * NOTICE
25 *
26 * Acquisition, use, and distribution of this module and related
27 * materials are subject to the restrictions of a license agreement.
28 * Consult the Preface in the User's Manual for the full terms of
29 * this agreement.
30 *
31 */
32
33
34#include "psap.h"
35
36static char arg_error [1024];
37static char arg_flag [100];
38int chase_flag = 2;
39extern char * result_sequence;
40
41reset_arg ()
42{
43 arg_error [0] = 0;
44 arg_flag [0] = 0;
45 chase_flag = 2;
46 if (result_sequence)
47 free (result_sequence);
48 result_sequence = NULLCP;
49}
50
51print_arg_error (opt)
52PS opt;
53{
54 if (arg_error [0] != 0) {
55 ps_printf (opt,"'%s' ambiguous, specify\n%s",arg_flag,arg_error);
56 return (OK);
57 } else
58 return (NOTOK);
59}
60
61
62int test_arg (x, y, c)
63char *x;
64char *y;
65int c;
66{
67int count = 0;
68char * top, *topx;
69
70 top = y;
71 topx = x;
72
73 if (*y == '-' )
74 count--;
75
76 for (; (*y != 0) || (*x != 0); y++) {
77 if (*x == 0)
78 if (count >= c)
79 return (1);
80 else {
81 (void) strcat (arg_error, top);
82 (void) strcat (arg_error, "\n");
83 (void) strcpy (arg_flag,topx);
84 return (0);
85 }
86 if (chrcnv[*x] != chrcnv[*y])
87 return (0);
88
89 count++;
90 x++;
91 }
92
93 if (count >= c)
94 return (1);
95 else {
96 (void) strcat (arg_error, top);
97 (void) strcat (arg_error, "\n");
98 (void) strcpy (arg_flag, topx);
99 return (0);
100 }
101}
102