Lines Matching +full:ls +full:- +full:bits

83  * -DNOTERMINFO can be defined on the cc command line to prevent
109 * b --- abbreviated month name
110 * e --- day number
111 * Y --- year in the form ccyy
112 * H --- hour(24-hour version)
113 * M --- minute
114 * F --- yyyy-mm-dd
115 * T --- hh:mm:ss
116 * z --- time zone as hours displacement from UTC
125 #define FORMAT_ISO_NEW " %m-%d %H:%M "
188 char *namep; /* for name in ls-command; */
192 mode_t lflags; /* 0777 bits used as r,w,x permissions */
222 static struct dchain *dtemp; /* temporary - used for linking */
311 static uid_t lastuid = (uid_t)-1;
312 static gid_t lastgid = (gid_t)-1;
335 static const char *time_fmt_old = FORMAT_OLD; /* non-recent files */
355 (strcmp((d) + (l) - 2, "/.") != 0))
358 (strcmp((d) + (l) - 3, "/..") != 0))
374 { "almost-all", no_argument, NULL, 'A' },
377 { "human-readable", no_argument, NULL, 'h' },
379 { "dereference-command-line", no_argument, NULL, 'H' },
380 { "ignore-backups", no_argument, NULL, 'B' },
382 { "numeric-uid-gid", no_argument, NULL, 'n' },
383 { "no-group", no_argument, NULL, 'o' },
384 { "hide-control-chars", no_argument, NULL, 'q' },
391 { "block-size", required_argument, NULL, 0 },
392 { "full-time", no_argument, NULL, 0 },
396 { "file-type", no_argument, NULL, 0 },
397 { "time-style", required_argument, NULL, 0 },
416 #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ in main()
422 argc = getargv("ls", &argv, 0); in main()
427 year = lb.lmtime.tv_sec - 6L*30L*24L*60L*60L; /* 6 months ago */ in main()
436 &option_index)) != -1) in main()
439 /* non-short options */ in main()
455 strcmp(optarg, "if-tty") == 0) { in main()
471 "--color\n"), optarg); in main()
484 "block-size") == 0) { in main()
497 scale_c = optarg[scale_len - 1]; in main()
507 scale_c = optarg[scale_len - 2]; in main()
515 * make optarg[scale_len - 1] point to in main()
518 --scale_len; in main()
566 optarg[scale_len - 1] = '\0'; in main()
568 /* Based on testing, this is what GNU ls does */ in main()
580 "file-type") == 0) { in main()
589 "full-time") == 0) { in main()
599 "time-style") == 0) { in main()
600 /* like -E, but doesn't imply -l */ in main()
601 if (strcmp(optarg, "full-iso") == 0) { in main()
609 if (strcmp(optarg, "long-iso") == 0) { in main()
650 perror("ls"); in main()
664 tnew_len = timelen - in main()
665 strlen(told) - 1; in main()
752 /* -H and -L are mutually exclusive */ in main()
771 /* -H and -L are mutually exclusive */ in main()
804 rflg = -1; in main()
872 * -l has precedence over -@ in main()
954 "usage: ls -aAbBcCdeEfFghHiklLmnopqrRsStuUwxvV1@/%[c | v]" in main()
992 if (ioctl(1, TIOCGWINSZ, &win) != -1) in main()
999 * When certain options (-f, or -U and -1, and not -l, etc.) are in main()
1016 perror("ls"); in main()
1019 if ((amino = (argc-optind)) == 0) { in main()
1022 * in ls-command and current in main()
1060 perror("ls"); in main()
1063 myinfo->dev = 0; in main()
1064 myinfo->ino = 0; in main()
1065 myinfo->parent = NULL; in main()
1082 ep->ln.namep = (*argv[optind] ? argv[optind] : dotp); in main()
1083 ep->lflags |= ISARG; in main()
1094 if ((flist[i]->ltype == 'd' && dflg == 0) || fflg) in main()
1100 pdirectory(flist[i]->ln.namep, Rflg || in main()
1101 (amino > 1), nargs, 0, flist[i]->ancinfo); in main()
1104 /* -R: print subdirectories found */ in main()
1110 cdfirst = cdfirst -> dc_next; in main()
1111 dtemp -> dc_next = dfirst; in main()
1116 dfirst = dfirst->dc_next; in main()
1117 pdirectory(dtemp->dc_name, 1, nargs, in main()
1118 dtemp->cycle_detected, dtemp->myancinfo); in main()
1121 free(dtemp->dc_name); in main()
1159 "ls: cycle detected for %s\n"), name); in pdirectory()
1168 qsort(&flist[lp], (unsigned)(nfiles - lp), in pdirectory()
1172 for (j = nfiles - 1; j >= lp; j--) { in pdirectory()
1174 if (ap->ltype == 'd' && strcmp(ap->ln.lname, ".") && in pdirectory()
1175 strcmp(ap->ln.lname, "..")) { in pdirectory()
1178 perror("ls"); in pdirectory()
1181 pname = makename(curdir, ap->ln.lname); in pdirectory()
1182 if ((dp->dc_name = strdup(pname)) == NULL) { in pdirectory()
1183 perror("ls"); in pdirectory()
1186 dp->cycle_detected = ap->cycle; in pdirectory()
1187 dp->myancinfo = ap->ancinfo; in pdirectory()
1188 dp->dc_next = dfirst; in pdirectory()
1223 /* otherwise print -C columns */ in pem()
1225 slp--; in pem()
1231 nrows = (lp - slp - 1) / ncols + 1; in pem()
1252 char *dmark = ""; /* Used if -p or -F option active */ in pentry()
1257 (void) printf("%s\n", (ap->lflags & ISARG) ? ap->ln.namep : in pentry()
1258 ap->ln.lname); in pentry()
1266 curcol += printf("%llu ", (long long)p->lnum); in pentry()
1268 curcol += printf("%10llu ", (long long)p->lnum); in pentry()
1272 (p->lblocks < 10000) ? "%4lld " : "%lld ", in pentry()
1273 (p->ltype != 'b' && p->ltype != 'c') ? in pentry()
1274 p->lblocks : 0LL); in pentry()
1277 (void) putchar(p->ltype); in pentry()
1279 pmode(p->lflags); in pentry()
1282 (void) putchar(p->acl); in pentry()
1286 * When handling owner/group options (-o -g) note -n: in pentry()
1287 * With no -n options, getname/getroup converts any in pentry()
1289 * With just one -n option, convert ephemeral IDs to SIDs in pentry()
1290 * With two or more -n options, show the ephemeral ID in pentry()
1293 curcol += printf("%3lu ", (ulong_t)p->lnl); in pentry()
1296 cp = getname(p->luid); in pentry()
1297 curcol += printf("%-8s ", cp); in pentry()
1298 } else if (nflg == 1 && p->luid > MAXUID) { in pentry()
1299 cp = getusid(p->luid); in pentry()
1300 curcol += printf("%-8s ", cp); in pentry()
1302 curcol += printf("%-8lu ", (ulong_t)p->luid); in pentry()
1307 cp = getgroup(p->lgid); in pentry()
1308 curcol += printf("%-8s ", cp); in pentry()
1309 } else if (nflg == 1 && p->lgid > MAXUID) { in pentry()
1310 cp = getgsid(p->lgid); in pentry()
1311 curcol += printf("%-8s ", cp); in pentry()
1313 curcol += printf("%-8lu ", (ulong_t)p->lgid); in pentry()
1316 if (p->ltype == 'b' || p->ltype == 'c') { in pentry()
1318 (uint_t)major((dev_t)p->lsize), in pentry()
1319 (uint_t)minor((dev_t)p->lsize)); in pentry()
1323 nicenum_scale(p->lsize, 1, numbuf, sizeof (numbuf), in pentry()
1328 uint64_t bsize = p->lsize / block_size; in pentry()
1334 if (p->lsize % block_size != 0) in pentry()
1339 format_time(p->lmtime.tv_sec, p->lmtime.tv_nsec); in pentry()
1348 * prevent both "->" and trailing marks in pentry()
1352 if (pflg && p->ltype == 'd') in pentry()
1355 if (Fflg && !(lflg && p->flinkto)) { in pentry()
1356 if (p->ltype == 'd') in pentry()
1358 else if (p->ltype == 'D') in pentry()
1360 else if (p->ltype == 'p') in pentry()
1362 else if (p->ltype == 'l') in pentry()
1364 else if (p->ltype == 's') in pentry()
1367 (p->lflags & (S_IXUSR|S_IXGRP|S_IXOTH))) in pentry()
1374 ls_start_color(p->color); in pentry()
1376 if (p->lflags & ISARG) in pentry()
1377 str = p->ln.namep; in pentry()
1379 str = p->ln.lname; in pentry()
1384 if (lflg && p->flinkto) { in pentry()
1387 csi_pprintf((unsigned char *)" -> "); in pentry()
1389 ls_start_color(p->link_color); in pentry()
1390 csi_pprintf((unsigned char *)p->flinkto); in pentry()
1398 if (lflg && p->flinkto) { in pentry()
1401 str = " -> "; in pentry()
1405 ls_start_color(p->link_color); in pentry()
1406 (void) printf("%s", p->flinkto); in pentry()
1407 curcol += strcol((unsigned char *)p->flinkto); in pentry()
1423 if (p->exttr != NULL) { in pentry()
1426 if (p->exttr[i].name != NULL) in pentry()
1430 if (p->exttr[i].name != NULL) { in pentry()
1431 (void) printf("%s", p->exttr[i].name); in pentry()
1432 k--; in pentry()
1448 if (p->aclp) { in pentry()
1458 acl_printacl2(p->aclp, num_cols, pa_flags); in pentry()
1471 static int m0[] = { 1, S_IRUSR, 'r', '-' }; in pmode()
1472 static int m1[] = { 1, S_IWUSR, 'w', '-' }; in pmode()
1474 'x', S_ISUID, 'S', '-' }; in pmode()
1475 static int m3[] = { 1, S_IRGRP, 'r', '-' }; in pmode()
1476 static int m4[] = { 1, S_IWGRP, 'w', '-' }; in pmode()
1480 S_ISGID, 'L', '-'}; in pmode()
1482 S_ISGID, 'l', '-'}; in pmode()
1484 static int m6[] = { 1, S_IROTH, 'r', '-' };
1485 static int m7[] = { 1, S_IWOTH, 'w', '-' };
1487 'x', S_ISVTX, 'T', '-'};
1504 while (n-->0) { in selection()
1587 if (aflg == 0 && dentry->d_name[0] == '.' && in rddir()
1589 dentry->d_name[1] == '\0' || in rddir()
1590 (dentry->d_name[1] == '.' && in rddir()
1591 dentry->d_name[2] == '\0'))) in rddir()
1594 * and items without valid inode-number; in rddir()
1598 /* skip entries ending in ~ if -B was given */ in rddir()
1600 dentry->d_name[strlen(dentry->d_name) - 1] == '~') in rddir()
1603 width = strcol((unsigned char *)dentry->d_name); in rddir()
1607 ep = gstat(makename(dir, dentry->d_name), 0, myinfo); in rddir()
1613 ep->lnum = dentry->d_ino; in rddir()
1614 for (j = 0; dentry->d_name[j] != '\0'; j++) in rddir()
1615 ep->ln.lname[j] = dentry->d_name[j]; in rddir()
1616 ep->ln.lname[j] = '\0'; in rddir()
1624 nfiles--; in rddir()
1632 gettext("ls: error reading directory %s: %s\n"), in rddir()
1646 * In addition, set the exit code. Note: If the -a flag was
1672 perror("ls"); in record_ancestry()
1675 myinfo->dev = pstatb->st_dev; in record_ancestry()
1676 myinfo->ino = pstatb->st_ino; in record_ancestry()
1677 myinfo->parent = myparent; in record_ancestry()
1678 rep->ancinfo = myinfo; in record_ancestry()
1686 for (tptr = myparent; tptr->parent != NULL; in record_ancestry()
1687 tptr = tptr->parent) { in record_ancestry()
1688 if ((tptr->dev == pstatb->st_dev) && in record_ancestry()
1689 (tptr->ino == pstatb->st_ino)) { in record_ancestry()
1699 rep->cycle = 1; in record_ancestry()
1709 * Do re-calculate the mode for group for ACE_T type of acls.
1723 * unix mode bits for the group.
1736 acl_t *acep = p->aclp; in grp_mask_to_mode()
1739 for (ap = (ace_t *)acl_data(acep); acecnt--; ap++) { in grp_mask_to_mode()
1741 if (ap->a_type != ACE_ACCESS_ALLOWED_ACE_TYPE && in grp_mask_to_mode()
1742 ap->a_type != ACE_ACCESS_DENIED_ACE_TYPE) in grp_mask_to_mode()
1745 if (ap->a_flags & ACE_INHERIT_ONLY_ACE) in grp_mask_to_mode()
1753 flags = ap->a_flags & ACE_TYPE_FLAGS; in grp_mask_to_mode()
1755 ap->a_who == p->lgid) || flags == ACE_EVERYONE) { in grp_mask_to_mode()
1756 if (ap->a_access_mask & ACE_READ_DATA) { in grp_mask_to_mode()
1759 if (IS_TYPE_ALLOWED(ap->a_type)) in grp_mask_to_mode()
1763 if (ap->a_access_mask & ACE_WRITE_DATA) { in grp_mask_to_mode()
1766 if (IS_TYPE_ALLOWED(ap->a_type)) in grp_mask_to_mode()
1770 if (ap->a_access_mask & ACE_EXECUTE) { in grp_mask_to_mode()
1773 if (IS_TYPE_ALLOWED(ap->a_type)) in grp_mask_to_mode()
1784 * argfl = 1 if file is a name in ls-command and = 0
1818 perror("ls"); in gstat()
1849 /* Initialize non-zero members */ in gstat()
1850 rep->lat.tv_sec = rep->lct.tv_sec = rep->lmt.tv_sec = starttime; in gstat()
1870 nfiles--; in gstat()
1875 * If -H was specified, and the file linked to was in gstat()
1887 rep->lnum = statb.st_ino; in gstat()
1888 rep->lsize = statb.st_size; in gstat()
1889 rep->lblocks = statb.st_blocks; in gstat()
1891 rep->color = ls_color_find(file, statb.st_mode); in gstat()
1895 rep->ltype = 'd'; in gstat()
1902 rep->ltype = 'b'; in gstat()
1903 rep->lsize = (off_t)statb.st_rdev; in gstat()
1906 rep->ltype = 'c'; in gstat()
1907 rep->lsize = (off_t)statb.st_rdev; in gstat()
1910 rep->ltype = 'p'; in gstat()
1913 rep->ltype = 's'; in gstat()
1914 rep->lsize = 0; in gstat()
1922 rep->ltype = 'l'; in gstat()
1932 * eg, /bin -> /sym/bin/ in gstat()
1940 rep->link_color = in gstat()
1944 rep->link_color = in gstat()
1970 rep->flinkto = strdup(buf); in gstat()
1971 if (rep->flinkto == NULL) { in gstat()
1972 perror("ls"); in gstat()
1980 * ls /sym behaves differently from ls /sym/ in gstat()
1986 /* Do not follow a symlink when -F is specified */ in gstat()
1990 /* Follow a symlink when -F is specified */ in gstat()
1996 rep->ltype = 'd'; in gstat()
1997 rep->lsize = statb1.st_size; in gstat()
2005 rep->ltype = 'D'; in gstat()
2008 rep->ltype = '-'; in gstat()
2011 rep->ltype = 'P'; in gstat()
2014 rep->ltype = '?'; in gstat()
2017 rep->lflags = statb.st_mode & ~S_IFMT; in gstat()
2020 rep->lflags |= LS_NOTREG; in gstat()
2022 rep->luid = statb.st_uid; in gstat()
2023 rep->lgid = statb.st_gid; in gstat()
2024 rep->lnl = statb.st_nlink; in gstat()
2026 rep->lmtime = statb.st_atim; in gstat()
2028 rep->lmtime = statb.st_ctim; in gstat()
2030 rep->lmtime = statb.st_mtim; in gstat()
2031 rep->lat = statb.st_atim; in gstat()
2032 rep->lct = statb.st_ctim; in gstat()
2033 rep->lmt = statb.st_mtim; in gstat()
2038 error = acl_get(file, 0, &rep->aclp); in gstat()
2041 gettext("ls: can't read ACL on %s: %s\n"), in gstat()
2043 rep->acl = ' '; in gstat()
2048 rep->acl = ' '; in gstat()
2050 if (rep->aclp && in gstat()
2051 ((acl_flags(rep->aclp) & ACL_IS_TRIVIAL) == 0)) { in gstat()
2052 rep->acl = '+'; in gstat()
2056 if (acl_type(rep->aclp) == ACLENT_T) { in gstat()
2058 * For files with non-trivial acls, the in gstat()
2079 aclcnt = acl_cnt(rep->aclp); in gstat()
2081 (aclent_t *)acl_data(rep->aclp); in gstat()
2082 aclcnt--; tp++) { in gstat()
2083 if (tp->a_type == GROUP_OBJ) { in gstat()
2084 groupperm = tp->a_perm; in gstat()
2088 if (tp->a_type == CLASS_OBJ) { in gstat()
2089 mask = tp->a_perm; in gstat()
2097 /* reset all the group bits */ in gstat()
2098 rep->lflags &= ~S_IRWXG; in gstat()
2106 rep->lflags |= (groupperm & mask) << 3; in gstat()
2108 } else if (acl_type(rep->aclp) == ACE_T) { in gstat()
2111 rep->lflags &= ~S_IRWXG; in gstat()
2112 rep->lflags |= mode; in gstat()
2116 if (!vflg && !Vflg && rep->aclp) { in gstat()
2117 acl_free(rep->aclp); in gstat()
2118 rep->aclp = NULL; in gstat()
2122 rep->acl = '@'; in gstat()
2125 rep->acl = ' '; in gstat()
2127 /* mask ISARG and other file-type bits */ in gstat()
2129 if (rep->ltype != 'b' && rep->ltype != 'c') in gstat()
2130 tblocks += rep->lblocks; in gstat()
2144 rep->exttr = xmalloc(sacnt * sizeof (struct attrb), in gstat()
2149 rep->exttr[i].name = NULL; in gstat()
2152 gettext("ls:Failed to retrieve " in gstat()
2155 rep->exttr[0].name = xmalloc(2, rep); in gstat()
2156 (void) strlcpy(rep->exttr[0].name, "?", 2); in gstat()
2165 * dir and file are null-terminated strings.
2184 if (dp > dfile && *(dp - 1) != '/') in makename()
2213 if (val == c->val) { in findincache()
2216 } else if (val < c->val) { in findincache()
2217 parent = &c->lesschild; in findincache()
2218 c = c->lesschild; in findincache()
2220 parent = &c->grtrchild; in findincache()
2221 c = c->grtrchild; in findincache()
2228 perror("ls"); in findincache()
2232 c->val = val; in findincache()
2254 if (c->initted == 0) { in getname()
2258 SCPYN(&c->name[0], sid); in getname()
2261 SCPYN(&c->name[0], pwent->pw_name); in getname()
2263 (void) sprintf(&c->name[0], "%-8u", (int)uid); in getname()
2265 c->initted = 1; in getname()
2268 lastuname = &c->name[0]; in getname()
2290 if (c->initted == 0) { in getgroup()
2294 SCPYN(&c->name[0], sid); in getgroup()
2297 SCPYN(&c->name[0], grent->gr_name); in getgroup()
2299 (void) sprintf(&c->name[0], "%-8u", (int)gid); in getgroup()
2301 c->initted = 1; in getgroup()
2304 lastgname = &c->name[0]; in getgroup()
2321 if (c->initted == 0) { in getusid()
2324 SCPYN(&c->name[0], sid); in getusid()
2327 (void) sprintf(&c->name[0], "%-8u", (int)uid); in getusid()
2329 c->initted = 1; in getusid()
2332 return (&c->name[0]); in getusid()
2348 if (c->initted == 0) { in getgsid()
2351 SCPYN(&c->name[0], sid); in getgsid()
2354 (void) sprintf(&c->name[0], "%-8u", (int)gid); in getgsid()
2356 c->initted = 1; in getgsid()
2359 return (&c->name[0]); in getgsid()
2372 * compare two names in ls-command one of which is file in compar()
2375 * a directory name of ls-command; in compar()
2377 if (p1->lflags&ISARG && p1->ltype == 'd') { in compar()
2378 if (!(p2->lflags&ISARG && p2->ltype == 'd')) in compar()
2381 if (p2->lflags&ISARG && p2->ltype == 'd') in compar()
2382 return (-1); in compar()
2386 if (p2->lmtime.tv_sec > p1->lmtime.tv_sec) in compar()
2388 else if (p2->lmtime.tv_sec < p1->lmtime.tv_sec) in compar()
2389 return (-rflg); in compar()
2391 if (p2->lmtime.tv_nsec > p1->lmtime.tv_nsec) in compar()
2393 else if (p2->lmtime.tv_nsec < p1->lmtime.tv_nsec) in compar()
2394 return (-rflg); in compar()
2407 off_t p1size = (p1->ltype == 'b') || in compar()
2408 (p1->ltype == 'c') ? 0 : p1->lsize; in compar()
2409 off_t p2size = (p2->ltype == 'b') || in compar()
2410 (p2->ltype == 'c') ? 0 : p2->lsize; in compar()
2414 return (-rflg); in compar()
2419 p1->lflags & ISARG ? p1->ln.namep : p1->ln.lname, in compar()
2420 p2->lflags&ISARG ? p2->ln.namep : p2->ln.lname)); in compar()
2544 perror("ls:getattrat"); in get_sysxattr()
2552 rep->extm = xmalloc(sacnt * sizeof (struct attrtm), rep); in get_sysxattr()
2554 rep->extm[i].stm = 0; in get_sysxattr()
2555 rep->extm[i].nstm = 0; in get_sysxattr()
2556 rep->extm[i].name = NULL; in get_sysxattr()
2596 rep->exttr[fattr].name = xmalloc(len + 1, rep); in set_sysattrb_display()
2597 (void) strlcpy(rep->exttr[fattr].name, name, in set_sysattrb_display()
2600 rep->exttr[fattr].name = xmalloc(len + 3, rep); in set_sysattrb_display()
2601 (void) snprintf(rep->exttr[fattr].name, len + 3, in set_sysattrb_display()
2608 rep->exttr[fattr].name = xmalloc(len + 1, rep); in set_sysattrb_display()
2610 (void) strlcpy(rep->exttr[fattr].name, in set_sysattrb_display()
2613 (void) strlcpy(rep->exttr[fattr].name, in set_sysattrb_display()
2614 "-", len + 1); in set_sysattrb_display()
2634 while (rep->extm[i].stm != 0 && i < sacnt) in set_sysattrtm_display()
2636 rep->extm[i].stm = value[0]; in set_sysattrtm_display()
2637 rep->extm[i].nstm = value[1]; in set_sysattrtm_display()
2638 rep->extm[i].name = xmalloc(len + 1, rep); in set_sysattrtm_display()
2639 (void) strlcpy(rep->extm[i].name, name, len + 1); in set_sysattrtm_display()
2672 if (p->extm != NULL) { in format_attrtime()
2674 if (p->extm[i].name != NULL) { in format_attrtime()
2691 format_time((time_t)p->extm[i].stm, (time_t)p->extm[i].nstm); in format_attrtime()
2712 format_time(p->lat.tv_sec, p->lat.tv_nsec); in print_time()
2714 format_time(p->lct.tv_sec, p->lct.tv_nsec); in print_time()
2716 format_time(p->lmt.tv_sec, p->lmt.tv_nsec); in print_time()
2718 if (p->extm != NULL) { in print_time()
2719 while (p->extm[i].nstm != 0 && i < sacnt) { in print_time()
2720 format_time(p->extm[i].stm, p->extm[i].nstm); in print_time()
2721 if (p->extm[i].name != NULL) { in print_time()
2724 p->extm[i].name, time_buf); in print_time()
2740 switch (color->ftype) { in color_match()
2746 sfx_len = strlen(color->sfx); in color_match()
2750 if (strcmp(color->sfx, fname + fname_len - sfx_len) == 0) in color_match()
2819 switch (c->ftype) { in dump_color()
2886 (void) printf("\tpattern: %s", c->sfx); in dump_color()
2890 (void) printf("\tattr: %d\n", c->attr); in dump_color()
2891 (void) printf("\tfg: %d\n", c->fg); in dump_color()
2892 (void) printf("\tbg: %d\n", c->bg); in dump_color()
2903 * lsc_colors[lsc_ncolors - 1] by ls_color_init(). Start search with in ls_color_find()
2906 for (i = lsc_ncolors - 1; i >= 0; --i) in ls_color_find()
2937 if (c->attr & LSA_BOLD) in ls_start_color()
2939 if (c->attr & LSA_UNDERSCORE) in ls_start_color()
2941 if (c->attr & LSA_BLINK) in ls_start_color()
2943 if (c->attr & LSA_REVERSE) in ls_start_color()
2945 if (c->attr & LSA_CONCEALED) in ls_start_color()
2947 if (c->attr == LSA_NONE) in ls_start_color()
2950 if (c->fg != -1) in ls_start_color()
2951 ls_tprint(lsc_setfg, c->fg, 0, 0, 0, 0, 0, 0, 0, 0); in ls_start_color()
2952 if (c->bg != -1) in ls_start_color()
2953 ls_tprint(lsc_setbg, c->bg, 0, 0, 0, 0, 0, 0, 0, 0); in ls_start_color()
3024 lsc_colors[lsc_ncolors].fg = -1; in new_color_entry()
3025 lsc_colors[lsc_ncolors].bg = -1; in new_color_entry()
3056 lsc_colors[lsc_ncolors].fg = color - 30; in new_color_entry()
3058 lsc_colors[lsc_ncolors].bg = color - 40; in new_color_entry()
3071 int ret = c1->ftype - c2->ftype; in ls_color_compare()
3076 if (c1->ftype != LS_PAT) in ls_color_compare()
3079 return (strcmp(c1->sfx, c2->sfx)); in ls_color_compare()
3142 if ((lsc_bold = tigetstr("bold")) == (char *)-1) in ls_color_init()
3145 if ((lsc_underline = tigetstr("smul")) == (char *)-1) in ls_color_init()
3148 if ((lsc_blink = tigetstr("blink")) == (char *)-1) in ls_color_init()
3151 if ((lsc_reverse = tigetstr("rev")) == (char *)-1) in ls_color_init()
3154 if ((lsc_concealed = tigetstr("prot")) == (char *)-1) in ls_color_init()
3157 if ((lsc_none = tigetstr("sgr0")) == (char *)-1) in ls_color_init()
3160 if ((lsc_setfg = tigetstr("setaf")) == (char *)-1) in ls_color_init()
3163 if ((lsc_setbg = tigetstr("setab")) == (char *)-1) in ls_color_init()
3184 if (p->exttr != NULL) { in free_sysattr()
3186 if (p->exttr[i].name != NULL) in free_sysattr()
3187 free(p->exttr[i].name); in free_sysattr()
3189 free(p->exttr); in free_sysattr()
3191 if (p->extm != NULL) { in free_sysattr()
3193 if (p->extm[i].name != NULL) in free_sysattr()
3194 free(p->extm[i].name); in free_sysattr()
3196 free(p->extm); in free_sysattr()
3206 perror("ls"); in xmalloc()