func: int main(int argc, char **argv) int shmsz ; int shmid ; key_t key ; char * shm , * s ; char * str = NULL ; int c ; int errors = 0 ; char * out_filename = NULL ; while ( ( c = getopt ( argc , argv , "k:s:m:o:h" ) ) != - 1 )  switch ( c )  if ( ( key = strtol ( optarg , NULL , 10 ) ) < 1000 )  errors ++; if ( ( shmsz = atoi ( optarg ) ) <= 0 )  errors ++; out_filename = optarg; str = optarg; errors ++; if ( ! str )  errors ++; if ( strlen ( str ) >= shmsz )  errors ++; if ( errors )  if ( ( shmid = shmget ( key , shmsz , IPC_CREAT | 0666 ) ) < 0 )  if ( ( shm = shmat ( shmid , NULL , 0 ) ) == ( char * ) - 1 )  if ( out_filename )  if ( out_file = fopen ( out_filename , "w" ) )  fprintf ( stdout , "%d" , shmid ); 