Last change
on this file since 16336 was 11071, checked in by tbretz, 14 years ago |
Replaced v19r21 by a version extracted with 'unzip -a' to get proper unix text format.
|
File size:
1.7 KB
|
Line | |
---|
1 | #include <ctype.h>
|
---|
2 | #include <stdio.h>
|
---|
3 | #include <dic.h>
|
---|
4 |
|
---|
5 | int no_link = 0x0afefead;
|
---|
6 | int version;
|
---|
7 |
|
---|
8 | char str[132];
|
---|
9 | int type, mode;
|
---|
10 | int received = 0;
|
---|
11 |
|
---|
12 | void rout(tag, buffer, size)
|
---|
13 | int *tag, *size;
|
---|
14 | int *buffer;
|
---|
15 | {
|
---|
16 | void print_service();
|
---|
17 |
|
---|
18 | if(tag){}
|
---|
19 | if((*size == 4 ) && (*buffer == no_link))
|
---|
20 | {
|
---|
21 | printf("Service %s Not Available\n", str);
|
---|
22 | }
|
---|
23 | else
|
---|
24 | {
|
---|
25 | printf("Service %s Contents :\n", str);
|
---|
26 | print_service(buffer, ((*size - 1)/4) + 1);
|
---|
27 | }
|
---|
28 | fflush(stdout);
|
---|
29 | received = 1;
|
---|
30 | #ifdef WIN32
|
---|
31 | wake_up();
|
---|
32 | #endif
|
---|
33 | }
|
---|
34 |
|
---|
35 | int main(argc,argv)
|
---|
36 | int argc;
|
---|
37 | char **argv;
|
---|
38 | {
|
---|
39 |
|
---|
40 | if(argc < 2)
|
---|
41 | {
|
---|
42 | printf("Service Name > ");
|
---|
43 | fflush(stdout);
|
---|
44 | scanf("%s", str);
|
---|
45 | }
|
---|
46 | else
|
---|
47 | {
|
---|
48 | sprintf(str,argv[1]);
|
---|
49 | }
|
---|
50 | dic_info_service(str,ONCE_ONLY,60,0,0,rout,0,&no_link,4);
|
---|
51 | while(!received)
|
---|
52 | dim_wait();
|
---|
53 | return(1);
|
---|
54 | }
|
---|
55 |
|
---|
56 | void print_service(buff, size)
|
---|
57 | int *buff, size;
|
---|
58 | {
|
---|
59 | int i,j;
|
---|
60 | char *asc;
|
---|
61 | int last[4];
|
---|
62 |
|
---|
63 | asc = (char *)buff;
|
---|
64 | for( i = 0; i < size; i++)
|
---|
65 | {
|
---|
66 | if(!(i%4))
|
---|
67 | printf("H");
|
---|
68 | printf(" %08X ",buff[i]);
|
---|
69 | last[i%4] = buff[i];
|
---|
70 | if(i%4 == 3)
|
---|
71 | {
|
---|
72 | printf(" '");
|
---|
73 | for(j = 0; j <16; j++)
|
---|
74 | {
|
---|
75 | if(isprint(asc[j]))
|
---|
76 | printf("%c",asc[j]);
|
---|
77 | else
|
---|
78 | printf(".");
|
---|
79 | }
|
---|
80 | printf("'\n");
|
---|
81 | for(j = 0; j <4; j++)
|
---|
82 | {
|
---|
83 | if(j == 0)
|
---|
84 | printf("D");
|
---|
85 | printf("%11d ",last[j]);
|
---|
86 | }
|
---|
87 | printf("\n");
|
---|
88 | asc = (char *)&buff[i+1];
|
---|
89 | }
|
---|
90 | }
|
---|
91 | if(i%4)
|
---|
92 | {
|
---|
93 |
|
---|
94 | for(j = 0; j < 4 - (i%4); j++)
|
---|
95 | printf(" ");
|
---|
96 | printf(" '");
|
---|
97 | for(j = 0; j < (i%4) * 4; j++)
|
---|
98 | {
|
---|
99 | if(isprint(asc[j]))
|
---|
100 | printf("%c",asc[j]);
|
---|
101 | else
|
---|
102 | printf(".");
|
---|
103 | }
|
---|
104 | printf("'\n");
|
---|
105 | for(j = 0; j < (i%4); j++)
|
---|
106 | {
|
---|
107 | if(j == 0)
|
---|
108 | printf("D");
|
---|
109 | printf("%11d ",last[j]);
|
---|
110 | }
|
---|
111 | printf("\n");
|
---|
112 | }
|
---|
113 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.