We offer the following as a final example:
4043 psig () { register n, p; ......... switch (n) { case SIGQIT: case SIGINS: case SIGTRC: case SIGIOT: case SIGEMT: case SIGEPT: case SIGBUS: case SIGSEG: case SIGSYS: u.u arg[0] = n; if (core()) n =+ 0200; } u.u_arg[0]=(u.u_ar0[R0]<<8) | n; exit (); }
Here the “switch” selects certain values for “n” for which the one set of actions should be carried out.
An alternative would have been to write a “monster” “if” statement such as
if (n==SIGQUIT || n==SIGINS || ... ... || n==SIGSYS)
but that would not have been either transparent or efficient.
Note the addition of an octal constant to “n” and the method of composing a 16 bit value from two eight bit values.