Print this page
10476 file(1) could be smatch clean
10366 ld(1) should support GNU-style linker sets
10581 ld(1) should know kernel modules are a thing


 836                                     gettext("[nt]roff, tbl, or eqn input "
 837                                     "text"));
 838                                 goto outa;
 839                         }
 840                 }
 841         }
 842         (void) printf(gettext("assembler program text"));
 843         goto outa;
 844 notas:
 845         /* start modification for multibyte env */
 846         IS_ascii = 1;
 847         if (fbsz < FBSZ)
 848                 Max = fbsz;
 849         else
 850                 Max = FBSZ - MB_LEN_MAX; /* prevent cut of wchar read */
 851         /* end modification for multibyte env */
 852 
 853         for (i = 0; i < Max; /* null */)
 854                 if (fbuf[i] & 0200) {
 855                         IS_ascii = 0;
 856                         if (fbuf[0] == '\100' && fbuf[1] == '\357') {

 857                                 (void) printf(gettext("troff output\n"));
 858                                 return;
 859                         }
 860                 /* start modification for multibyte env */
 861                         if ((length = mbtowc(&wchar, &fbuf[i], MB_CUR_MAX))
 862                             <= 0 || !iswprint(wchar)) {
 863                                 (void) printf(gettext("data\n"));
 864                                 return;
 865                         }
 866                         i += length;
 867                 }
 868                 else
 869                         i++;
 870         i = fbsz;
 871                 /* end modification for multibyte env */
 872         if (mbuf.st_mode&(S_IXUSR|S_IXGRP|S_IXOTH))
 873                 (void) printf(gettext("commands text"));
 874         else if (troffint(fbuf, fbsz))
 875                 (void) printf(gettext("troff intermediate output text"));
 876         else if (english(fbuf, fbsz))


1313         (void) printf("%s", gettext("ELF"));
1314         print_elf_class(class);
1315         print_elf_datatype(format);
1316         print_elf_type(EInfo);
1317 
1318         if (EInfo.core_type != EC_NOTCORE) {
1319                 /* Print what kind of core is this */
1320                 if (EInfo.core_type == EC_OLDCORE)
1321                         (void) printf(" %s", gettext("pre-2.6 core file"));
1322                 else
1323                         (void) printf(" %s", gettext("core file"));
1324         }
1325 
1326         /* Print machine info */
1327         print_elf_machine(EInfo.machine);
1328 
1329         /* Print Version */
1330         if (version == 1)
1331                 (void) printf(" %s %d", gettext("Version"), version);
1332 




1333         /* Print Flags */
1334         print_elf_flags(EInfo);
1335 
1336         /* Last bit, if it is a core */
1337         if (EInfo.core_type != EC_NOTCORE) {
1338                 /* Print the program name that dumped this core */
1339                 (void) printf(gettext(", from '%s'"), EInfo.fname);
1340                 return (0);
1341         }
1342 
1343         /* Print Capabilities */
1344         if (EInfo.cap_str[0] != '\0')
1345                 (void) printf(" [%s]", EInfo.cap_str);
1346 
1347         if ((EInfo.type != ET_EXEC) && (EInfo.type != ET_DYN))
1348                 return (0);
1349 
1350         /* Print if it is dynamically linked */
1351         if (EInfo.dynamic)
1352                 (void) printf(gettext(", dynamically linked"));


1466  * starting at the current position of 'i'.
1467  * Returns 1 as long as we don't increment i past the
1468  * size of fbuf (fbsz).  Otherwise returns 0.
1469  */
1470 
1471 static int
1472 ascom(void)
1473 {
1474         while (fbuf[i] == ASCOMCHAR) {
1475                 i++;
1476                 while (fbuf[i++] != '\n')
1477                         if (i >= fbsz)
1478                                 return (0);
1479                 while (fbuf[i] == '\n')
1480                         if (i++ >= fbsz)
1481                                 return (0);
1482         }
1483         return (1);
1484 }
1485 

