def.h revision 1.27 1 1.27 christos /* $NetBSD: def.h,v 1.27 2009/04/10 13:08:24 christos Exp $ */
2 1.1 cgd /*
3 1.6 deraadt * Copyright (c) 1980, 1993
4 1.6 deraadt * The Regents of the University of California. All rights reserved.
5 1.1 cgd *
6 1.1 cgd * Redistribution and use in source and binary forms, with or without
7 1.1 cgd * modification, are permitted provided that the following conditions
8 1.1 cgd * are met:
9 1.1 cgd * 1. Redistributions of source code must retain the above copyright
10 1.1 cgd * notice, this list of conditions and the following disclaimer.
11 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 cgd * notice, this list of conditions and the following disclaimer in the
13 1.1 cgd * documentation and/or other materials provided with the distribution.
14 1.16 agc * 3. Neither the name of the University nor the names of its contributors
15 1.1 cgd * may be used to endorse or promote products derived from this software
16 1.1 cgd * without specific prior written permission.
17 1.1 cgd *
18 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 1.1 cgd * SUCH DAMAGE.
29 1.1 cgd *
30 1.9 tls * @(#)def.h 8.4 (Berkeley) 4/20/95
31 1.27 christos * $NetBSD: def.h,v 1.27 2009/04/10 13:08:24 christos Exp $
32 1.1 cgd */
33 1.1 cgd
34 1.1 cgd /*
35 1.1 cgd * Mail -- a mail program
36 1.1 cgd *
37 1.1 cgd * Author: Kurt Shoens (UCB) March 25, 1978
38 1.1 cgd */
39 1.1 cgd
40 1.21 christos #ifndef __DEF_H__
41 1.21 christos #define __DEF_H__
42 1.21 christos
43 1.10 lukem #include <sys/types.h>
44 1.10 lukem #include <sys/file.h>
45 1.10 lukem #include <sys/ioctl.h>
46 1.10 lukem #include <sys/stat.h>
47 1.6 deraadt #include <sys/param.h>
48 1.6 deraadt #include <sys/time.h>
49 1.10 lukem #include <sys/wait.h>
50 1.6 deraadt
51 1.10 lukem #include <ctype.h>
52 1.10 lukem #include <err.h>
53 1.10 lukem #include <errno.h>
54 1.10 lukem #include <fcntl.h>
55 1.10 lukem #include <paths.h>
56 1.10 lukem #include <pwd.h>
57 1.27 christos #include <setjmp.h>
58 1.6 deraadt #include <signal.h>
59 1.10 lukem #include <stdio.h>
60 1.10 lukem #include <stdlib.h>
61 1.10 lukem #include <string.h>
62 1.7 mycroft #include <termios.h>
63 1.11 kleink #include <time.h>
64 1.6 deraadt #include <unistd.h>
65 1.27 christos #include <vis.h>
66 1.27 christos
67 1.6 deraadt #include "pathnames.h"
68 1.6 deraadt
69 1.1 cgd #define APPEND /* New mail goes to end of mailbox */
70 1.1 cgd
71 1.21 christos #define COMMENT_CHAR '#' /* Comment character when sourcing */
72 1.1 cgd #define ESCAPE '~' /* Default escape for sending */
73 1.1 cgd #define NMLSIZE 1024 /* max names in a message list */
74 1.1 cgd #define PATHSIZE MAXPATHLEN /* Size of pathnames throughout */
75 1.1 cgd #define HSHSIZE 59 /* Hash size for aliases and vars */
76 1.1 cgd #define LINESIZE BUFSIZ /* max readable line width */
77 1.1 cgd #define MAXARGC 1024 /* Maximum list of raw strings */
78 1.1 cgd #define MAXEXP 25 /* Maximum expansion of aliases */
79 1.1 cgd
80 1.22 christos #define PUBLIC /* make it easy to find the entry points */
81 1.22 christos
82 1.21 christos /*
83 1.21 christos * User environment variable names.
84 1.22 christos * See complete.h, mime.h, and thread.h for names specific to those modules.
85 1.21 christos */
86 1.22 christos #define ENAME_INDENT_POSTSCRIPT "indentpostscript"
87 1.22 christos #define ENAME_INDENT_PREAMBLE "indentpreamble"
88 1.22 christos #define ENAME_APPEND "append"
89 1.22 christos #define ENAME_ASK "ask"
90 1.22 christos #define ENAME_ASKBCC "askbcc"
91 1.22 christos #define ENAME_ASKCC "askcc"
92 1.22 christos #define ENAME_ASKSUB "asksub"
93 1.22 christos #define ENAME_AUTOINC "autoinc"
94 1.22 christos #define ENAME_AUTOPRINT "autoprint"
95 1.22 christos #define ENAME_CRT "crt"
96 1.22 christos #define ENAME_DEAD "DEAD"
97 1.22 christos #define ENAME_DEBUG "debug"
98 1.22 christos #define ENAME_DONTSENDEMPTY "dontsendempty"
99 1.22 christos #define ENAME_DOT "dot"
100 1.22 christos #define ENAME_EDITOR "EDITOR"
101 1.22 christos #define ENAME_ENABLE_PIPES "enable-pipes"
102 1.22 christos #define ENAME_ESCAPE "escape"
103 1.22 christos #define ENAME_FOLDER "folder"
104 1.22 christos #define ENAME_HEADER_FORMAT "header-format"
105 1.22 christos #define ENAME_HOLD "hold"
106 1.22 christos #define ENAME_IGNORE "ignore"
107 1.22 christos #define ENAME_IGNOREEOF "ignoreeof"
108 1.22 christos #define ENAME_INDENTPREFIX "indentprefix"
109 1.22 christos #define ENAME_INTERACTIVE "interactive"
110 1.22 christos #define ENAME_KEEP "keep"
111 1.22 christos #define ENAME_KEEPSAVE "keepsave"
112 1.22 christos #define ENAME_LISTER "LISTER"
113 1.22 christos #define ENAME_MBOX "MBOX"
114 1.22 christos #define ENAME_METOO "metoo"
115 1.22 christos #define ENAME_NOHEADER "noheader"
116 1.22 christos #define ENAME_NOSAVE "nosave"
117 1.27 christos #define ENAME_PAGE_ALSO "page-also"
118 1.22 christos #define ENAME_PAGER "PAGER"
119 1.22 christos #define ENAME_PAGER_OFF "pager-off"
120 1.22 christos #define ENAME_PROMPT "prompt"
121 1.22 christos #define ENAME_QUIET "quiet"
122 1.21 christos #define ENAME_RECORD "record"
123 1.22 christos #define ENAME_REGEX_SEARCH "regex-search"
124 1.22 christos #define ENAME_REPLYALL "Replyall"
125 1.22 christos #define ENAME_REPLYASRECIPIENT "ReplyAsRecipient"
126 1.22 christos #define ENAME_SCREEN "screen"
127 1.22 christos #define ENAME_SCREENHEIGHT "screenheight"
128 1.22 christos #define ENAME_SCREENWIDTH "screenwidth"
129 1.22 christos #define ENAME_SEARCHHEADERS "searchheaders"
130 1.22 christos #define ENAME_SENDMAIL "sendmail"
131 1.22 christos #define ENAME_SHELL "SHELL"
132 1.22 christos #define ENAME_SHOW_RCPT "show-rcpt"
133 1.22 christos #define ENAME_SMOPTS_VERIFY "smopts-verify"
134 1.22 christos #define ENAME_TOPLINES "toplines"
135 1.22 christos #define ENAME_VERBOSE "verbose"
136 1.22 christos #define ENAME_VISUAL "VISUAL"
137 1.21 christos
138 1.1 cgd #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */
139 1.1 cgd
140 1.1 cgd struct message {
141 1.1 cgd short m_flag; /* flags, see below */
142 1.18 christos short m_offset; /* offset in block of message */
143 1.9 tls long m_block; /* block number of this message */
144 1.9 tls long m_lines; /* Lines in the message */
145 1.18 christos off_t m_size; /* Bytes in the message */
146 1.15 ross long m_blines; /* Body (non-header) lines */
147 1.22 christos
148 1.22 christos /*
149 1.22 christos * threading fields
150 1.22 christos */
151 1.22 christos int m_index; /* message index in this thread */
152 1.22 christos int m_depth; /* depth in thread */
153 1.22 christos struct message *m_flink; /* link to next message */
154 1.22 christos struct message *m_blink; /* link to previous message */
155 1.22 christos struct message *m_clink; /* link to child of this message */
156 1.22 christos struct message *m_plink; /* link to parent of thread */
157 1.1 cgd };
158 1.20 christos typedef struct mime_info mime_info_t; /* phantom structure only to attach.c */
159 1.1 cgd
160 1.1 cgd /*
161 1.1 cgd * flag bits.
162 1.1 cgd */
163 1.1 cgd
164 1.1 cgd #define MUSED (1<<0) /* entry is used, but this bit isn't */
165 1.1 cgd #define MDELETED (1<<1) /* entry has been deleted */
166 1.1 cgd #define MSAVED (1<<2) /* entry has been saved */
167 1.1 cgd #define MTOUCH (1<<3) /* entry has been noticed */
168 1.1 cgd #define MPRESERVE (1<<4) /* keep entry in sys mailbox */
169 1.1 cgd #define MMARK (1<<5) /* message is marked! */
170 1.22 christos #define MMODIFY (1<<6) /* message has been modified */
171 1.1 cgd #define MNEW (1<<7) /* message has never been seen */
172 1.1 cgd #define MREAD (1<<8) /* message has been read sometime. */
173 1.1 cgd #define MSTATUS (1<<9) /* message status has changed */
174 1.1 cgd #define MBOX (1<<10) /* Send this to mbox, regardless */
175 1.22 christos #define MTAGGED (1<<11) /* message has been tagged */
176 1.1 cgd
177 1.1 cgd /*
178 1.1 cgd * Given a file address, determine the block number it represents.
179 1.1 cgd */
180 1.1 cgd #define blockof(off) ((int) ((off) / 4096))
181 1.24 dogcow #define blkoffsetof(off) ((int) ((off) % 4096))
182 1.1 cgd #define positionof(block, offset) ((off_t)(block) * 4096 + (offset))
183 1.1 cgd
184 1.1 cgd /*
185 1.1 cgd * Format of the command description table.
186 1.1 cgd * The actual table is declared and initialized
187 1.1 cgd * in lex.c
188 1.1 cgd */
189 1.1 cgd struct cmd {
190 1.17 christos const char *c_name; /* Name of command */
191 1.12 wiz int (*c_func)(void *); /* Implementor of the command */
192 1.22 christos int c_pipe; /* Pipe output through the pager */
193 1.22 christos # define C_PIPE_PAGER 1 /* enable use of pager */
194 1.23 christos # define C_PIPE_CRT 2 /* use the pager if CRT is defined */
195 1.23 christos # define C_PIPE_SHELL 4 /* enable shell pipes */
196 1.20 christos #ifdef USE_EDITLINE
197 1.19 christos const char *c_complete; /* String describing completion */
198 1.19 christos #endif
199 1.1 cgd short c_argtype; /* Type of arglist (see below) */
200 1.1 cgd short c_msgflag; /* Required flags of messages */
201 1.1 cgd short c_msgmask; /* Relevant flags of messages */
202 1.1 cgd };
203 1.1 cgd
204 1.1 cgd /* Yechh, can't initialize unions */
205 1.1 cgd
206 1.1 cgd #define c_minargs c_msgflag /* Minimum argcount for RAWLIST */
207 1.1 cgd #define c_maxargs c_msgmask /* Max argcount for RAWLIST */
208 1.1 cgd
209 1.1 cgd /*
210 1.1 cgd * Argument types.
211 1.1 cgd */
212 1.1 cgd
213 1.1 cgd #define MSGLIST 0 /* Message list type */
214 1.1 cgd #define STRLIST 1 /* A pure string */
215 1.1 cgd #define RAWLIST 2 /* Shell string list */
216 1.1 cgd #define NOLIST 3 /* Just plain 0 */
217 1.1 cgd #define NDMLIST 4 /* Message list, no defaults */
218 1.1 cgd
219 1.22 christos #define P 0x010 /* Autoprint dot after command */
220 1.22 christos #define I 0x020 /* Interactive command bit */
221 1.22 christos #define M 0x040 /* Legal from send mode bit */
222 1.22 christos #define W 0x080 /* Illegal when read only bit */
223 1.22 christos #define F 0x100 /* Is a conditional command */
224 1.22 christos #define T 0x200 /* Is a transparent command */
225 1.22 christos #define R 0x400 /* Cannot be called from collect */
226 1.22 christos #define ARGTYPE_MASK ~(P|I|M|W|F|T|R)
227 1.1 cgd
228 1.1 cgd /*
229 1.1 cgd * Oft-used mask values
230 1.1 cgd */
231 1.1 cgd
232 1.1 cgd #define MMNORM (MDELETED|MSAVED)/* Look at both save and delete bits */
233 1.1 cgd #define MMNDEL MDELETED /* Look only at deleted bit */
234 1.1 cgd
235 1.1 cgd /*
236 1.1 cgd * Structure used to return a break down of a head
237 1.1 cgd * line (hats off to Bill Joy!)
238 1.1 cgd */
239 1.1 cgd
240 1.1 cgd struct headline {
241 1.1 cgd char *l_from; /* The name of the sender */
242 1.1 cgd char *l_tty; /* His tty string (if any) */
243 1.1 cgd char *l_date; /* The entire date string */
244 1.1 cgd };
245 1.1 cgd
246 1.19 christos #define GTO 0x001 /* Grab To: line */
247 1.19 christos #define GSUBJECT 0x002 /* Likewise, Subject: line */
248 1.19 christos #define GCC 0x004 /* And the Cc: line */
249 1.19 christos #define GBCC 0x008 /* And also the Bcc: line */
250 1.19 christos #define GSMOPTS 0x010 /* Grab the sendmail options */
251 1.22 christos #define GMISC 0x020 /* miscellaneous extra fields for sending */
252 1.20 christos #ifdef MIME_SUPPORT
253 1.22 christos #define GMIME 0x040 /* mime flag */
254 1.20 christos #endif
255 1.27 christos #define GMASK (GTO | GSUBJECT | GCC | GBCC | GSMOPTS)
256 1.1 cgd /* Mask of places from whence */
257 1.1 cgd
258 1.19 christos #define GNL 0x100 /* Print blank line after */
259 1.19 christos #define GDEL 0x200 /* Entity removed from list */
260 1.19 christos #define GCOMMA 0x400 /* detract puts in commas */
261 1.1 cgd
262 1.20 christos #ifdef MIME_SUPPORT
263 1.20 christos /*
264 1.20 christos * Structure of MIME content.
265 1.20 christos */
266 1.20 christos struct Content {
267 1.20 christos const char *C_type; /* content type */
268 1.20 christos const char *C_encoding; /* content transfer encoding */
269 1.20 christos const char *C_disposition; /* content disposition */
270 1.20 christos const char *C_description; /* content description */
271 1.20 christos const char *C_id; /* content id */
272 1.20 christos };
273 1.20 christos /* Header strings corresponding to the above Content fields. */
274 1.20 christos #define MIME_HDR_TYPE "Content-Type"
275 1.20 christos #define MIME_HDR_ENCODING "Content-Transfer-Encoding"
276 1.20 christos #define MIME_HDR_DISPOSITION "Content-Disposition"
277 1.20 christos #define MIME_HDR_ID "Content-ID"
278 1.20 christos #define MIME_HDR_DESCRIPTION "Content-Description"
279 1.20 christos #define MIME_HDR_VERSION "MIME-Version"
280 1.20 christos /* the value of the MIME-Version field */
281 1.20 christos #define MIME_VERSION "1.0"
282 1.20 christos
283 1.20 christos typedef enum {
284 1.20 christos ATTACH_INVALID = 0, /* do not use! */
285 1.20 christos ATTACH_FNAME = 1,
286 1.20 christos ATTACH_MSG = 2,
287 1.20 christos ATTACH_FILENO = 3
288 1.20 christos } attach_t;
289 1.20 christos
290 1.20 christos /*
291 1.20 christos * Structure of a MIME attachment.
292 1.20 christos */
293 1.20 christos struct attachment {
294 1.20 christos struct attachment *a_flink; /* Forward link in list. */
295 1.20 christos struct attachment *a_blink; /* Backward list link */
296 1.20 christos
297 1.20 christos attach_t a_type; /* attachment type */
298 1.20 christos #if 1
299 1.20 christos union {
300 1.20 christos char *u_name; /* file name */
301 1.20 christos struct message *u_msg; /* message */
302 1.20 christos int u_fileno; /* file number */
303 1.20 christos } a_u;
304 1.20 christos
305 1.20 christos #define a_name a_u.u_name
306 1.20 christos #define a_msg a_u.u_msg
307 1.20 christos #define a_fileno a_u.u_fileno
308 1.20 christos #else
309 1.20 christos char *a_name; /* file name */
310 1.20 christos struct message *a_msg; /* message */
311 1.20 christos int a_fileno; /* file number */
312 1.20 christos #endif
313 1.20 christos
314 1.20 christos struct Content a_Content; /* MIME content strings */
315 1.20 christos };
316 1.20 christos #endif /* MIME_SUPPORT */
317 1.20 christos
318 1.1 cgd /*
319 1.1 cgd * Structure used to pass about the current
320 1.1 cgd * state of the user-typed message header.
321 1.1 cgd */
322 1.1 cgd
323 1.1 cgd struct header {
324 1.27 christos struct name *h_to; /* Dynamic "To:" string */
325 1.27 christos char *h_subject; /* Subject string */
326 1.27 christos struct name *h_cc; /* Carbon copies string */
327 1.27 christos struct name *h_bcc; /* Blind carbon copies */
328 1.27 christos struct name *h_smopts; /* Sendmail options */
329 1.27 christos char *h_in_reply_to; /* In-Reply-To: field */
330 1.27 christos struct name *h_references; /* References: field */
331 1.27 christos struct name *h_extra; /* extra header fields */
332 1.20 christos #ifdef MIME_SUPPORT
333 1.20 christos char *h_mime_boundary; /* MIME multipart boundary string */
334 1.20 christos struct Content h_Content; /* MIME content for message */
335 1.20 christos struct attachment *h_attach; /* MIME attachments */
336 1.20 christos #endif
337 1.1 cgd };
338 1.1 cgd
339 1.1 cgd /*
340 1.1 cgd * Structure of namelist nodes used in processing
341 1.1 cgd * the recipients of mail and aliases and all that
342 1.1 cgd * kind of stuff.
343 1.1 cgd */
344 1.1 cgd
345 1.1 cgd struct name {
346 1.1 cgd struct name *n_flink; /* Forward link in list. */
347 1.1 cgd struct name *n_blink; /* Backward list link */
348 1.1 cgd short n_type; /* From which list it came */
349 1.1 cgd char *n_name; /* This fella's name */
350 1.1 cgd };
351 1.1 cgd
352 1.1 cgd /*
353 1.1 cgd * Structure of a variable node. All variables are
354 1.1 cgd * kept on a singly-linked list of these, rooted by
355 1.1 cgd * "variables"
356 1.1 cgd */
357 1.1 cgd
358 1.1 cgd struct var {
359 1.1 cgd struct var *v_link; /* Forward link to next variable */
360 1.1 cgd char *v_name; /* The variable's name */
361 1.1 cgd char *v_value; /* And it's current value */
362 1.1 cgd };
363 1.1 cgd
364 1.1 cgd struct group {
365 1.1 cgd struct group *ge_link; /* Next person in this group */
366 1.1 cgd char *ge_name; /* This person's user name */
367 1.1 cgd };
368 1.1 cgd
369 1.1 cgd struct grouphead {
370 1.1 cgd struct grouphead *g_link; /* Next grouphead in list */
371 1.1 cgd char *g_name; /* Name of this group */
372 1.1 cgd struct group *g_list; /* Users in group. */
373 1.1 cgd };
374 1.1 cgd
375 1.21 christos struct smopts_s {
376 1.21 christos struct smopts_s *s_link; /* Link to next smopts_s in list */
377 1.21 christos char *s_name; /* Name of this smopts_s */
378 1.21 christos struct name *s_smopts; /* sendmail options name list */
379 1.21 christos };
380 1.21 christos
381 1.1 cgd /*
382 1.1 cgd * Structure of the hash table of ignored header fields
383 1.1 cgd */
384 1.1 cgd struct ignoretab {
385 1.18 christos size_t i_count; /* Number of entries */
386 1.1 cgd struct ignore {
387 1.1 cgd struct ignore *i_link; /* Next ignored field in bucket */
388 1.1 cgd char *i_field; /* This ignored field */
389 1.1 cgd } *i_head[HSHSIZE];
390 1.1 cgd };
391 1.1 cgd
392 1.1 cgd /*
393 1.22 christos * Constants for conditional commands. These control whether we
394 1.22 christos * should be executing commands or not.
395 1.1 cgd */
396 1.22 christos struct cond_stack_s {
397 1.22 christos struct cond_stack_s *c_next;
398 1.22 christos int c_cond;
399 1.22 christos };
400 1.22 christos #define CNONE 0x00 /* Execute everything */
401 1.22 christos #define CSKIP 0x01 /* Do not execute commands */
402 1.22 christos #define CIF 0x02 /* Inside if/endif block */
403 1.22 christos #define CELSE 0x04 /* The last conditional was else */
404 1.22 christos #define CIGN 0x08 /* Conditional in a skipped block */
405 1.22 christos
406 1.22 christos enum mailmode_e {
407 1.22 christos mm_receiving, /* receiving mail mode */
408 1.22 christos mm_sending, /* sending mail mode */
409 1.22 christos mm_hdrsonly /* headers only mode */
410 1.22 christos };
411 1.1 cgd
412 1.1 cgd /*
413 1.1 cgd * Truncate a file to the last character written. This is
414 1.1 cgd * useful just before closing an old file that was opened
415 1.1 cgd * for read/write.
416 1.1 cgd */
417 1.6 deraadt #define trunc(stream) { \
418 1.6 deraadt (void)fflush(stream); \
419 1.6 deraadt (void)ftruncate(fileno(stream), (off_t)ftell(stream)); \
420 1.4 cgd }
421 1.20 christos
422 1.20 christos /*
423 1.25 christos * White Space (WSP) as specified in see RFC 2822.
424 1.25 christos *
425 1.25 christos * NOTE: Use this in place of isblank() so it is inline. Also, unlike
426 1.25 christos * the table implemented ctype(3) routines, this does not have input
427 1.25 christos * range issues caused by sign extensions.
428 1.25 christos *
429 1.25 christos * See mime_header.h for the related is_FWS().
430 1.20 christos */
431 1.25 christos static inline int
432 1.25 christos is_WSP(int c)
433 1.25 christos {
434 1.25 christos return c == ' ' || c == '\t';
435 1.25 christos }
436 1.25 christos
437 1.27 christos static inline char *
438 1.25 christos skip_WSP(const char *cp)
439 1.20 christos {
440 1.25 christos while (is_WSP(*cp))
441 1.20 christos cp++;
442 1.25 christos return __UNCONST(cp);
443 1.25 christos }
444 1.25 christos
445 1.27 christos static inline char *
446 1.25 christos skip_space(char *p)
447 1.25 christos {
448 1.25 christos while (isspace((unsigned char)*p))
449 1.25 christos p++;
450 1.25 christos return p;
451 1.20 christos }
452 1.21 christos
453 1.27 christos /*
454 1.27 christos * strip trailing white space
455 1.27 christos */
456 1.27 christos static inline char *
457 1.27 christos strip_WSP(char *line)
458 1.27 christos {
459 1.27 christos char *cp;
460 1.27 christos
461 1.27 christos cp = line + strlen(line) - 1;
462 1.27 christos while (cp >= line && is_WSP(*cp))
463 1.27 christos cp--;
464 1.27 christos *++cp = '\0';
465 1.27 christos return cp;
466 1.27 christos }
467 1.27 christos
468 1.21 christos #endif /* __DEF_H__ */
469