title: ‘main’ is normally a non-static function ERROR
body: <p>There are two errors that show up:
  main.c:80: warning: ‘main’ is normally a non-static function
  main.c:88: error: expected declaration or statement at end of input
  and I cant't seem to find the problem... There number of curly braces is equal... What seems to be the problem?</p>
  <pre><code>   #include &lt;unistd.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;getopt.h&gt;
  #include &lt;string.h&gt;
  #include &quot;main-getopt.h&quot;
  
  
  void print_usage_and_abort( const char *message )
  {
      if( NULL != message )
          fprintf( stderr, &quot;Error: %s\n&quot;, message );
      
      fprintf( stderr, &quot;Usage: partitioner -n &lt;nodes&gt; [ -f &lt;basename&gt; ]\n\n&quot; );
      exit( -1 );
  }
  
  void parsing (int argc, char **argv, struct Params *params)
  {
          char error_message[256];
  
      params-&gt;nodes = 0;
      memcpy( params-&gt;filename_base, &quot;output&quot;, strlen(&quot;output&quot;) + 1 );
  
      int opt;
      size_t len;
      int numarg;
  
  while ((opt = getopt(argc, argv, &quot;n:f:&quot;)) != -1) {
          int i;
      for (i = 1; i &lt; argc; i++)
      {
          if (argv[i][0] == '-')
          {
              if (i+1 == argc || argv[i+1][0] == '-')
              {
                  sprintf( error_message, &quot;No Filename&quot;);
                      print_usage_and_abort( error_message );
              }
              if (argv[i][1] == 'n')
              {
                  numarg = atoi( optarg );
                  if( numarg &lt; 1 || numarg &gt; 2048 )
                  {
                      sprintf( error_message, &quot;Number of nodes agrument expects a number between 1 and 2048, actual %s&quot;, optarg );
                      print_usage_and_abort( error_message );
                  }
                  }
              else if (argv[i][1] == 'f')
                  len = strlen( optarg );
  
                  // limit to buffer capacity
                  if( len &gt;= MAX_FILENAME_BASE )
                  {
                      sprintf( error_message, &quot;Base filename parameter length is expected to be less than %d but is %d&quot;, (int)MAX_FILENAME_BASE, (int)len );
                      print_usage_and_abort( error_message );
                  }
                  else if(len&lt;MAX_FILENAME_BASE)
                  {
                      memcpy( params-&gt;filename_base, optarg, len + 1 );
                      break;
          }
          
          else
          {
                  sprintf( error_message, &quot;Unknown command switch %c&quot;, (char)optopt );
                  print_usage_and_abort( error_message );
                  break;
                  }
      }
      
  }
  if( 0==params-&gt;nodes )
      {
          sprintf( error_message, &quot;Number of nodes switch -n is required&quot; );
          print_usage_and_abort( error_message );
      }
      }
  
  int main(int argc, char *argv[])
  {
     struct Params params;
      parse_arguments( argc, argv, &amp;params );
  
      fprintf( stdout, &quot;Parameters are:\n\tNumber of nodes:\t%d\n\tFilename base:\t%s\n\n&quot;, params.nodes, params.filename_base );
      
      return 0;
  }
  </code></pre>