Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/lib/readline/shell.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | - | |||||||||||||||||||
12 | - | |||||||||||||||||||
13 | - | |||||||||||||||||||
14 | - | |||||||||||||||||||
15 | - | |||||||||||||||||||
16 | - | |||||||||||||||||||
17 | - | |||||||||||||||||||
18 | - | |||||||||||||||||||
19 | - | |||||||||||||||||||
20 | - | |||||||||||||||||||
21 | - | |||||||||||||||||||
22 | - | |||||||||||||||||||
23 | - | |||||||||||||||||||
24 | - | |||||||||||||||||||
25 | - | |||||||||||||||||||
26 | - | |||||||||||||||||||
27 | char * | - | ||||||||||||||||||
28 | sh_single_quote (char *string) | - | ||||||||||||||||||
29 | { | - | ||||||||||||||||||
30 | register int c; | - | ||||||||||||||||||
31 | char *result, *r, *s; | - | ||||||||||||||||||
32 | - | |||||||||||||||||||
33 | result = (char *)xmalloc (3 + (4 * strlen (string))); | - | ||||||||||||||||||
34 | r = result; | - | ||||||||||||||||||
35 | *r++ = '\''; | - | ||||||||||||||||||
36 | - | |||||||||||||||||||
37 | for (s = string; s
| 0 | ||||||||||||||||||
38 | { | - | ||||||||||||||||||
39 | *r++ = c; | - | ||||||||||||||||||
40 | - | |||||||||||||||||||
41 | if (c == '\''
| 0 | ||||||||||||||||||
42 | { | - | ||||||||||||||||||
43 | *r++ = '\\'; | - | ||||||||||||||||||
44 | *r++ = '\''; | - | ||||||||||||||||||
45 | *r++ = '\''; | - | ||||||||||||||||||
46 | } never executed: end of block | 0 | ||||||||||||||||||
47 | } never executed: end of block | 0 | ||||||||||||||||||
48 | - | |||||||||||||||||||
49 | *r++ = '\''; | - | ||||||||||||||||||
50 | *r = '\0'; | - | ||||||||||||||||||
51 | - | |||||||||||||||||||
52 | return never executed: (result);return (result); never executed: return (result); | 0 | ||||||||||||||||||
53 | } | - | ||||||||||||||||||
54 | - | |||||||||||||||||||
55 | - | |||||||||||||||||||
56 | - | |||||||||||||||||||
57 | static char setenv_buf[((sizeof (int) * 8 - (! ((int) 0 < (int) -1))) * 302 / 1000 + 1 + (! ((int) 0 < (int) -1))) + 1]; | - | ||||||||||||||||||
58 | static char putenv_buf1[((sizeof (int) * 8 - (! ((int) 0 < (int) -1))) * 302 / 1000 + 1 + (! ((int) 0 < (int) -1))) + 6 + 1]; | - | ||||||||||||||||||
59 | static char putenv_buf2[((sizeof (int) * 8 - (! ((int) 0 < (int) -1))) * 302 / 1000 + 1 + (! ((int) 0 < (int) -1))) + 8 + 1]; | - | ||||||||||||||||||
60 | - | |||||||||||||||||||
61 | void | - | ||||||||||||||||||
62 | sh_set_lines_and_columns (int lines, int cols) | - | ||||||||||||||||||
63 | { | - | ||||||||||||||||||
64 | - | |||||||||||||||||||
65 | sprintf (setenv_buf, "%d", lines); | - | ||||||||||||||||||
66 | setenv ("LINES", setenv_buf, 1); | - | ||||||||||||||||||
67 | - | |||||||||||||||||||
68 | sprintf (setenv_buf, "%d", cols); | - | ||||||||||||||||||
69 | setenv ("COLUMNS", setenv_buf, 1); | - | ||||||||||||||||||
70 | } never executed: end of block | 0 | ||||||||||||||||||
71 | - | |||||||||||||||||||
72 | char * | - | ||||||||||||||||||
73 | sh_get_env_value (const char *varname) | - | ||||||||||||||||||
74 | { | - | ||||||||||||||||||
75 | return never executed: ((char *)getenv (varname));return ((char *)getenv (varname)); never executed: return ((char *)getenv (varname)); | 0 | ||||||||||||||||||
76 | } | - | ||||||||||||||||||
77 | - | |||||||||||||||||||
78 | char * | - | ||||||||||||||||||
79 | sh_get_home_dir (void) | - | ||||||||||||||||||
80 | { | - | ||||||||||||||||||
81 | static char *home_dir = (char *) | - | ||||||||||||||||||
82 | ((void *)0) | - | ||||||||||||||||||
83 | ; | - | ||||||||||||||||||
84 | struct passwd *entry; | - | ||||||||||||||||||
85 | - | |||||||||||||||||||
86 | if (home_dir
| 0 | ||||||||||||||||||
87 | return never executed: (home_dir);return (home_dir); never executed: return (home_dir); | 0 | ||||||||||||||||||
88 | - | |||||||||||||||||||
89 | home_dir = (char *) | - | ||||||||||||||||||
90 | ((void *)0) | - | ||||||||||||||||||
91 | ; | - | ||||||||||||||||||
92 | - | |||||||||||||||||||
93 | - | |||||||||||||||||||
94 | - | |||||||||||||||||||
95 | - | |||||||||||||||||||
96 | entry = getpwuid (getuid ()); | - | ||||||||||||||||||
97 | - | |||||||||||||||||||
98 | if (entry
| 0 | ||||||||||||||||||
99 | home_dir = strcpy ((char *)xmalloc (1 + strlen (entry->pw_dir)), (entry->pw_dir)); never executed: home_dir = strcpy ((char *)xmalloc (1 + strlen (entry->pw_dir)), (entry->pw_dir)); | 0 | ||||||||||||||||||
100 | - | |||||||||||||||||||
101 | - | |||||||||||||||||||
102 | - | |||||||||||||||||||
103 | endpwent (); | - | ||||||||||||||||||
104 | - | |||||||||||||||||||
105 | - | |||||||||||||||||||
106 | return never executed: (home_dir);return (home_dir); never executed: return (home_dir); | 0 | ||||||||||||||||||
107 | } | - | ||||||||||||||||||
108 | - | |||||||||||||||||||
109 | - | |||||||||||||||||||
110 | - | |||||||||||||||||||
111 | - | |||||||||||||||||||
112 | - | |||||||||||||||||||
113 | - | |||||||||||||||||||
114 | - | |||||||||||||||||||
115 | int | - | ||||||||||||||||||
116 | sh_unset_nodelay_mode (int fd) | - | ||||||||||||||||||
117 | { | - | ||||||||||||||||||
118 | - | |||||||||||||||||||
119 | int flags, bflags; | - | ||||||||||||||||||
120 | - | |||||||||||||||||||
121 | if ((
| 0 | ||||||||||||||||||
122 | 3
| 0 | ||||||||||||||||||
123 | , 0)) < 0
| 0 | ||||||||||||||||||
124 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
125 | - | |||||||||||||||||||
126 | bflags = 0; | - | ||||||||||||||||||
127 | - | |||||||||||||||||||
128 | - | |||||||||||||||||||
129 | bflags |= | - | ||||||||||||||||||
130 | 04000 | - | ||||||||||||||||||
131 | ; | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | - | |||||||||||||||||||
134 | - | |||||||||||||||||||
135 | bflags |= | - | ||||||||||||||||||
136 | 04000 | - | ||||||||||||||||||
137 | ; | - | ||||||||||||||||||
138 | - | |||||||||||||||||||
139 | - | |||||||||||||||||||
140 | if (flags & bflags
| 0 | ||||||||||||||||||
141 | { | - | ||||||||||||||||||
142 | flags &= ~bflags; | - | ||||||||||||||||||
143 | return never executed: (fcntl (fd, return (fcntl (fd, 4 , flags)); never executed: return (fcntl (fd, 4 , flags)); | 0 | ||||||||||||||||||
144 | 4 never executed: return (fcntl (fd, 4 , flags)); | 0 | ||||||||||||||||||
145 | , flags)); never executed: return (fcntl (fd, 4 , flags)); | 0 | ||||||||||||||||||
146 | } | - | ||||||||||||||||||
147 | - | |||||||||||||||||||
148 | - | |||||||||||||||||||
149 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
150 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |