Lines Matching refs:os

9  * or http://www.opensolaris.org/os/licensing.
185 ofmt_state_t *os;
226 os = calloc(sizeof (ofmt_state_t) +
228 if (os == NULL)
230 *ofmt = os;
231 os->os_fields = (ofmt_field_t *)&os[1];
232 os->os_flags = flags;
234 of = os->os_fields;
248 int nbad = os->os_nbad++;
251 if (os->os_badfields == NULL) {
252 os->os_badfields = malloc(sp->s_nfields *
254 if (os->os_badfields == NULL)
257 os->os_badfields[nbad] = strdup(sp->s_fields[i]);
258 if (os->os_badfields[nbad] == NULL)
268 os->os_maxnamelen = MAX(n, os->os_maxnamelen);
278 os->os_nfields = of_index; /* actual number of fields printed */
283 if (os != NULL)
284 ofmt_close(os);
296 ofmt_state_t *os = ofmt;
299 if (os == NULL)
301 for (i = 0; i < os->os_nfields; i++)
302 free(os->os_fields[i].of_name);
303 for (i = 0; i < os->os_nbad; i++)
304 free(os->os_badfields[i]);
305 free(os->os_badfields);
306 free(os);
314 ofmt_print_field(ofmt_state_t *os, ofmt_field_t *ofp, const char *value,
320 boolean_t parsable = (os->os_flags & OFMT_PARSABLE);
321 boolean_t multiline = (os->os_flags & OFMT_MULTILINE);
322 boolean_t rightjust = (os->os_flags & OFMT_RIGHTJUST);
330 if (os->os_nfields == 1) {
339 if (!os->os_lastfield)
344 (void) printf("%*.*s: %s", os->os_maxnamelen,
345 os->os_maxnamelen, ofp->of_name, value);
346 if (!os->os_lastfield)
349 if (os->os_lastfield) {
354 os->os_overflow = 0;
359 if (valwidth + os->os_overflow >= width) {
360 os->os_overflow += valwidth - width + 1;
368 if (os->os_overflow > 0) {
369 compress = MIN(os->os_overflow, width - valwidth);
370 os->os_overflow -= compress;
421 ofmt_state_t *os = ofmt;
428 boolean_t parsable = (os->os_flags & OFMT_PARSABLE);
429 boolean_t multiline = (os->os_flags & OFMT_MULTILINE);
430 boolean_t wrap = (os->os_flags & OFMT_WRAP);
433 sp = calloc(sizeof (split_t *), os->os_nfields);
438 if ((os->os_nrow++ % os->os_winsize.ws_row) == 0 &&
440 ofmt_print_header(os);
441 os->os_nrow++;
444 if (multiline && os->os_nrow > 1)
447 of = os->os_fields;
448 escsep = (os->os_nfields > 1);
450 for (i = 0; i < os->os_nfields; i++) {
451 os->os_lastfield = (i + 1 == os->os_nfields);
469 ofmt_print_field(os, &of[i],
473 ofmt_print_field(os, &of[i], OFMT_VAL_UNKNOWN, escsep);
480 for (i = 0; i < os->os_nfields; i++) {
481 os->os_lastfield = (i + 1 == os->os_nfields);
490 ofmt_print_field(os, &of[i], value, escsep);
497 for (i = 0; i < os->os_nfields; i++)
507 ofmt_print_header(ofmt_state_t *os)
510 ofmt_field_t *of = os->os_fields;
511 boolean_t escsep = (os->os_nfields > 1);
513 for (i = 0; i < os->os_nfields; i++) {
514 os->os_lastfield = (i + 1 == os->os_nfields);
515 ofmt_print_field(os, &of[i], of[i].of_name, escsep);
526 ofmt_state_t *os = ofmt;
527 struct winsize *winsize = &os->os_winsize;
542 ofmt_state_t *os = ofmt;
563 parsable = (os->os_flags & OFMT_PARSABLE);
565 if (os->os_nbad > 1)
570 if (os->os_nbad > 1)
576 for (i = 0; i < os->os_nbad; i++) {
578 (void) strlcat(ebuf, os->os_badfields[i],