mksubr revision 255219
1#!/bin/sh 2# 3# Copyright (c) 2006 "David Kirchner" <dpk@dpk.net>. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the 12# documentation and/or other materials provided with the distribution. 13# 14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24# SUCH DAMAGE. 25# 26# $FreeBSD: head/usr.bin/kdump/mksubr 255219 2013-09-05 00:09:56Z pjd $ 27# 28# Generates kdump_subr.c 29# mkioctls is a special-purpose script, and works fine as it is 30# now, so it remains independent. The idea behind how it generates 31# its list was heavily borrowed here. 32# 33# Some functions here are automatically generated. This can mean 34# the user will see unusual kdump output or errors while building 35# if the underlying .h files are changed significantly. 36# 37# Key: 38# AUTO: Completely auto-generated with either the "or" or the "switch" 39# method. 40# AUTO - Special: Generated automatically, but with some extra commands 41# that the auto_*_type() functions are inappropriate for. 42# MANUAL: Manually entered and must therefore be manually updated. 43 44set -e 45 46LC_ALL=C; export LC_ALL 47 48if [ -z "$1" ] 49then 50 echo "usage: sh $0 include-dir" 51 exit 1 52fi 53include_dir=$1 54 55# 56# Automatically generates a C function that will print out the 57# numeric input as a pipe-delimited string of the appropriate 58# #define keys. ex: 59# S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH 60# The XOR is necessary to prevent including the "0"-value in every 61# line. 62# 63auto_or_type () { 64 local name grep file 65 name=$1 66 grep=$2 67 file=$3 68 69 cat <<_EOF_ 70/* AUTO */ 71void 72$name(intmax_t arg) 73{ 74 int or = 0; 75 printf("%#jx<", (uintmax_t)arg); 76_EOF_ 77 egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \ 78 $include_dir/$file | \ 79 awk '{ for (i = 1; i <= NF; i++) \ 80 if ($i ~ /define/) \ 81 break; \ 82 ++i; \ 83 printf "\tif (!((arg > 0) ^ ((%s) > 0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }' 84cat <<_EOF_ 85 printf(">"); 86 if (or == 0) 87 printf("<invalid>%jd", arg); 88} 89 90_EOF_ 91} 92 93# 94# Automatically generates a C function used when the argument 95# maps to a single, specific #definition 96# 97auto_switch_type () { 98 local name grep file 99 name=$1 100 grep=$2 101 file=$3 102 103 cat <<_EOF_ 104/* AUTO */ 105void 106$name(intmax_t arg) 107{ 108 switch (arg) { 109_EOF_ 110 egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \ 111 $include_dir/$file | \ 112 awk '{ for (i = 1; i <= NF; i++) \ 113 if ($i ~ /define/) \ 114 break; \ 115 ++i; \ 116 printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }' 117cat <<_EOF_ 118 default: /* Should not reach */ 119 printf("<invalid=%jd>", arg); 120 } 121} 122 123_EOF_ 124} 125 126# 127# Automatically generates a C function used when the argument 128# maps to a #definition 129# 130auto_if_type () { 131 local name grep file 132 name=$1 133 grep=$2 134 file=$3 135 136 cat <<_EOF_ 137/* AUTO */ 138void 139$name(intmax_t arg) 140{ 141_EOF_ 142 egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \ 143 $include_dir/$file | \ 144 awk '{ printf "\t"; \ 145 if (NR > 1) \ 146 printf "else " ; \ 147 printf "if (arg == %s) \n\t\tprintf(\"%s\");\n", $2, $2 }' 148cat <<_EOF_ 149 else /* Should not reach */ 150 printf("<invalid=%jd>", arg); 151} 152 153_EOF_ 154} 155 156# C start 157 158cat <<_EOF_ 159#include <stdint.h> 160#include <stdio.h> 161#include <sys/fcntl.h> 162#include <sys/stat.h> 163#include <sys/unistd.h> 164#include <sys/mman.h> 165#include <sys/wait.h> 166#define _KERNEL 167#include <sys/socket.h> 168#undef _KERNEL 169#include <netinet/in.h> 170#include <sys/param.h> 171#include <sys/mount.h> 172#include <sys/ptrace.h> 173#include <sys/resource.h> 174#include <sys/reboot.h> 175#include <sched.h> 176#include <sys/linker.h> 177#define _KERNEL 178#include <sys/thr.h> 179#undef _KERNEL 180#include <sys/extattr.h> 181#include <sys/acl.h> 182#include <aio.h> 183#include <sys/sem.h> 184#include <sys/ipc.h> 185#include <sys/rtprio.h> 186#include <sys/shm.h> 187#include <nfsserver/nfs.h> 188#include <ufs/ufs/quota.h> 189#include <sys/capability.h> 190#include <vm/vm.h> 191#include <vm/vm_param.h> 192 193#include "kdump_subr.h" 194 195/* 196 * These are simple support macros. print_or utilizes a variable 197 * defined in the calling function to track whether or not it should 198 * print a logical-OR character ('|') before a string. if_print_or 199 * simply handles the necessary "if" statement used in many lines 200 * of this file. 201 */ 202#define print_or(str,orflag) do { \\ 203 if (orflag) putchar('|'); else orflag = 1; \\ 204 printf (str); } \\ 205 while (0) 206#define if_print_or(i,flag,orflag) do { \\ 207 if ((i & flag) == flag) \\ 208 print_or(#flag,orflag); } \\ 209 while (0) 210 211/* MANUAL */ 212void 213atfdname(int fd, int decimal) 214{ 215 if (fd == AT_FDCWD) 216 printf("AT_FDCWD"); 217 else if (decimal) 218 printf("%d", fd); 219 else 220 printf("%#x", fd); 221} 222 223/* MANUAL */ 224extern char *signames[]; /* from kdump.c */ 225void 226signame(int sig) 227{ 228 if (sig > 0 && sig < NSIG) 229 printf("SIG%s",signames[sig]); 230 else 231 printf("SIG %d", sig); 232} 233 234/* MANUAL */ 235void 236semctlname(int cmd) 237{ 238 switch (cmd) { 239 case GETNCNT: 240 printf("GETNCNT"); 241 break; 242 case GETPID: 243 printf("GETPID"); 244 break; 245 case GETVAL: 246 printf("GETVAL"); 247 break; 248 case GETALL: 249 printf("GETALL"); 250 break; 251 case GETZCNT: 252 printf("GETZCNT"); 253 break; 254 case SETVAL: 255 printf("SETVAL"); 256 break; 257 case SETALL: 258 printf("SETALL"); 259 break; 260 case IPC_RMID: 261 printf("IPC_RMID"); 262 break; 263 case IPC_SET: 264 printf("IPC_SET"); 265 break; 266 case IPC_STAT: 267 printf("IPC_STAT"); 268 break; 269 default: /* Should not reach */ 270 printf("<invalid=%d>", cmd); 271 } 272} 273 274/* MANUAL */ 275void 276shmctlname(int cmd) 277{ 278 switch (cmd) { 279 case IPC_RMID: 280 printf("IPC_RMID"); 281 break; 282 case IPC_SET: 283 printf("IPC_SET"); 284 break; 285 case IPC_STAT: 286 printf("IPC_STAT"); 287 break; 288 default: /* Should not reach */ 289 printf("<invalid=%d>", cmd); 290 } 291} 292 293/* MANUAL */ 294void 295semgetname(int flag) 296{ 297 int or = 0; 298 if_print_or(flag, IPC_CREAT, or); 299 if_print_or(flag, IPC_EXCL, or); 300 if_print_or(flag, SEM_R, or); 301 if_print_or(flag, SEM_A, or); 302 if_print_or(flag, (SEM_R>>3), or); 303 if_print_or(flag, (SEM_A>>3), or); 304 if_print_or(flag, (SEM_R>>6), or); 305 if_print_or(flag, (SEM_A>>6), or); 306} 307 308/* 309 * MANUAL 310 * 311 * Only used by SYS_open. Unless O_CREAT is set in flags, the 312 * mode argument is unused (and often bogus and misleading). 313 */ 314void 315flagsandmodename(int flags, int mode, int decimal) 316{ 317 flagsname(flags); 318 putchar(','); 319 if ((flags & O_CREAT) == O_CREAT) { 320 modename (mode); 321 } else { 322 if (decimal) { 323 printf("<unused>%d", mode); 324 } else { 325 printf("<unused>%#x", (unsigned int)mode); 326 } 327 } 328} 329 330/* 331 * MANUAL 332 * 333 * [g|s]etsockopt's level argument can either be SOL_SOCKET or a value 334 * referring to a line in /etc/protocols . It might be appropriate 335 * to use getprotoent(3) here. 336 */ 337void 338sockoptlevelname(int level, int decimal) 339{ 340 if (level == SOL_SOCKET) { 341 printf("SOL_SOCKET"); 342 } else { 343 if (decimal) { 344 printf("%d", level); 345 } else { 346 printf("%#x", (unsigned int)level); 347 } 348 } 349} 350 351/* 352 * MANUAL 353 * 354 * Used for page fault type. Cannot use auto_or_type since the macro 355 * values contain a cast. Also, VM_PROT_NONE has to be handled specially. 356 */ 357void 358vmprotname (int type) 359{ 360 int or = 0; 361 362 if (type == VM_PROT_NONE) { 363 (void)printf("VM_PROT_NONE"); 364 return; 365 } 366 if_print_or(type, VM_PROT_READ, or); 367 if_print_or(type, VM_PROT_WRITE, or); 368 if_print_or(type, VM_PROT_EXECUTE, or); 369 if_print_or(type, VM_PROT_COPY, or); 370} 371 372/* 373 * MANUAL 374 */ 375void 376socktypenamewithflags(int type) 377{ 378 if (type & SOCK_CLOEXEC) 379 printf("SOCK_CLOEXEC|"), type &= ~SOCK_CLOEXEC; 380 if (type & SOCK_NONBLOCK) 381 printf("SOCK_NONBLOCK|"), type &= ~SOCK_NONBLOCK; 382 socktypename(type); 383} 384_EOF_ 385 386auto_or_type "accessmodename" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "sys/unistd.h" 387auto_switch_type "acltypename" "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+" "sys/acl.h" 388auto_or_type "capfcntlname" "CAP_FCNTL_[A-Z]+[[:space:]]+\(1" "sys/capability.h" 389auto_switch_type "extattrctlname" "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h" 390auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h" 391auto_or_type "flagsname" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h" 392auto_or_type "flockname" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h" 393auto_or_type "getfsstatflagsname" "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*" "sys/mount.h" 394auto_switch_type "kldsymcmdname" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" 395auto_switch_type "kldunloadfflagsname" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" 396auto_switch_type "lio_listioname" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h" 397auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h" 398auto_switch_type "minheritname" "INHERIT_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h" 399auto_or_type "mlockallname" "MCL_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h" 400auto_or_type "mmapprotname" "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h" 401auto_or_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h" 402auto_or_type "mountflagsname" "MNT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mount.h" 403auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h" 404auto_or_type "nfssvcname" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/nfssvc.h" 405auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h" 406auto_switch_type "ptraceopname" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h" 407auto_switch_type "quotactlname" "Q_[A-Z]+[[:space:]]+0x[0-9]+" "ufs/ufs/quota.h" 408auto_or_type "rebootoptname" "RB_[A-Z]+[[:space:]]+0x[0-9]+" "sys/reboot.h" 409auto_or_type "rforkname" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/unistd.h" 410auto_switch_type "rlimitname" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h" 411auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h" 412auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h" 413auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h" 414auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h" 415auto_switch_type "sigbuscodename" "BUS_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" 416auto_switch_type "sigchldcodename" "CLD_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" 417auto_switch_type "sigfpecodename" "FPE_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" 418auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" 419auto_switch_type "sigillcodename" "ILL_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" 420auto_switch_type "sigsegvcodename" "SEGV_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" 421auto_switch_type "sigtrapcodename" "TRAP_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" 422auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h" 423auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h" 424auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h" 425auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" 426auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" 427auto_or_type "thrcreateflagsname" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" 428auto_switch_type "vmresultname" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h" 429auto_or_type "wait4optname" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h" 430auto_switch_type "whencename" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h" 431 432cat <<_EOF_ 433/* 434 * AUTO - Special 435 * F_ is used to specify fcntl commands as well as arguments. Both sets are 436 * grouped in fcntl.h, and this awk script grabs the first group. 437 */ 438void 439fcntlcmdname(int cmd, int arg, int decimal) 440{ 441 switch (cmd) { 442_EOF_ 443egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]*" \ 444 $include_dir/sys/fcntl.h | \ 445 awk 'BEGIN { o=0 } { for (i = 1; i <= NF; i++) \ 446 if ($i ~ /define/) \ 447 break; \ 448 ++i; \ 449 if (o <= $(i+1)) \ 450 printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i; \ 451 else \ 452 exit; \ 453 o = $(i+1) }' 454cat <<_EOF_ 455 default: /* Should not reach */ 456 printf("<invalid=%d>", cmd); 457 } 458 putchar(','); 459 if (cmd == F_GETFD || cmd == F_SETFD) { 460 if (arg == FD_CLOEXEC) 461 printf("FD_CLOEXEC"); 462 else if (arg == 0) 463 printf("0"); 464 else { 465 if (decimal) 466 printf("<invalid>%d", arg); 467 else 468 printf("<invalid>%#x", (unsigned int)arg); 469 } 470 } else if (cmd == F_SETFL) { 471 flagsname(arg); 472 } else { 473 if (decimal) 474 printf("%d", arg); 475 else 476 printf("%#x", (unsigned int)arg); 477 } 478} 479 480/* 481 * AUTO - Special 482 * 483 * The MAP_ALIGNED flag requires special handling. 484 */ 485void 486mmapflagsname(int flags) 487{ 488 int align; 489 int or = 0; 490 printf("%#x<", flags); 491_EOF_ 492egrep "^#[[:space:]]*define[[:space:]]+MAP_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+[[:space:]]*" \ 493 $include_dir/sys/mman.h | grep -v MAP_ALIGNED | \ 494 awk '{ for (i = 1; i <= NF; i++) \ 495 if ($i ~ /define/) \ 496 break; \ 497 ++i; \ 498 printf "\tif (!((flags > 0) ^ ((%s) > 0)))\n\t\tif_print_or(flags, %s, or);\n", $i, $i }' 499cat <<_EOF_ 500 align = flags & MAP_ALIGNMENT_MASK; 501 if (align != 0) { 502 if (align == MAP_ALIGNED_SUPER) 503 print_or("MAP_ALIGNED_SUPER", or); 504 else { 505 print_or("MAP_ALIGNED", or); 506 printf("(%d)", align >> MAP_ALIGNMENT_SHIFT); 507 } 508 } 509 printf(">"); 510 if (or == 0) 511 printf("<invalid>%d", flags); 512} 513 514/* 515 * AUTO - Special 516 * 517 * The only reason this is not fully automated is due to the 518 * grep -v RTP_PRIO statement. A better egrep line should 519 * make this capable of being a auto_switch_type() function. 520 */ 521void 522rtprioname(int func) 523{ 524 switch (func) { 525_EOF_ 526egrep "^#[[:space:]]*define[[:space:]]+RTP_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" \ 527 $include_dir/sys/rtprio.h | grep -v RTP_PRIO | \ 528 awk '{ for (i = 1; i <= NF; i++) \ 529 if ($i ~ /define/) \ 530 break; \ 531 ++i; \ 532 printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }' 533cat <<_EOF_ 534 default: /* Should not reach */ 535 printf("<invalid=%d>", func); 536 } 537} 538 539/* 540 * AUTO - Special 541 * 542 * The send and recv functions have a flags argument which can be 543 * set to 0. There is no corresponding #define. The auto_ functions 544 * detect this as "invalid", which is incorrect here. 545 */ 546void 547sendrecvflagsname(int flags) 548{ 549 int or = 0; 550 551 if (flags == 0) { 552 printf("0"); 553 return; 554 } 555 556 printf("%#x<", flags); 557_EOF_ 558egrep "^#[[:space:]]*define[[:space:]]+MSG_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" $include_dir/sys/socket.h | \ 559 awk '{ for (i = 1; i <= NF; i++) \ 560 if ($i ~ /define/) \ 561 break; \ 562 ++i; \ 563 printf "\tif(!((flags>0)^((%s)>0)))\n\t\tif_print_or(flags, %s, or);\n", $i, $i }' 564cat <<_EOF_ 565 printf(">"); 566} 567 568/* 569 * AUTO - Special 570 * 571 * Check general codes first, then defer to signal-specific codes. 572 */ 573void 574sigcodename(int sig, int code) 575{ 576 switch (code) { 577_EOF_ 578egrep "^#[[:space:]]*define[[:space:]]+SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?[[:space:]]*" \ 579 $include_dir/sys/signal.h | grep -v SI_UNDEFINED | \ 580 awk '{ for (i = 1; i <= NF; i++) \ 581 if ($i ~ /define/) \ 582 break; \ 583 ++i; \ 584 printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }' 585cat <<_EOF_ 586 default: 587 switch (sig) { 588 case SIGILL: 589 sigillcodename(code); 590 break; 591 case SIGBUS: 592 sigbuscodename(code); 593 break; 594 case SIGSEGV: 595 sigsegvcodename(code); 596 break; 597 case SIGFPE: 598 sigfpecodename(code); 599 break; 600 case SIGTRAP: 601 sigtrapcodename(code); 602 break; 603 case SIGCHLD: 604 sigchldcodename(code); 605 break; 606 default: 607 printf("<invalid=%#x>", code); 608 } 609 } 610} 611 612_EOF_ 613egrep '#define[[:space:]]+CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)' \ 614 $include_dir/sys/capability.h | \ 615 sed -E 's/[ ]+/ /g' | \ 616 awk -F '[ \(,\)]' ' 617 BEGIN { 618 printf "void\n" 619 printf "capname(const cap_rights_t *rightsp)\n" 620 printf "{\n" 621 printf "\tint comma = 0;\n\n" 622 printf "\tprintf(\"<\");\n" 623 } 624 { 625 printf "\tif ((rightsp->cr_rights[%s] & %s) == %s) {\n", $4, $2, $2 626 printf "\t\tif (comma) printf(\",\"); else comma = 1;\n" 627 printf "\t\tprintf(\"%s\");\n", $2 628 printf "\t}\n" 629 } 630 END { 631 printf "\tprintf(\">\");\n" 632 printf "}\n" 633 }' 634