Changeset 4705 for trunk/Ohana/src/opihi/lib.shell/memstr.c
- Timestamp:
- Aug 3, 2005, 5:50:08 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/memstr.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/memstr.c
r4689 r4705 1 1 # include "shell.h" 2 2 3 /* memstr returns a view, not an allocated string : don't free */ 3 4 /* returns pointer to start of m2 in m1, or NULL if failure */ 4 5 char *memstr (char *m1, char *m2, int n) { … … 12 13 13 14 } 15 16 /* formatted write statement, with intelligent allocation */ 17 int write_fmt (int fd, char *format, ...) { 18 19 int Nbyte, status; 20 char tmp, *line; 21 va_list argp; 22 23 va_start (argp, format); 24 Nbyte = vsnprintf (&tmp, 0, format, argp); 25 va_end (argp); 26 27 va_start (argp, format); 28 ALLOCATE (line, char, Nbyte + 1); 29 vsnprintf (line, Nbyte + 1, format, argp); 30 status = write (fd, line, strlen(line)); 31 va_end (argp); 32 33 free (line); 34 return (status); 35 }
Note:
See TracChangeset
for help on using the changeset viewer.
