Revision 12350,
1.7 KB
checked in by ghudson, 26 years ago
(diff) |
Some RCS ID cleanup: delete $Log$ and replace other RCS keywords with $Id$.
|
Line | |
---|
1 | /* |
---|
2 | * $Id: StrToDirect.c,v 1.2 1999-01-22 23:16:59 ghudson Exp $ |
---|
3 | * |
---|
4 | * Copyright 1990, 1991 by the Massachusetts Institute of Technology. |
---|
5 | * |
---|
6 | * For copying and distribution information, please see the file |
---|
7 | * <mit-copyright.h>. |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #if (!defined(lint)) && (!defined(SABER)) |
---|
12 | static char *rcsid = |
---|
13 | "$Id: StrToDirect.c,v 1.2 1999-01-22 23:16:59 ghudson Exp $"; |
---|
14 | #endif |
---|
15 | |
---|
16 | #include "mit-copyright.h" |
---|
17 | #include "Jets.h" |
---|
18 | |
---|
19 | /* |
---|
20 | * String to Direction conversion |
---|
21 | */ |
---|
22 | int StrToDirection(display, window, where, resource, type, address) |
---|
23 | Display *display; |
---|
24 | Window window; |
---|
25 | caddr_t where; |
---|
26 | XjResource *resource; |
---|
27 | char *type; |
---|
28 | caddr_t address; |
---|
29 | { |
---|
30 | int retval = -1; |
---|
31 | int direction = North; |
---|
32 | |
---|
33 | if (strcasecmp(address, XjNorth) == 0) |
---|
34 | { |
---|
35 | direction = North; |
---|
36 | retval = 0; |
---|
37 | } |
---|
38 | |
---|
39 | if (strcasecmp(address, XjNorthEast) == 0) |
---|
40 | { |
---|
41 | direction = NorthEast; |
---|
42 | retval = 0; |
---|
43 | } |
---|
44 | |
---|
45 | if (strcasecmp(address, XjEast) == 0) |
---|
46 | { |
---|
47 | direction = East; |
---|
48 | retval = 0; |
---|
49 | } |
---|
50 | |
---|
51 | if (strcasecmp(address, XjSouthEast) == 0) |
---|
52 | { |
---|
53 | direction = SouthEast; |
---|
54 | retval = 0; |
---|
55 | } |
---|
56 | |
---|
57 | if (strcasecmp(address, XjSouth) == 0) |
---|
58 | { |
---|
59 | direction = South; |
---|
60 | retval = 0; |
---|
61 | } |
---|
62 | |
---|
63 | if (strcasecmp(address, XjSouthWest) == 0) |
---|
64 | { |
---|
65 | direction = SouthWest; |
---|
66 | retval = 0; |
---|
67 | } |
---|
68 | |
---|
69 | if (strcasecmp(address, XjWest) == 0) |
---|
70 | { |
---|
71 | direction = West; |
---|
72 | retval = 0; |
---|
73 | } |
---|
74 | |
---|
75 | if (strcasecmp(address, XjNorthWest) == 0) |
---|
76 | { |
---|
77 | direction = NorthWest; |
---|
78 | retval = 0; |
---|
79 | } |
---|
80 | |
---|
81 | if (retval) |
---|
82 | { |
---|
83 | char errtext[100]; |
---|
84 | sprintf(errtext, "bad direction value `%s', using `North'", address); |
---|
85 | XjWarning(errtext); |
---|
86 | } |
---|
87 | |
---|
88 | *((int *)((char *)where + resource->resource_offset)) = direction; |
---|
89 | return retval; |
---|
90 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.