Roger Light avatar Roger Light committed c97cbb8

Rename all "obj" parameters to "userdata" for consistency with other libraries.

Comments (0)

Files changed (13)

 - Fix document error for mosquitto_message_retry_set().
 - Fix mosquitto_topic_matches_sub() for subscriptions with + as the final
   character. Fixes bug #1085797.
+- Rename all "obj" parameters to "userdata" for consistency with other
+  libraries.
 
 Clients:
 - Clients now display their own version number and library version number in

lib/cpp/mosquittopp.cpp

 
 namespace mosqpp {
 
-static void on_connect_wrapper(struct mosquitto *mosq, void *obj, int rc)
+static void on_connect_wrapper(struct mosquitto *mosq, void *userdata, int rc)
 {
-	class mosquittopp *m = (class mosquittopp *)obj;
+	class mosquittopp *m = (class mosquittopp *)userdata;
 	m->on_connect(rc);
 }
 
-static void on_disconnect_wrapper(struct mosquitto *mosq, void *obj, int rc)
+static void on_disconnect_wrapper(struct mosquitto *mosq, void *userdata, int rc)
 {
-	class mosquittopp *m = (class mosquittopp *)obj;
+	class mosquittopp *m = (class mosquittopp *)userdata;
 	m->on_disconnect(rc);
 }
 
-static void on_publish_wrapper(struct mosquitto *mosq, void *obj, int mid)
+static void on_publish_wrapper(struct mosquitto *mosq, void *userdata, int mid)
 {
-	class mosquittopp *m = (class mosquittopp *)obj;
+	class mosquittopp *m = (class mosquittopp *)userdata;
 	m->on_publish(mid);
 }
 
-static void on_message_wrapper(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)
+static void on_message_wrapper(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *message)
 {
-	class mosquittopp *m = (class mosquittopp *)obj;
+	class mosquittopp *m = (class mosquittopp *)userdata;
 	m->on_message(message);
 }
 
-static void on_subscribe_wrapper(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
+static void on_subscribe_wrapper(struct mosquitto *mosq, void *userdata, int mid, int qos_count, const int *granted_qos)
 {
-	class mosquittopp *m = (class mosquittopp *)obj;
+	class mosquittopp *m = (class mosquittopp *)userdata;
 	m->on_subscribe(mid, qos_count, granted_qos);
 }
 
-static void on_unsubscribe_wrapper(struct mosquitto *mosq, void *obj, int mid)
+static void on_unsubscribe_wrapper(struct mosquitto *mosq, void *userdata, int mid)
 {
-	class mosquittopp *m = (class mosquittopp *)obj;
+	class mosquittopp *m = (class mosquittopp *)userdata;
 	m->on_unsubscribe(mid);
 }
 
 
-static void on_log_wrapper(struct mosquitto *mosq, void *obj, int level, const char *str)
+static void on_log_wrapper(struct mosquitto *mosq, void *userdata, int level, const char *str)
 {
-	class mosquittopp *m = (class mosquittopp *)obj;
+	class mosquittopp *m = (class mosquittopp *)userdata;
 	m->on_log(level, str);
 }
 
 	return mosquitto_want_write(m_mosq);
 }
 
-void mosquittopp::user_data_set(void *obj)
+void mosquittopp::user_data_set(void *userdata)
 {
-	mosquitto_user_data_set(m_mosq, obj);
+	mosquitto_user_data_set(m_mosq, userdata);
 }
 
 int mosquittopp::tls_set(const char *cafile, const char *capath, const char *certfile, const char *keyfile, int (*pw_callback)(char *buf, int size, int rwflag, void *userdata))

lib/cpp/mosquittopp.h

 		int subscribe(int *mid, const char *sub, int qos=0);
 		int unsubscribe(int *mid, const char *sub);
 		void message_retry_set(unsigned int message_retry);
-		void user_data_set(void *obj);
+		void user_data_set(void *userdata);
 		int tls_set(const char *cafile, const char *capath=NULL, const char *certfile=NULL, const char *keyfile=NULL, int (*pw_callback)(char *buf, int size, int rwflag, void *userdata)=NULL);
 		int tls_opts_set(int cert_reqs, const char *tls_version=NULL, const char *ciphers=NULL);
 		int tls_psk_set(const char *psk, const char *identity, const char *ciphers=NULL);

lib/logging_mosq.c

 		va_end(va);
 		s[len-1] = '\0'; /* Ensure string is null terminated. */
 
-		mosq->on_log(mosq, mosq->obj, priority, s);
+		mosq->on_log(mosq, mosq->userdata, priority, s);
 
 		_mosquitto_free(s);
 	}
 	return MOSQ_ERR_SUCCESS;
 }
 