1486 static int
1487 sccs(void)
1488 {                               /* look for "1hddddd" where d is a digit */
1489         register int j;
1490 
1491         if (fbuf[0] == 1 && fbuf[1] == 'h') {
1492                 for (j = 2; j <= 6; j++) {
1493                         if (isdigit(fbuf[j]))
1494                                 continue;
1495                         else
1496                                 return (0);
1497                 }
1498         } else {
1499                 return (0);
1500         }
1501         return (1);
1502 }
1503 
1504 static int
1505 english(char *bp, int n)
1506 {
1507 #define NASC 128                /* number of ascii char ?? */
1508         register int    j, vow, freq, rare, len;




 836                                     gettext("[nt]roff, tbl, or eqn input "
 837                                     "text"));
 838                                 goto outa;
 839                         }
 840                 }
 841         }
 842         (void) printf(gettext("assembler program text"));
 843         goto outa;
 844 notas:
 845         /* start modification for multibyte env */
 846         IS_ascii = 1;
 847         if (fbsz < FBSZ)
 848                 Max = fbsz;
 849         else
 850                 Max = FBSZ - MB_LEN_MAX; /* prevent cut of wchar read */
 851         /* end modification for multibyte env */
 852 
 853         for (i = 0; i < Max; /* null */)
 854                 if (fbuf[i] & 0200) {
 855                         IS_ascii = 0;
 856                         if ((fbuf[0] == '\100') &&
 857                             ((uchar_t)fbuf[1] == (uchar_t)'\357')) {
 858                                 (void) printf(gettext("troff output\n"));
 859                                 return;
 860                         }
 861                 /* start modification for multibyte env */
 862                         if ((length = mbtowc(&wchar, &fbuf[i], MB_CUR_MAX))
 863                             <= 0 || !iswprint(wchar)) {
 864                                 (void) printf(gettext("data\n"));
 865                                 return;
 866                         }
 867                         i += length;
 868                 }
 869                 else
 870                         i++;
 871         i = fbsz;
 872                 /* end modification for multibyte env */
 873         if (mbuf.st_mode&(S_IXUSR|S_IXGRP|S_IXOTH))
 874                 (void) printf(gettext("commands text"));
 875         else if (troffint(fbuf, fbsz))
 876                 (void) printf(gettext("troff intermediate output text"));
 877         else if (english(fbuf, fbsz))


1314         (void) printf("%s", gettext("ELF"));
1315         print_elf_class(class);
1316         print_elf_datatype(format);
1317         print_elf_type(EInfo);
1318 
1319         if (EInfo.core_type != EC_NOTCORE) {
1320                 /* Print what kind of core is this */
1321                 if (EInfo.core_type == EC_OLDCORE)
1322                         (void) printf(" %s", gettext("pre-2.6 core file"));
1323                 else
1324                         (void) printf(" %s", gettext("core file"));
1325         }
1326 
1327         /* Print machine info */
1328         print_elf_machine(EInfo.machine);
1329 
1330         /* Print Version */
1331         if (version == 1)
1332                 (void) printf(" %s %d", gettext("Version"), version);
1333 
1334         if (EInfo.kmod) {
1335                 (void) printf(", %s", gettext("kernel module"));
1336         }
1337 
1338         /* Print Flags */
1339         print_elf_flags(EInfo);
1340 
1341         /* Last bit, if it is a core */
1342         if (EInfo.core_type != EC_NOTCORE) {
1343                 /* Print the program name that dumped this core */
1344                 (void) printf(gettext(", from '%s'"), EInfo.fname);
1345                 return (0);
1346         }
1347 
1348         /* Print Capabilities */
1349         if (EInfo.cap_str[0] != '\0')
1350                 (void) printf(" [%s]", EInfo.cap_str);
1351 
1352         if ((EInfo.type != ET_EXEC) && (EInfo.type != ET_DYN))
1353                 return (0);
1354 
1355         /* Print if it is dynamically linked */
1356         if (EInfo.dynamic)
1357                 (void) printf(gettext(", dynamically linked"));


1471  * starting at the current position of 'i'.
1472  * Returns 1 as long as we don't increment i past the
1473  * size of fbuf (fbsz).  Otherwise returns 0.
1474  */
1475 
1476 static int
1477 ascom(void)
1478 {
1479         while (fbuf[i] == ASCOMCHAR) {
1480                 i++;
1481                 while (fbuf[i++] != '\n')
1482                         if (i >= fbsz)
1483                                 return (0);
1484                 while (fbuf[i] == '\n')
1485                         if (i++ >= fbsz)
1486                                 return (0);
1487         }
1488         return (1);
1489 }
1490 
1491 /* look for "1hddddd" where d is a digit */
1492 static int
1493 sccs(void)
1494 {
1495         register int j;
1496 
1497         if (fbuf[0] == 1 && fbuf[1] == 'h') {
1498                 for (j = 2; j <= 6; j++) {
1499                         if (isdigit(fbuf[j]))
1500                                 continue;
1501                         else
1502                                 return (0);
1503                 }
1504         } else {
1505                 return (0);
1506         }
1507         return (1);
1508 }
1509 
1510 static int
1511 english(char *bp, int n)
1512 {
1513 #define NASC 128                /* number of ascii char ?? */
1514         register int    j, vow, freq, rare, len;