cederom commented on code in PR #3065: URL: https://github.com/apache/nuttx-apps/pull/3065#discussion_r2074031679
########## examples/posix_stdio/posix_stdio.c: ########## @@ -0,0 +1,100 @@ +/**************************************************************************** + * apps/examples/posix_stdio/posix_stdio.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * This is a single POSIX example that works for both Nuttx and Linux distros + * (with minimal changes). By this example its possible to learn how to use + * posix style and also works with onpen(), close() and write() functions. + * + * For linux, need to change the headers and the output device + * A) Headers: + * #include <fcntl.h> + * #include <unistd.h> + * #include <stdio.h> + * #include <string.h> + * + * B) output: + * /dev/tty + * + * To compile it on Linux, you can simple use gcc: + * gcc hello_nuttx.c -o hello_nuttx + * + * To run, just send the following command: ./hello_nuttx Review Comment: `./posix_stdio` ########## examples/posix_stdio/Kconfig: ########## @@ -0,0 +1,20 @@ +config EXAMPLES_POSIX_STDIO # Defines new configuration + bool "Posix STDIO" # Real name inside menuconfig + default n # Enabling this config by default + ---help--- # Text used to show the example purpose + POSIX Style. Using open(), write() and close() via /dev/console Review Comment: * -> Enable POSIX stdio example that shows how to use open(), write() and close() via /dev/console. * remove long line comment. ########## examples/posix_stdio/Make.defs: ########## @@ -0,0 +1,3 @@ +ifneq ($(CONFIG_EXAMPLES_POSIX_STDIO),) Review Comment: Add this to the top: ``` ############################################################################ # apps/examples/posix_stdio/Make.defs # # SPDX-License-Identifier: Apache-2.0 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The # ASF licenses this file to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance with the # License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # ############################################################################ ``` ########## examples/posix_stdio/Kconfig: ########## @@ -0,0 +1,20 @@ +config EXAMPLES_POSIX_STDIO # Defines new configuration + bool "Posix STDIO" # Real name inside menuconfig + default n # Enabling this config by default + ---help--- # Text used to show the example purpose + POSIX Style. Using open(), write() and close() via /dev/console + +config EXAMPLES_POSIX_STDIO_PROGNAME + string "Program name" + default "posix_stdio" # app name (NSH> hello_nuttx) + depends on EXAMPLES_POSIX_STDIO + +config EXAMPLES_POSIX_STDIO_PRIORITY + int "POSIX_STDIO test priority" + default 100 + depends on EXAMPLES_POSIX_STDIO + +config EXAMPLES_POSIX_STDIO_STACKSIZE + int "POSIX_STDIO test stack size" + default 2048 Review Comment: `default DEFAULT_TASK_STACKSIZE` ? ########## examples/posix_stdio/Kconfig: ########## @@ -0,0 +1,20 @@ +config EXAMPLES_POSIX_STDIO # Defines new configuration Review Comment: Please add this comment below in the first lines, and remove long lines comments :-) ``` # # For a description of the syntax of this configuration file, # see the file kconfig-language.txt in the NuttX tools repository. # ``` ########## examples/posix_stdio/Kconfig: ########## @@ -0,0 +1,20 @@ +config EXAMPLES_POSIX_STDIO # Defines new configuration + bool "Posix STDIO" # Real name inside menuconfig Review Comment: * -> `bool "POSIX stdio example"` * remove long line comment. ########## examples/posix_stdio/Kconfig: ########## @@ -0,0 +1,20 @@ +config EXAMPLES_POSIX_STDIO # Defines new configuration + bool "Posix STDIO" # Real name inside menuconfig + default n # Enabling this config by default + ---help--- # Text used to show the example purpose + POSIX Style. Using open(), write() and close() via /dev/console + +config EXAMPLES_POSIX_STDIO_PROGNAME + string "Program name" + default "posix_stdio" # app name (NSH> hello_nuttx) Review Comment: remove long line comment. ########## examples/posix_stdio/Makefile: ########## @@ -0,0 +1,10 @@ +include $(APPDIR)/Make.defs Review Comment: Add this to the top: ``` ############################################################################ # apps/examples/posix_stdio/Makefile # # SPDX-License-Identifier: Apache-2.0 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The # ASF licenses this file to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance with the # License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # ############################################################################ ``` ########## examples/posix_stdio/Kconfig: ########## @@ -0,0 +1,20 @@ +config EXAMPLES_POSIX_STDIO # Defines new configuration + bool "Posix STDIO" # Real name inside menuconfig + default n # Enabling this config by default + ---help--- # Text used to show the example purpose + POSIX Style. Using open(), write() and close() via /dev/console + +config EXAMPLES_POSIX_STDIO_PROGNAME + string "Program name" + default "posix_stdio" # app name (NSH> hello_nuttx) + depends on EXAMPLES_POSIX_STDIO Review Comment: depend on itself? remove plz :-) ########## examples/posix_stdio/Kconfig: ########## @@ -0,0 +1,20 @@ +config EXAMPLES_POSIX_STDIO # Defines new configuration + bool "Posix STDIO" # Real name inside menuconfig + default n # Enabling this config by default + ---help--- # Text used to show the example purpose + POSIX Style. Using open(), write() and close() via /dev/console + +config EXAMPLES_POSIX_STDIO_PROGNAME + string "Program name" + default "posix_stdio" # app name (NSH> hello_nuttx) + depends on EXAMPLES_POSIX_STDIO + +config EXAMPLES_POSIX_STDIO_PRIORITY + int "POSIX_STDIO test priority" + default 100 + depends on EXAMPLES_POSIX_STDIO + +config EXAMPLES_POSIX_STDIO_STACKSIZE + int "POSIX_STDIO test stack size" + default 2048 + depends on EXAMPLES_POSIX_STDIO Review Comment: remove. ########## examples/posix_stdio/Kconfig: ########## @@ -0,0 +1,20 @@ +config EXAMPLES_POSIX_STDIO # Defines new configuration + bool "Posix STDIO" # Real name inside menuconfig + default n # Enabling this config by default + ---help--- # Text used to show the example purpose + POSIX Style. Using open(), write() and close() via /dev/console + +config EXAMPLES_POSIX_STDIO_PROGNAME + string "Program name" + default "posix_stdio" # app name (NSH> hello_nuttx) + depends on EXAMPLES_POSIX_STDIO + +config EXAMPLES_POSIX_STDIO_PRIORITY + int "POSIX_STDIO test priority" + default 100 + depends on EXAMPLES_POSIX_STDIO Review Comment: remove. ########## examples/posix_stdio/CMakeLists.txt: ########## @@ -0,0 +1,9 @@ +if(CONFIG_EXAMPLES_POSIX_STDIO) Review Comment: Add this to the top: ``` # ############################################################################## # apps/examples/posix_stdio/CMakeLists.txt # # SPDX-License-Identifier: Apache-2.0 # # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this # file to you under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. # # ############################################################################## ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org