-struct mosquitto *mosquitto_new(const char *id, bool clean_session, void *obj)
+struct mosquitto *mosquitto_new(const char *id, bool clean_session, void *userdata)
 {
 	struct mosquitto *mosq = NULL;
 	int rc;
 #ifdef WITH_THREADING
 		mosq->thread_id = pthread_self();
 #endif
-		rc = mosquitto_reinitialise(mosq, id, clean_session, obj);
+		rc = mosquitto_reinitialise(mosq, id, clean_session, userdata);
 		if(rc){
 			mosquitto_destroy(mosq);
 			if(rc == MOSQ_ERR_INVAL){
 	return mosq;
 }
 
-int mosquitto_reinitialise(struct mosquitto *mosq, const char *id, bool clean_session, void *obj)
+int mosquitto_reinitialise(struct mosquitto *mosq, const char *id, bool clean_session, void *userdata)
 {
 	int i;
 
 	_mosquitto_destroy(mosq);
 	memset(mosq, 0, sizeof(struct mosquitto));
 
-	if(obj){
-		mosq->obj = obj;
+	if(userdata){
+		mosq->userdata = userdata;
 	}else{
-		mosq->obj = mosq;
+		mosq->userdata = mosq;
 	}
 	mosq->sock = INVALID_SOCKET;
 	mosq->keepalive = 60;
 				pthread_mutex_lock(&mosq->callback_mutex);
 				if(mosq->on_disconnect){
 					mosq->in_callback = true;
-					mosq->on_disconnect(mosq, mosq->obj, rc);
+					mosq->on_disconnect(mosq, mosq->userdata, rc);
 					mosq->in_callback = false;
 				}
 				pthread_mutex_unlock(&mosq->callback_mutex);
 				pthread_mutex_lock(&mosq->callback_mutex);
 				if(mosq->on_disconnect){
 					mosq->in_callback = true;
-					mosq->on_disconnect(mosq, mosq->obj, rc);
+					mosq->on_disconnect(mosq, mosq->userdata, rc);
 					mosq->in_callback = false;
 				}
 				pthread_mutex_unlock(&mosq->callback_mutex);
 		pthread_mutex_lock(&mosq->callback_mutex);
 		if(mosq->on_disconnect){
 			mosq->in_callback = true;
-			mosq->on_disconnect(mosq, mosq->obj, rc);
+			mosq->on_disconnect(mosq, mosq->userdata, rc);
 			mosq->in_callback = false;
 		}
 		pthread_mutex_unlock(&mosq->callback_mutex);
 	pthread_mutex_unlock(&mosq->log_callback_mutex);
 }
 
-void mosquitto_user_data_set(struct mosquitto *mosq, void *obj)
+void mosquitto_user_data_set(struct mosquitto *mosq, void *userdata)
 {
 	if(mosq){
-		mosq->obj = obj;
+		mosq->userdata = userdata;
 	}
 }
 

lib/mosquitto_internal.h

 	time_t disconnect_t;
 	int pollfd_index;
 #else
-	void *obj;
+	void *userdata;
 	bool in_callback;
 	unsigned int message_retry;
 	time_t last_retry_check;
 	struct mosquitto_message_all *messages;
-	void (*on_connect)(struct mosquitto *, void *obj, int rc);
-	void (*on_disconnect)(struct mosquitto *, void *obj, int rc);
-	void (*on_publish)(struct mosquitto *, void *obj, int mid);
-	void (*on_message)(struct mosquitto *, void *obj, const struct mosquitto_message *message);
-	void (*on_subscribe)(struct mosquitto *, void *obj, int mid, int qos_count, const int *granted_qos);
-	void (*on_unsubscribe)(struct mosquitto *, void *obj, int mid);
-	void (*on_log)(struct mosquitto *, void *obj, int level, const char *str);
+	void (*on_connect)(struct mosquitto *, void *userdata, int rc);
+	void (*on_disconnect)(struct mosquitto *, void *userdata, int rc);
+	void (*on_publish)(struct mosquitto *, void *userdata, int mid);
+	void (*on_message)(struct mosquitto *, void *userdata, const struct mosquitto_message *message);
+	void (*on_subscribe)(struct mosquitto *, void *userdata, int mid, int qos_count, const int *granted_qos);
+	void (*on_unsubscribe)(struct mosquitto *, void *userdata, int mid);
+	void (*on_log)(struct mosquitto *, void *userdata, int level, const char *str);
 	//void (*on_error)();
 	char *host;
 	int port;
 			if(mosq->on_publish){
 				/* This is a QoS=0 message */
 				mosq->in_callback = true;
-				mosq->on_publish(mosq, mosq->obj, packet->mid);
+				mosq->on_publish(mosq, mosq->userdata, packet->mid);
 				mosq->in_callback = false;
 			}
 			pthread_mutex_unlock(&mosq->callback_mutex);

lib/python/mosquitto.py

     broker. To use a callback, define a function and then assign it to the
     client:
     
-    def on_connect(mosq, obj, rc):
+    def on_connect(mosq, userdata, rc):
         print("Connection returned " + str(rc))
 
     client.on_connect = on_connect
 
-    All of the callbacks as described below have a "mosq" and an "obj"
+    All of the callbacks as described below have a "mosq" and an "userdata"
     argument. "mosq" is the Mosquitto instance that is calling the callback.
-    "obj" is user data of any type and can be set when creating a new client
-    instance or with user_data_set(obj).
+    "userdata" is user data of any type and can be set when creating a new client
+    instance or with user_data_set(userdata).
     
     The callbacks:
 
-    on_connect(mosq, obj, rc): called when the broker responds to our connection
+    on_connect(mosq, userdata, rc): called when the broker responds to our connection
       request. The value of rc determines success or not:
       0: Connection successful
       1: Connection refused - incorrect protocol version
       5: Connection refused - not authorised
       6-255: Currently unused.
 
-    on_disconnect(mosq, obj, rc): called when the client disconnects from the broker.
+    on_disconnect(mosq, userdata, rc): called when the client disconnects from the broker.
       The rc parameter indicates the disconnection state. If MOSQ_ERR_SUCCESS
       (0), the callback was called in response to a disconnect() call. If any
       other value the disconnection was unexpected, such as might be caused by
       a network error.
 
-    on_message(mosq, obj, message): called when a message has been received on a
+    on_message(mosq, userdata, message): called when a message has been received on a
       topic that the client subscribes to. The message variable is a
       MosquittoMessage that describes all of the message parameters.
 
-    on_publish(mosq, obj, mid): called when a message that was to be sent using the
+    on_publish(mosq, userdata, mid): called when a message that was to be sent using the
       publish() call has completed transmission to the broker. For messages
       with QoS levels 1 and 2, this means that the appropriate handshakes have
       completed. For QoS 0, this simply means that the message has left the
       This callback is important because even if the publish() call returns
       success, it does not always mean that the message has been sent.
 
-    on_subscribe(mosq, obj, mid, granted_qos): called when the broker responds to a
+    on_subscribe(mosq, userdata, mid, granted_qos): called when the broker responds to a
       subscribe request. The mid variable matches the mid variable returned
       from the corresponding subscribe() call. The granted_qos variable is a
       list of integers that give the QoS level the broker has granted for each
       of the different subscription requests.
 
-    on_unsubscribe(mosq, obj, mid): called when the broker responds to an unsubscribe
+    on_unsubscribe(mosq, userdata, mid): called when the broker responds to an unsubscribe
       request. The mid variable matches the mid variable returned from the
       corresponding unsubscribe() call.
 
-    on_log(mosq, obj, level, buf): called when the client has log information. Define
+    on_log(mosq, userdata, level, buf): called when the client has log information. Define
       to allow debugging. The level variable gives the severity of the message
       and will be one of MOSQ_LOG_INFO, MOSQ_LOG_NOTICE, MOSQ_LOG_WARNING,
       MOSQ_LOG_ERR, and MOSQ_LOG_DEBUG. The message itself is in buf.
 
     """
-    def __init__(self, client_id="", clean_session=True, obj=None):
+    def __init__(self, client_id="", clean_session=True, userdata=None):
         """client_id is the unique client id string used when connecting to the
         broker. If client_id is zero length or None, then one will be randomly
         generated. In this case, clean_session must be True. If this is not the
         disconnect. Calling connect() or reconnect() will cause the messages to
         be resent.  Use reinitialise() to reset a client to its original state.
 
-        obj is user defined data of any type that is passed as the "obj"
+        userdata is user defined data of any type that is passed as the "userdata"
         parameter to callbacks. It may be updated at a later point with the
         user_data_set() function.
         """
         if clean_session == False and (client_id == "" or client_id == None):
             raise ValueError('A client id must be provided if clean session is False.')
 
-        self._obj = obj
+        self._userdata = userdata
         self._sock = None
         self._keepalive = 60
         self._message_retry = 20
     def __del__(self):
         pass
 
-    def reinitialise(self, client_id="", clean_session=True, obj=None):
+    def reinitialise(self, client_id="", clean_session=True, userdata=None):
         if self._ssl:
             self._ssl.close()
             self._ssl = None
         elif self._sock:
             self._sock.close()
             self._sock = None
-        self.__init__(client_id, clean_session, obj)
+        self.__init__(client_id, clean_session, userdata)
 
     def tls_set(self, ca_certs, certfile=None, keyfile=None, cert_reqs=ssl.CERT_REQUIRED, tls_version=ssl.PROTOCOL_TLSv1, ciphers=None):
         """Configure network encryption and authentication options. Enables SSL/TLS support.
                 self._callback_mutex.acquire()
                 if self.on_disconnect:
                     self._in_callback = True
-                    self.on_disconnect(self, self._obj, rc)
+                    self.on_disconnect(self, self._userdata, rc)
                     self._in_callback = False
 
                 self._callback_mutex.release()
                 self._callback_mutex.acquire()
                 if self.on_disconnect:
                     self._in_callback = True
-                    self.on_disconnect(self, self._obj, rc)
+                    self.on_disconnect(self, self._userdata, rc)
                     self._in_callback = False
                 self._callback_mutex.release()
                 return rc
                 rc = 1
             if self.on_disconnect:
                 self._in_callback = True
-                self.on_disconnect(self, self._obj, rc)
+                self.on_disconnect(self, self._userdata, rc)
                 self._in_callback = False
             self._callback_mutex.release()
             return MOSQ_ERR_CONN_LOST
 
         self._message_retry = retry
 
-    def user_data_set(self, obj):
+    def user_data_set(self, userdata):
         """Set the user data variable passed to callbacks. May be any data type."""
-        self._obj = obj
+        self._userdata = userdata
 
     def will_set(self, topic, payload=None, qos=0, retain=False):
         """Set a Will to be sent by the broker in case the client disconnects unexpectedly.
                         self._callback_mutex.acquire()
                         if self.on_publish:
                             self._in_callback = True
-                            self.on_publish(self, self._obj, packet.mid)
+                            self.on_publish(self, self._userdata, packet.mid)
                             self._in_callback = False
 
                         self._callback_mutex.release()
 
     def _easy_log(self, level, buf):
         if self.on_log:
-            self.on_log(self, self._obj, level, buf)
+            self.on_log(self, self._userdata, level, buf)
 
     def _check_keepalive(self):
         now = time.time()
                 self._callback_mutex.acquire()
                 if self.on_disconnect:
                     self._in_callback = True
-                    self.on_disconnect(self, self._obj, rc)
+                    self.on_disconnect(self, self._userdata, rc)
                     self._in_callback = False
                 self._callback_mutex.release()
 
         self._callback_mutex.acquire()
         if self.on_connect:
             self._in_callback = True
-            self.on_connect(self, self._obj, result)
+            self.on_connect(self, self._userdata, result)
             self._in_callback = False
         self._callback_mutex.release()
         if result == 0:
         self._callback_mutex.acquire()
         if self.on_subscribe:
             self._in_callback = True
-            self.on_subscribe(self, self._obj, mid, granted_qos)
+            self.on_subscribe(self, self._userdata, mid, granted_qos)
             self._in_callback = False
         self._callback_mutex.release()
 
             self._callback_mutex.acquire()
             if self.on_message:
                 self._in_callback = True
-                self.on_message(self, self._obj, message)
+                self.on_message(self, self._userdata, message)
                 self._in_callback = False
 
             self._callback_mutex.release()
             self._callback_mutex.acquire()
             if self.on_message:
                 self._in_callback = True
-                self.on_message(self, self._obj, message)
+                self.on_message(self, self._userdata, message)
                 self._in_callback = False
 
             self._callback_mutex.release()
                 self._callback_mutex.acquire()
                 if self.on_message:
                     self._in_callback = True
-                    self.on_message(self, self._obj, self._messages[i])
+                    self.on_message(self, self._userdata, self._messages[i])
                     self._in_callback = False
                 self._callback_mutex.release()
                 self._messages.pop(i)
         self._callback_mutex.acquire()
         if self.on_unsubscribe:
             self._in_callback = True
-            self.on_unsubscribe(self, self._obj, mid)
+            self.on_unsubscribe(self, self._userdata, mid)
             self._in_callback = False
         self._callback_mutex.release()
         return MOSQ_ERR_SUCCESS
                     self._callback_mutex.acquire()
                     if self.on_publish:
                         self._in_callback = True
-                        self.on_publish(self, self._obj, mid)
+                        self.on_publish(self, self._userdata, mid)
                         self._in_callback = False
 
                     self._callback_mutex.release()

lib/read_handle.c

 			pthread_mutex_lock(&mosq->callback_mutex);
 			if(mosq->on_message){
 				mosq->in_callback = true;
-				mosq->on_message(mosq, mosq->obj, &message->msg);
+				mosq->on_message(mosq, mosq->userdata, &message->msg);
 				mosq->in_callback = false;
 			}
 			pthread_mutex_unlock(&mosq->callback_mutex);
 			pthread_mutex_lock(&mosq->callback_mutex);
 			if(mosq->on_message){
 				mosq->in_callback = true;
-				mosq->on_message(mosq, mosq->obj, &message->msg);
+				mosq->on_message(mosq, mosq->userdata, &message->msg);
 				mosq->in_callback = false;
 			}
 			pthread_mutex_unlock(&mosq->callback_mutex);

lib/read_handle_client.c

 	pthread_mutex_lock(&mosq->callback_mutex);
 	if(mosq->on_connect){
 		mosq->in_callback = true;
-		mosq->on_connect(mosq, mosq->obj, result);
+		mosq->on_connect(mosq, mosq->userdata, result);
 		mosq->in_callback = false;
 	}
 	pthread_mutex_unlock(&mosq->callback_mutex);

lib/read_handle_shared.c

 		pthread_mutex_lock(&mosq->callback_mutex);
 		if(mosq->on_publish){
 			mosq->in_callback = true;
-			mosq->on_publish(mosq, mosq->obj, mid);
+			mosq->on_publish(mosq, mosq->userdata, mid);
 			mosq->in_callback = false;
 		}
 		pthread_mutex_unlock(&mosq->callback_mutex);
 		pthread_mutex_lock(&mosq->callback_mutex);
 		if(mosq->on_message){
 			mosq->in_callback = true;
-			mosq->on_message(mosq, mosq->obj, &message->msg);
+			mosq->on_message(mosq, mosq->userdata, &message->msg);
 			mosq->in_callback = false;
 		}
 		pthread_mutex_unlock(&mosq->callback_mutex);
 	pthread_mutex_lock(&mosq->callback_mutex);
 	if(mosq->on_subscribe){
 		mosq->in_callback = true;
-		mosq->on_subscribe(mosq, mosq->obj, mid, qos_count, granted_qos);
+		mosq->on_subscribe(mosq, mosq->userdata, mid, qos_count, granted_qos);
 		mosq->in_callback = false;
 	}
 	pthread_mutex_unlock(&mosq->callback_mutex);
 	pthread_mutex_lock(&mosq->callback_mutex);
 	if(mosq->on_unsubscribe){
 		mosq->in_callback = true;
-	   	mosq->on_unsubscribe(mosq, mosq->obj, mid);
+	   	mosq->on_unsubscribe(mosq, mosq->userdata, mid);
 		mosq->in_callback = false;
 	}
 	pthread_mutex_unlock(&mosq->callback_mutex);
 			pthread_mutex_lock(&mosq->callback_mutex);
 			if(mosq->on_disconnect){
 				mosq->in_callback = true;
-				mosq->on_disconnect(mosq, mosq->obj, rc);
+				mosq->on_disconnect(mosq, mosq->userdata, rc);
 				mosq->in_callback = false;
 			}
 			pthread_mutex_unlock(&mosq->callback_mutex);

man/libmosquitto.3.xml

 			<funcsynopsis><funcprototype><funcdef>struct mosquitto *<function>mosquitto_new</function></funcdef>
 					<paramdef>const char *<parameter>id</parameter></paramdef>
 					<paramdef>bool <parameter>clean_session</parameter></paramdef>
-					<paramdef>void *<parameter>obj</parameter></paramdef>
+					<paramdef>void *<parameter>userdata</parameter></paramdef>
 			</funcprototype></funcsynopsis>
 			<para>Create a new mosquitto client instance.</para>
 
 					<paramdef>struct mosquitto *<parameter>mosq</parameter></paramdef>
 					<paramdef>const char *<parameter>id</parameter></paramdef>
 					<paramdef>bool <parameter>clean_session</parameter></paramdef>
-					<paramdef>void *<parameter>obj</parameter></paramdef>
+					<paramdef>void *<parameter>userdata</parameter></paramdef>
 			</funcprototype></funcsynopsis>
 		</refsect2>
 
 					<paramdef>struct mosquitto *<parameter>mosq</parameter></paramdef>
 			</funcprototype></funcsynopsis>
 
+			<funcsynopsis><funcprototype><funcdef>int <function>mosquitto_loop_forever</function></funcdef>
+					<paramdef>struct mosquitto *<parameter>mosq</parameter></paramdef>
+					<paramdef>int <parameter>timeout</parameter></paramdef>
+					<paramdef>int <parameter>max_packets</parameter></paramdef>
+			</funcprototype></funcsynopsis>
+
 			<funcsynopsis><funcprototype><funcdef>int <function>mosquitto_socket</function></funcdef>
 					<paramdef>struct mosquitto *<parameter>mosq</parameter></paramdef>
 			</funcprototype></funcsynopsis>
 
 			<funcsynopsis><funcprototype><funcdef>int <function>mosquitto_user_data_set</function></funcdef>
 					<paramdef>struct mosquitto *<parameter>mosq</parameter></paramdef>
-					<paramdef>void *<parameter>obj</parameter></paramdef>
+					<paramdef>void *<parameter>userdata</parameter></paramdef>
 			</funcprototype></funcsynopsis>
 		</refsect2>
 
 #include &lt;stdio.h&gt;
 #include &lt;mosquitto.h&gt;
 
-void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)
+void my_message_callback(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *message)
 {
 	if(message->payloadlen){
 		printf("%s %s\n", message->topic, message->payload);
 	fflush(stdout);
 }
 
-void my_connect_callback(struct mosquitto *mosq, void *obj, int result)
+void my_connect_callback(struct mosquitto *mosq, void *userdata, int result)
 {
 	int i;
 	if(!result){
 	}
 }
 
-void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
+void my_subscribe_callback(struct mosquitto *mosq, void *userdata, int mid, int qos_count, const int *granted_qos)
 {
 	int i;
 
 	printf("\n");
 }
 
-void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *str)
+void my_log_callback(struct mosquitto *mosq, void *userdata, int level, const char *str)
 {
 	/* Pring all log messages regardless of level. */
 	printf("%s\n", str);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.